When will you implement cent and ucent?

Era Scarecrow rtcvb32 at yahoo.com
Sat Mar 26 19:27:39 UTC 2022


On Saturday, 26 March 2022 at 18:12:08 UTC, H. S. Teoh wrote:
> On Sat, Mar 26, 2022 at 06:03:57PM +0000, Murilo wrote: [...]
>> I figured BitInt would be slower because it works with 
>> strings, working with pure binary would be faster, if there 
>> was a cent and ucent type I would be able to do the math 
>> faster.
>
> That is false.  BigInt works with arrays of ulongs, which is as 
> binary as you're gonna get.

  It's been a while since we have been doing BCD (*Binary Coded 
decimals*) which are base-10, which 8bit computers and 
calculators use to put 2 digits in 1 byte. No, it's far faster to 
use the built-in larger binary types, rather than lowering to 1 
number at a time.

  My library was on par with BigInt in speed, unless you utilized 
all instruction sets during compiling; Then BigInt is actually a 
bit faster making use of a few extra feature sets i haven't coded 
to take advantage of yet. Trying to compile the data to test and 
write is annoying.

  Doing math purely based on string/text certainly can be done and 
may be easy to do, but will be slow and best for examples of 
infinite precision and not used for real-time applications.


More information about the Digitalmars-d mailing list