www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Decimal Arithmetic

reply Paul D. Anderson <paul.d.removethis.anderson comcast.andthis.net> writes:
I've got a D programming language implementation of the General Decimal
Arithmetic specification (http://speleotrove.com/decimal/) that's' more or less
complete* and am wondering if it would be useful. I worked on this over a year
ago but life got in the way, so I neglected it for a time. I now have the time
to finish it.

It uses std.bigint as the basis for the decimal numbers. I know there are plans
to bring BigFloat, decimal32, decimal64, and decimal128 numbers into D. The
completed* portion of the code fills the role of BigFloat (although I called it
Decimal), and I've got routines that encode/decode the dec32, etc. numbers but
they're not as far along as the arbitrary precision version.

I guess my question is whether I'm repeating work that's been done or is being
done in this area? If so, maybe I can lend a hand. If not, I'd like some
feedback on what is needed so I can work on the important things first.

Let me know what you think. At this point I'd settle for a go/nogo decision. We
can work bikeshed stuff later.

Thanks,

Paul

*"more or less complete" == It passes all the tests built in to the spec. No
logical operators or exp/ln/power. Still needs work. I suppose it could be
called an alpha version.
May 23 2011
next sibling parent reply Don <nospam nospam.com> writes:
Paul D. Anderson wrote:
 I've got a D programming language implementation of the General Decimal
Arithmetic specification (http://speleotrove.com/decimal/) that's' more or less
complete* and am wondering if it would be useful. I worked on this over a year
ago but life got in the way, so I neglected it for a time. I now have the time
to finish it.
 
 It uses std.bigint as the basis for the decimal numbers. I know there are
plans to bring BigFloat, decimal32, decimal64, and decimal128 numbers into D.
The completed* portion of the code fills the role of BigFloat (although I
called it Decimal), and I've got routines that encode/decode the dec32, etc.
numbers but they're not as far along as the arbitrary precision version.
 
 I guess my question is whether I'm repeating work that's been done or is being
done in this area? If so, maybe I can lend a hand. If not, I'd like some
feedback on what is needed so I can work on the important things first.
 
 Let me know what you think. At this point I'd settle for a go/nogo decision.
We can work bikeshed stuff later.
Go! We definitely want to get this into Phobos.
 
 Thanks,
 
 Paul
 
 *"more or less complete" == It passes all the tests built in to the spec. No
logical operators or exp/ln/power. Still needs work. I suppose it could be
called an alpha version.
May 24 2011
parent reply filgood <filgood somewhere.net> writes:
On 24/05/2011 08:34, Don wrote:
 Paul D. Anderson wrote:
 I've got a D programming language implementation of the General
 Decimal Arithmetic specification (http://speleotrove.com/decimal/)
 that's' more or less complete* and am wondering if it would be useful.
 I worked on this over a year ago but life got in the way, so I
 neglected it for a time. I now have the time to finish it.

 It uses std.bigint as the basis for the decimal numbers. I know there
 are plans to bring BigFloat, decimal32, decimal64, and decimal128
 numbers into D. The completed* portion of the code fills the role of
 BigFloat (although I called it Decimal), and I've got routines that
 encode/decode the dec32, etc. numbers but they're not as far along as
 the arbitrary precision version.

 I guess my question is whether I'm repeating work that's been done or
 is being done in this area? If so, maybe I can lend a hand. If not,
 I'd like some feedback on what is needed so I can work on the
 important things first.

 Let me know what you think. At this point I'd settle for a go/nogo
 decision. We can work bikeshed stuff later.
Go! We definitely want to get this into Phobos.
 Thanks,

 Paul

 *"more or less complete" == It passes all the tests built in to the
 spec. No logical operators or exp/ln/power. Still needs work. I
 suppose it could be called an alpha version.
Go
May 24 2011
parent reply Jesse Phillips <jessekphillips+D gmail.com> writes:
filgood Wrote:

 On 24/05/2011 08:34, Don wrote:
 Go! We definitely want to get this into Phobos.
Go
D, Definitely.
May 24 2011
parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Dial D for D Decimal Arithmetic.
May 24 2011
prev sibling parent Paul D. Anderson <paul.d.removethis.anderson comcast.andthis.net> writes:
Paul D. Anderson Wrote:

 Let me know what you think. At this point I'd settle for a go/nogo decision.
We can work bikeshed stuff later.
 
 Thanks,
 
 Paul
 
All right. Seems pretty clear it can be useful. Give me a couple of days to tidy up the code and I'll post it. Thanks.
May 24 2011