It says that it is “implemented mostly in XS,” but I have not taken the time to see whether it uses microprocessor decimal-mathI don't think it does, but it certainly does decimal (as opposed to binary) arithmetic - and should be more than adequate for most people wanting to perform base 10 arithmetic.
OTOH, my Math::Decimal64 and Math::Decimal128 modules do make use of the _Decimal64 and _Decimal128 types, and associated operations:
C:\>perl -MMath::Decimal64 -le "$x=Math::Decimal64->new(0); $x += Math
+::Decimal64->new('20.1') for (1..43);print $x;"
8643e-1
The user interface is a little awkward, mainly because gcc does not provide strtod64 or strtod128 functions, and does not provide any (s)printf formatters for the _Decimal64 and _Decimal128 type.
I'm working on improving that interface - and the
current git version provides for output in floating point format instead of just scientific notation (ie as 864.3 instead of 8643e-1 for the quoted example).
I must also add overloading of strings - so that the above one liner can be rewritten as:
perl -MMath::Decimal64 -le "$x=Math::Decimal64->new(0); $x += '20.1' f
+or (1..43);print $x;"
But I don't want to add overloading of NVs as that would defeat the purpose.
(That takes care of this month's quota of self-promotion ;-)
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.