www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - BigDecimal D library (incomplete, very early stages) - BigDecimal.d

reply ajvincent gmail.com writes:
I've implemented comparisons, addition, subtraction, and multiplication.
Division and modulus operations I will work on probably later... today,
actually, given that it's now after midnight...

I've also made an effort in this code to be forward-thinking.  The design of the
code has two features not included in my JavaScript library.  (1) It will be
able to support use as a Mozilla XPCOM (and probably other forms of COM,
including MSCOM) component.  (2) Upgrading it from using long types in its digit
array to cent types is intended to be a one-line change.  So you'd be able to
more than double the number of digits (18 digits for long, 38 for cent) that the
library supports.

With debug and unittest enabled, it runs a rather brutal test suite.  The test
suite dynamically generates long values and uses them as checks against what the
library code outputs.  So far, it passes the test suite (though it fails a test
case with a NaN value passed to it, and I had to comment that out).

I would greatly appreciate feedback on this code.  Please bear in mind that this
is my *first* time writing D code, and I've been using this project mainly to
teach myself D.  So there are going to be some rough areas!  Based on what I
picked up from the D spec, I tried to include comments on what I think these
areas are.
Oct 03 2004
parent reply ajvincent gmail.com writes:
Sorry, I guess that attachment got mangled, as I couldn't read it, even after
clicking on the message's provided link.

http://weblogs.mozillazine.org/weirdal/archives/006620.html
http://weblogs.mozillazine.org/weirdal/archives/BigDecimal.d
Oct 03 2004
next sibling parent J C Calvarese <jcc7 cox.net> writes:
ajvincent gmail.com wrote:
 Sorry, I guess that attachment got mangled, as I couldn't read it, even after
 clicking on the message's provided link.

Actually, it's not so much garbled as encoded. I could view the attachment in a newsreader (Thunderbird). For whatever reason, some attachments can't be downloaded from the web interface. Here's some more information about the web interface vs. newsreader advantages/disadvantages in the comments section at http://www.prowiki.org/wiki4d/wiki.cgi?NewsDmD
 http://weblogs.mozillazine.org/weirdal/archives/006620.html
 http://weblogs.mozillazine.org/weirdal/archives/BigDecimal.d

On the other hand, these links should work great for everyone. Thanks. -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Oct 03 2004
prev sibling parent reply John Reimer <brk_6502 NOSP_AM.yahoo.com> writes:
ajvincent gmail.com wrote:
 Sorry, I guess that attachment got mangled, as I couldn't read it, even after
 clicking on the message's provided link.
 
 http://weblogs.mozillazine.org/weirdal/archives/006620.html
 http://weblogs.mozillazine.org/weirdal/archives/BigDecimal.d
 
 

Is there something wrong with the attachment? I was able to download it fine into my newsreader (Thunderbird on win XP). No mangling issues visible at all.
Oct 03 2004
parent ajvincent gmail.com writes:
Is there something wrong with the attachment?  I was able to download it 
  fine into my newsreader (Thunderbird on win XP).  No mangling issues 
visible at all.

I think it's a bug through the web-based access to this newsgroup. Although you just gave me a good reason to use Thunderbird. (And for the record, I'm a big Mozilla supporter, at least emotionally. It's the primary application I tinker with, and tonight I'm planning on blogging about a "little" bug in it...) Alex Vincent http://weblogs.mozillazine.org/weirdal
Oct 04 2004