When will you implement cent and ucent?
deadalnix
deadalnix at gmail.com
Fri Apr 1 12:06:01 UTC 2022
On Friday, 1 April 2022 at 05:33:06 UTC, Petar Kirov [ZombineDev]
wrote:
> On Friday, 1 April 2022 at 02:41:58 UTC, Walter Bright wrote:
>> On 3/31/2022 3:35 PM, max haughton wrote:
>>> It's still quite ugly compared to just implementing cent
>>> properly e.g. lack of VRP and implicit conversions make the
>>> library approach a bit meh.
>>
>> There are very few uses for a 128 bit type, so all the
>> conveniences are not particularly necessary.
>
> 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.
I have done that.
While it is not possible to get good codegen with the current
provided types, it is possible with a 128bit type. You can then
do your operation using a 128 bits accumulator and compiler are
smart enough to figure out what to do most of the time.
This is why a 128 bit type is absolutely key, it unlocks the
ability to write larger integer types in a way that will allow
the compiler to generate good code for it.
More information about the Digitalmars-d
mailing list