On Thursday, 3 July 2014 at 21:55:42 UTC, Paul D Anderson wrote:

A candidate implementation of decimal numbers(arbitrary-precisionfloating-point numbers) is available for review athttps://github.com/andersonpd/eris/tree/master/eris/decimal.This is asubstantial rework of an earlier implementation which waslocated athttps://github.com/andersonpd/decimal.This is a D language implementation of the General DecimalArithmeticSpecification(http://www.speleotrove.com/decimal/decarith.pdf), which iscompliant with IEEE-754 and other standards as noted in thespecification.The current implementation is not complete; there are a lot ofTODOs and NOTEsscattered throughout the code, but all the arithmetic andmiscellaneousoperations listed in the spec are working, along with decimalversions of mostof the functions and constants in std.math. I think it is farenough along foreffective review. Briefly, this software adds the capability of properly roundedarbitrary-precision floating-point arithmetic to the Dlanguage. All arithmeticoperations are governed by a "context", which specifies theprecision (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 arithmeticops(add(BigDecimal, BigDecimal), etc.), in D the same arithmeticoperators thatwork for floats or doubles work for decimal numbers. (Ofcourse!)In this implementation decimal numbers having differentcontexts are differenttypes. The types are specified using template parameters forthe precision,maximum exponent value and rounding mode. This means that Decimal!(9,99,Rounding.HALF_EVEN) is a different type thanDecimal!(19,199,Rounding.HALF_DOWN). They are largelyinteroperable, 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 ofmemory, with 7, 16 and 34 digit precision, respectively. Theseare used forcompact storage; they are converted to their correspondingdecimal numbers forcalculation. They bear the same relation to decimal numbers asWalter'shalf-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 beadded to githubvery shortly. Major TODO items:1) The current underlying integer type uses my own big integerstruct(eris.integer.extended) rather than std.bigint. This was mainlydue to problemswith constness and CTFE of BigInts. These problems have sincebeen resolved, butI didn't want to switch over to BigInts until everything wasworking for fear ofintroducing new bugs.2) Integration of Decimal32, Decimal64 and Decimal128 structsare not complete.(See above.)3) Conversion to and from floats, doubles and reals iscurrently working but itis slow. (Conversion is through strings: double to string todecimal and viceversa.)4) Still incomplete implementations of some functions indecimal.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