[Dlang-internal] I need cent and ucent to be implemented soon
ryuukk_
ryuukk.dev at gmail.com
Sat Dec 25 00:35:12 UTC 2021
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?
I didn't know what ``cent`` was, then someone in the IRC
mentioned ``big int``
I think that is one of the baggage from C that it not worth
keeping for the long term
If were to add a new type, why not start fresh and put some
consistency, i propose doing what C++/Rust/Swift/Zig and other
language did, prefix with integer/unsigned following by the size
So we know exactly what type we are talking about, on top of its
size!
I personally think this is worth pursuing for the long term, some
consistency, with some identity!
We could start with just some basic aliases in ``object.d``, then
eventually make them officially supported so targets like
-betterC could have them, of maybe directly supporting them is
the play!
What do you guys think?
More information about the Dlang-internal
mailing list