Proposal for Decimal64 and Decimal128 value-based classes

Lance Andersen lance.andersen at oracle.com
Wed Mar 31 14:39:00 UTC 2021


Agree this could be beneficial to JDBC users.  To officially support this in JDBC would require an MR but as Douglas indicates  the work required to the JDBC spec would be minimal

Best
Lance

On Mar 31, 2021, at 10:23 AM, Douglas Surber <douglas.surber at oracle.com<mailto:douglas.surber at oracle.com>> wrote:

+1

JDBC would support this immediately. All it would take is the addition of a couple of lines in some appendices to require that conforming implementations of getObject(int, Class), setObject(int, Object, SQLType), etc support Decimal64 and Decimal128. No change to the API required. Driver vendors could add this support the instant the types are available, no need to wait for a change in the JDBC spec.

This would be a huge win for many Java apps. A large fraction of Java apps deal with money in some form. Binary floats are inappropriate for money and BigDecimal is too big and too slow.

Rather than waiting on Valhala I would prefer that this project be fast tracked and added to OpenJDK ASAP.

Thanks for doing this.

Douglas

On Mar 30, 2021, at 10:10 PM, core-libs-dev-request at openjdk.java.net<mailto:core-libs-dev-request at openjdk.java.net><mailto:core-libs-dev-request at openjdk.java.net> wrote:

Date: Tue, 30 Mar 2021 22:12:32 -0400
From: Brian Goetz <brian.goetz at oracle.com<mailto:brian.goetz at oracle.com><mailto:brian.goetz at oracle.com>>
To: Raffaello Giulietti <raffaello.giulietti at gmail.com<mailto:raffaello.giulietti at gmail.com><mailto:raffaello.giulietti at gmail.com>>, Paul Sandoz
<paul.sandoz at oracle.com<mailto:paul.sandoz at oracle.com><mailto:paul.sandoz at oracle.com>>
Cc: core-libs-dev <core-libs-dev at openjdk.java.net<mailto:core-libs-dev at openjdk.java.net><mailto:core-libs-dev at openjdk.java.net>>
Subject: Re: Proposal for Decimal64 and Decimal128 value-based classes
Message-ID: <64334a24-0e4c-57b8-b666-447ca3508ce5 at oracle.com<mailto:64334a24-0e4c-57b8-b666-447ca3508ce5 at oracle.com><mailto:64334a24-0e4c-57b8-b666-447ca3508ce5 at oracle.com>>
Content-Type: text/plain; charset=utf-8; format=flowed

They'll find a natural home in JDBC, since SQL has a native decimal type.

On 3/30/2021 7:05 PM, Raffaello Giulietti wrote:

As far as I can tell, scientific computation will make use of binary
floating point numbers for a long time. Decimal floating point numbers
are still limited to biz and fin applications.



[cid:E1C4E2F0-ECD0-4C9D-ADB4-B16CA7BCB7FC at home]



Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com<mailto:Lance.Andersen at oracle.com>





More information about the core-libs-dev mailing list