Cent/UCent as library types

Jonathan M Davis jmdavisProg at gmx.com
Mon Dec 31 11:09:15 PST 2012


On Monday, December 31, 2012 19:56:11 monarch_dodra wrote:
> I'm asking this as a end user:
> 
> It was my understanding that cent/ucent where more or less
> abandoned as native types.

Abandonded? They were specifically reserved for being used for 128-bit signed 
and unsigned types at an indeterminate point in the future. Nothing was 
abandonded, but nothing has been needed either, so it hasn't been implemented.

> But would it be possible to have Cent/UCent as library types?
> 
> We have Complex, and Walter recently proposed the HalfFloat type.
> 
> Why not Cent and UCent?
> 
> Is it too complex for library code? I'd suspect you need to catch
> overflow flags for efficient carry over, but D has built-in asm,
> so that shouldn't be too complicated... Should it?
> 
> Or do we already have some sort of generic (statically sized) big
> inter, eg:
> Big!128 or UBig!128? Or if not, would we want that?
> 
> Should I open an ER for either of the two ideas?

I'd argue for sticking to BigInt if you want big numbers rather than adding 
the complication of adding a Cent and UCent library type. To get them right, 
you need a fair bit of what BigInt has anyway. What gain is there in having 
Cent or UCent over just using BigInt? I could see benefit in 128 bit built-in 
types, but I don't see what the point is of library types for them, not when 
we already have BigInt.

- Jonathan M Davis


More information about the Digitalmars-d mailing list