When will you implement cent and ucent?

Walter Bright newshound2 at digitalmars.com
Fri Apr 1 07:22:21 UTC 2022


On 3/31/2022 10:33 PM, Petar Kirov [ZombineDev] wrote:
> For the past 2.5 years, I've worked on applications that use 256-bit integers 
> for most of the computation (because the inputs are 256-bit numbers typically 
> used to represent fixed point decimals with 18 digits) for computation and it 
> would have been nice to to have uint256/int256 built-in types, instead of having 
> to use a library BigInt type.

A library 128 bit type would be pretty easy to do, now that the computation 
functions are worked out. 256 bits could leverage that.

But frankly, with all the jawboning around it could have already been 
implemented. Just take:

   https://github.com/dlang/phobos/blob/master/std/complex.d

and de-template it, and delete most of it, and you've got struct Int128 and 
struct Uint128. The hard part:

   https://github.com/dlang/druntime/blob/master/src/core/int128.d

is already done.

Whoever does it first gets the glory :-)


More information about the Digitalmars-d mailing list