[Dlang-internal] I need cent and ucent to be implemented soon

Era Scarecrow rtcvb32 at yahoo.com
Sat Jan 22 13:39:32 UTC 2022


If i noticed this i'd have started replying sooner...

On Friday, 24 December 2021 at 23:52:44 UTC, Walter Bright wrote:
> On 5/3/2019 9:28 PM, Murilo wrote:
>> Hi guys, I am writing a program what will use very big 
>> numbers, when will you guys implement cent and ucent?
>
> If someone wants to pick up the flag for this, the way to do it 
> is:
>
>     struct Cent
>     {
> 	long lsl, msl;
>     }
>
> followed by a function for each operator:
>
>     Cent add(Cent op1, Cent op2) { ... }
>     ...
>
> The compiler can then access these as builtin functions to 
> implement cent in the compiler.
>
> Who wants to do it?

Actually i have an implementation i did back in 2017, probably 
needs more testing, but would allow ANY size (multiple of 32/64 
bit), works compile-time and real time, and division has it's own 
asm code to try and speed it up.

I need to double check to make sure it still works in today's D 
compilers, but otherwise it may be a quick and easy drop in.

https://github.com/rtcvb32/Side-Projects/tree/master/arbitraryint



More information about the Dlang-internal mailing list