December 25, 2021
On Saturday, 25 December 2021 at 04:17:11 UTC, Walter Bright wrote:
> On 12/24/2021 4:35 PM, ryuukk_ wrote:
>> I didn't know what ``cent`` was, then someone in the IRC mentioned ``big int``
>
> `cent` is a 128 bit int. Cent for "100".
>
>> I think that is one of the baggage from C that it not worth keeping for the long term
>
> It doesn't come from C.

And it seems they are even parting away from it, C23 proposals has u8 _Decimal32/64/128!


>> 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
>
> The size postfix is fine for the first week learning the language, then it becomes annoying:
>
> 1. visual noise
> 2. takes many words to speak it
> 3. touch-typing doesn't work well with it
> 4. takes longer to type it

1. i strongly disagree, it is easier to write, easier to modify, and doesn't involve mental gymnastic to remember the size
2. i don't think that's a valid argument
3. it does, i32 / s32, you know what to change if you want unsigned/signed, or increase the size!, something you can't with short / int / long, you have to scrap the entire thing
4. i disagree s32 is even with int, u32 has 1 less character than uint, u64 has 2 less characters than ulong, so no, it doesn't takes longer to type!


December 25, 2021
On 12/25/2021 8:03 AM, ryuukk_ wrote:
> 4. i disagree s32 is even with int, u32 has 1 less character than uint, u64 has 2 less characters than ulong, so no, it doesn't takes longer to type!

Time yourself. It takes much longer to type numbers than text. (It's not about the number of characters.)

Unless you never learned to touch-type, of course. If you haven't, you've lost a lot of your life a second at a time!

December 26, 2021
On Saturday, 25 December 2021 at 23:07:52 UTC, Walter Bright wrote:
> On 12/25/2021 8:03 AM, ryuukk_ wrote:
>> 4. i disagree s32 is even with int, u32 has 1 less character than uint, u64 has 2 less characters than ulong, so no, it doesn't takes longer to type!
>
> Time yourself. It takes much longer to type numbers than text. (It's not about the number of characters.)
>
> Unless you never learned to touch-type, of course. If you haven't, you've lost a lot of your life a second at a time!

well, the solution is aliases!
January 22, 2022
If i noticed this i'd have started replying sooner...

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?

Actually i have an implementation i did back in 2017, probably needs more testing, but would allow ANY size (multiple of 32/64 bit), works compile-time and real time, and division has it's own asm code to try and speed it up.

I need to double check to make sure it still works in today's D compilers, but otherwise it may be a quick and easy drop in.

https://github.com/rtcvb32/Side-Projects/tree/master/arbitraryint

1 2 3
Next ›   Last »