www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is there any implementation of a 128bit integer?

reply Saurabh Das <saurabh.das gmail.com> writes:
The cent and ucent types are reserved for the future. Is there 
any knowledge/timeline on when they might be implemented?

Currently, is there a useable 128bit integer type in DMD/LDC/GDC?

Or perhaps a library that implements 128bit integers? I've come 
across gfm:integers 
(https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/
ntegers/wideint.d). Are there any other libraries?

Thanks,
Saurabh
Aug 19 2019
parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Monday, August 19, 2019 11:38:01 AM MDT Saurabh Das via Digitalmars-d-
learn wrote:
 The cent and ucent types are reserved for the future. Is there
 any knowledge/timeline on when they might be implemented?

 Currently, is there a useable 128bit integer type in DMD/LDC/GDC?

 Or perhaps a library that implements 128bit integers? I've come
 across gfm:integers
 (https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/w
 ideint.d). Are there any other libraries?
The language has cent and ucent reserved for the use of 128-bit signed and unsigned integers, but they aren't actually implemented yet, and I don't know what it would take for Walter to decide that it makes sense to implement them (maybe 128-bit x86 CPUs?). So, the language was designed with the idea that they could be added, but there are not currently any plans to add them AFAIK. Phobos has std.bigint, which supports arbitrarily large integers, but there is no standard 128-bit integer solution at present. There may be such a solution on code.dlang.org, but I'm not aware of one. - Jonathan M Davis
Aug 19 2019