digitalmars.D.announce - Decimal Numbers
- Paul D Anderson (81/81) Jul 03 2014 A candidate implementation of decimal numbers (arbitrary-precision
- Paul D Anderson (2/2) Jul 03 2014 Sorry for the unusual formatting.
- Iain Buclaw via Digitalmars-d-announce (28/78) Jul 03 2014 NOTEs
- Paul D Anderson (4/7) Jul 04 2014 Thanks, will do.
- Remo (2/85) Jul 04 2014 This is looking very promising!
- Remo (5/88) Jul 05 2014 I have spend some times fixing this and now it compiles with DMD
- Poyeyo (1/1) Jul 06 2014 Can you add a dub.json and submit it to the dub registry?
- Paul D Anderson (3/4) Jul 06 2014 I can do that but I want to get the 32-, 64- and 128-bit structs
- Paul D Anderson (8/9) Jul 07 2014 etcimon generated a dub.json file which I've merged into github.
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (5/13) Jul 08 2014 git tag v0.9.0
- Paul D Anderson (2/22) Jul 08 2014 Thanks. That did it.
- Gary Willoughby (5/14) Jul 08 2014 If you want to do this in github just click the releases tab on
A candidate implementation of decimal numbers (arbitrary-precision floating-point numbers) is available for review at https://github.com/andersonpd/eris/tree/master/eris/decimal. This is a substantial rework of an earlier implementation which was located at https://github.com/andersonpd/decimal. This is a D language implementation of the General Decimal Arithmetic Specification (http://www.speleotrove.com/decimal/decarith.pdf), which is compliant with IEEE-754 and other standards as noted in the specification. The current implementation is not complete; there are a lot of TODOs and NOTEs scattered throughout the code, but all the arithmetic and miscellaneous operations listed in the spec are working, along with decimal versions of most of the functions and constants in std.math. I think it is far enough along for effective review. Briefly, this software adds the capability of properly rounded arbitrary-precision floating-point arithmetic to the D language. All arithmetic operations are governed by a "context", which specifies the precision (number of decimal digits) and rounding mode for the operations. This same functionality exists in most modern computer languages (for example, java.math.BigDecimal). Unlike Java, however, which uses function syntax for arithmetic ops (add(BigDecimal, BigDecimal), etc.), in D the same arithmetic operators that work for floats or doubles work for decimal numbers. (Of course!) In this implementation decimal numbers having different contexts are different types. The types are specified using template parameters for the precision, maximum exponent value and rounding mode. This means that Decimal!(9,99,Rounding.HALF_EVEN) is a different type than Decimal!(19,199,Rounding.HALF_DOWN). They are largely interoperable, however. Different decimal types can be cast to and from each other. There are three standard decimal structs which fit into 32-, 64- and 128-bits of memory, with 7, 16 and 34 digit precision, respectively. These are used for compact storage; they are converted to their corresponding decimal numbers for calculation. They bear the same relation to decimal numbers as Walter's half-float type does to floats. (http://www.drdobbs.com/cpp/implementing-half-floats-in-d/240146674). Implementation of these still needs a little work, and will be added to github very shortly. Major TODO items: 1) The current underlying integer type uses my own big integer struct (eris.integer.extended) rather than std.bigint. This was mainly due to problems with constness and CTFE of BigInts. These problems have since been resolved, but I didn't want to switch over to BigInts until everything was working for fear of introducing new bugs. 2) Integration of Decimal32, Decimal64 and Decimal128 structs are not complete. (See above.) 3) Conversion to and from floats, doubles and reals is currently working but it is slow. (Conversion is through strings: double to string to decimal and vice versa.) 4) Still incomplete implementations of some functions in decimal.math: expm1, acosh, atanh, possibly others. 5) More unit tests (always!).
Jul 03 2014
On 3 Jul 2014 23:00, "Paul D Anderson via Digitalmars-d-announce" < digitalmars-d-announce puremagic.com> wrote:A candidate implementation of decimal numbers (arbitrary-precision floating-point numbers) is available for review at https://github.com/andersonpd/eris/tree/master/eris/decimal. This is a substantial rework of an earlier implementation which was located at https://github.com/andersonpd/decimal. This is a D language implementation of the General Decimal Arithmetic Specification (http://www.speleotrove.com/decimal/decarith.pdf), which is compliant with IEEE-754 and other standards as noted in the specification. The current implementation is not complete; there are a lot of TODOs andNOTEsscattered throughout the code, but all the arithmetic and miscellaneous operations listed in the spec are working, along with decimal versions ofmostof the functions and constants in std.math. I think it is far enoughalong foreffective review. Briefly, this software adds the capability of properly rounded arbitrary-precision floating-point arithmetic to the D language. Allarithmeticoperations are governed by a "context", which specifies the precision(number ofdecimal digits) and rounding mode for the operations. This samefunctionalityexists in most modern computer languages (for example,java.math.BigDecimal).Unlike Java, however, which uses function syntax for arithmetic ops (add(BigDecimal, BigDecimal), etc.), in D the same arithmetic operatorsthatwork for floats or doubles work for decimal numbers. (Of course!) In this implementation decimal numbers having different contexts aredifferenttypes. The types are specified using template parameters for theprecision,maximum exponent value and rounding mode. This means that Decimal!(9,99,Rounding.HALF_EVEN) is a different type than Decimal!(19,199,Rounding.HALF_DOWN). They are largely interoperable,however.Different decimal types can be cast to and from each other. There are three standard decimal structs which fit into 32-, 64- and128-bits ofmemory, with 7, 16 and 34 digit precision, respectively. These are usedforcompact storage; they are converted to their corresponding decimalnumbers forcalculation. They bear the same relation to decimal numbers as Walter's half-float type does to floats. (http://www.drdobbs.com/cpp/implementing-half-floats-in-d/240146674). Implementation of these still needs a little work, and will be added togithubvery shortly. Major TODO items: 1) The current underlying integer type uses my own big integer struct (eris.integer.extended) rather than std.bigint. This was mainly due toproblemswith constness and CTFE of BigInts. These problems have since beenresolved, butI didn't want to switch over to BigInts until everything was working forfear ofintroducing new bugs. 2) Integration of Decimal32, Decimal64 and Decimal128 structs are notcomplete.(See above.) 3) Conversion to and from floats, doubles and reals is currently workingbut itis slow. (Conversion is through strings: double to string to decimal andviceversa.) 4) Still incomplete implementations of some functions in decimal.math:expm1,acosh, atanh, possibly others. 5) More unit tests (always!).Nice job. I would also add: 6) Rename the file decimal.d to package.d, and module eris.decimal.decimal to eris.decimal
Jul 03 2014
On Friday, 4 July 2014 at 06:43:15 UTC, Iain Buclaw via Digitalmars-d-announce wrote:6) Rename the file decimal.d to package.d, and module eris.decimal.decimal to eris.decimalThanks, will do. Paul
Jul 04 2014
On Thursday, 3 July 2014 at 21:55:42 UTC, Paul D Anderson wrote:A candidate implementation of decimal numbers (arbitrary-precision floating-point numbers) is available for review at https://github.com/andersonpd/eris/tree/master/eris/decimal. This is a substantial rework of an earlier implementation which was located at https://github.com/andersonpd/decimal. This is a D language implementation of the General Decimal Arithmetic Specification (http://www.speleotrove.com/decimal/decarith.pdf), which is compliant with IEEE-754 and other standards as noted in the specification. The current implementation is not complete; there are a lot of TODOs and NOTEs scattered throughout the code, but all the arithmetic and miscellaneous operations listed in the spec are working, along with decimal versions of most of the functions and constants in std.math. I think it is far enough along for effective review. Briefly, this software adds the capability of properly rounded arbitrary-precision floating-point arithmetic to the D language. All arithmetic operations are governed by a "context", which specifies the precision (number of decimal digits) and rounding mode for the operations. This same functionality exists in most modern computer languages (for example, java.math.BigDecimal). Unlike Java, however, which uses function syntax for arithmetic ops (add(BigDecimal, BigDecimal), etc.), in D the same arithmetic operators that work for floats or doubles work for decimal numbers. (Of course!) In this implementation decimal numbers having different contexts are different types. The types are specified using template parameters for the precision, maximum exponent value and rounding mode. This means that Decimal!(9,99,Rounding.HALF_EVEN) is a different type than Decimal!(19,199,Rounding.HALF_DOWN). They are largely interoperable, however. Different decimal types can be cast to and from each other. There are three standard decimal structs which fit into 32-, 64- and 128-bits of memory, with 7, 16 and 34 digit precision, respectively. These are used for compact storage; they are converted to their corresponding decimal numbers for calculation. They bear the same relation to decimal numbers as Walter's half-float type does to floats. (http://www.drdobbs.com/cpp/implementing-half-floats-in-d/240146674). Implementation of these still needs a little work, and will be added to github very shortly. Major TODO items: 1) The current underlying integer type uses my own big integer struct (eris.integer.extended) rather than std.bigint. This was mainly due to problems with constness and CTFE of BigInts. These problems have since been resolved, but I didn't want to switch over to BigInts until everything was working for fear of introducing new bugs. 2) Integration of Decimal32, Decimal64 and Decimal128 structs are not complete. (See above.) 3) Conversion to and from floats, doubles and reals is currently working but it is slow. (Conversion is through strings: double to string to decimal and vice versa.) 4) Still incomplete implementations of some functions in decimal.math: expm1, acosh, atanh, possibly others. 5) More unit tests (always!).This is looking very promising!
Jul 04 2014
On Thursday, 3 July 2014 at 21:55:42 UTC, Paul D Anderson wrote:A candidate implementation of decimal numbers (arbitrary-precision floating-point numbers) is available for review at https://github.com/andersonpd/eris/tree/master/eris/decimal. This is a substantial rework of an earlier implementation which was located at https://github.com/andersonpd/decimal. This is a D language implementation of the General Decimal Arithmetic Specification (http://www.speleotrove.com/decimal/decarith.pdf), which is compliant with IEEE-754 and other standards as noted in the specification. The current implementation is not complete; there are a lot of TODOs and NOTEs scattered throughout the code, but all the arithmetic and miscellaneous operations listed in the spec are working, along with decimal versions of most of the functions and constants in std.math. I think it is far enough along for effective review. Briefly, this software adds the capability of properly rounded arbitrary-precision floating-point arithmetic to the D language. All arithmetic operations are governed by a "context", which specifies the precision (number of decimal digits) and rounding mode for the operations. This same functionality exists in most modern computer languages (for example, java.math.BigDecimal). Unlike Java, however, which uses function syntax for arithmetic ops (add(BigDecimal, BigDecimal), etc.), in D the same arithmetic operators that work for floats or doubles work for decimal numbers. (Of course!) In this implementation decimal numbers having different contexts are different types. The types are specified using template parameters for the precision, maximum exponent value and rounding mode. This means that Decimal!(9,99,Rounding.HALF_EVEN) is a different type than Decimal!(19,199,Rounding.HALF_DOWN). They are largely interoperable, however. Different decimal types can be cast to and from each other. There are three standard decimal structs which fit into 32-, 64- and 128-bits of memory, with 7, 16 and 34 digit precision, respectively. These are used for compact storage; they are converted to their corresponding decimal numbers for calculation. They bear the same relation to decimal numbers as Walter's half-float type does to floats. (http://www.drdobbs.com/cpp/implementing-half-floats-in-d/240146674). Implementation of these still needs a little work, and will be added to github very shortly. Major TODO items: 1) The current underlying integer type uses my own big integer struct (eris.integer.extended) rather than std.bigint. This was mainly due to problems with constness and CTFE of BigInts. These problems have since been resolved, but I didn't want to switch over to BigInts until everything was working for fear of introducing new bugs. 2) Integration of Decimal32, Decimal64 and Decimal128 structs are not complete. (See above.) 3) Conversion to and from floats, doubles and reals is currently working but it is slow. (Conversion is through strings: double to string to decimal and vice versa.) 4) Still incomplete implementations of some functions in decimal.math: expm1, acosh, atanh, possibly others. 5) More unit tests (always!).I have spend some times fixing this and now it compiles with DMD 2.066. Also fixed some tests. https://github.com/Remotion/decimal
Jul 05 2014
Can you add a dub.json and submit it to the dub registry?
Jul 06 2014
On Monday, 7 July 2014 at 03:26:54 UTC, Poyeyo wrote:Can you add a dub.json and submit it to the dub registry?I can do that but I want to get the 32-, 64- and 128-bit structs in place first. Probably by midweek (July 9).
Jul 06 2014
On Monday, 7 July 2014 at 03:26:54 UTC, Poyeyo wrote:Can you add a dub.json and submit it to the dub registry?etcimon generated a dub.json file which I've merged into github. Thanks. However, I am unable to register the package because it requires a version number, which I don't know how to add. I've used git tag and edited dub.selections.json, but neither seems to be the answer. Can someone enlighten me? Paul
Jul 07 2014
Am 07.07.2014 23:15, schrieb Paul D Anderson:On Monday, 7 July 2014 at 03:26:54 UTC, Poyeyo wrote:git tag v0.9.0 git push --tags should do the trick (as well as any other version instead of 0.9.0, of course).Can you add a dub.json and submit it to the dub registry?etcimon generated a dub.json file which I've merged into github. Thanks. However, I am unable to register the package because it requires a version number, which I don't know how to add. I've used git tag and edited dub.selections.json, but neither seems to be the answer. Can someone enlighten me? Paul
Jul 08 2014
On Tuesday, 8 July 2014 at 08:15:28 UTC, Sönke Ludwig wrote:Am 07.07.2014 23:15, schrieb Paul D Anderson:Thanks. That did it.On Monday, 7 July 2014 at 03:26:54 UTC, Poyeyo wrote:git tag v0.9.0 git push --tags should do the trick (as well as any other version instead of 0.9.0, of course).Can you add a dub.json and submit it to the dub registry?etcimon generated a dub.json file which I've merged into github. Thanks. However, I am unable to register the package because it requires a version number, which I don't know how to add. I've used git tag and edited dub.selections.json, but neither seems to be the answer. Can someone enlighten me? Paul
Jul 08 2014
On Monday, 7 July 2014 at 21:15:33 UTC, Paul D Anderson wrote:On Monday, 7 July 2014 at 03:26:54 UTC, Poyeyo wrote:If you want to do this in github just click the releases tab on your repo and create a new release with the tag and name formatted as a SemVer[1] tag. [1]: http://semver.org/Can you add a dub.json and submit it to the dub registry?etcimon generated a dub.json file which I've merged into github. Thanks. However, I am unable to register the package because it requires a version number, which I don't know how to add. I've used git tag and edited dub.selections.json, but neither seems to be the answer. Can someone enlighten me? Paul
Jul 08 2014