Jump to page: 1 28  
Page
Thread overview
March 25

I have been waiting for years now, can't you guys just add these 2 types to the language?

March 25

What would you do with it? There's a number of alternatives available today depending what you need.

March 26

On Friday, 25 March 2022 at 23:33:45 UTC, Murilo wrote:

>

I have been waiting for years now, can't you guys just add these 2 types to the language?

Walter has plans to deprecate cent/ucent in favor of a library implementation. See the “128 bit integers” section in the summary of our last meeting here:

https://forum.dlang.org/post/qrtjqubrbuqeiffunili@forum.dlang.org

March 26

On Friday, 25 March 2022 at 23:33:45 UTC, Murilo wrote:

>

I have been waiting for years now, can't you guys just add these 2 types to the language?

I have a library i wrote a few years ago you can use. Compiled it recently and had no issues. It may need more testing. Should handle any multiple of 64bits, even odd ones. though doing 128/256 and others should be just fine.

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

used as import std.experimental/arbitraryint;

Though i'm not sure if i need to update it for licenses, it has been a while afterall... For now avoid using it in commercial products.

March 26

On Friday, 25 March 2022 at 23:50:39 UTC, Adam Ruppe wrote:

>

What would you do with it? There's a number of alternatives available today depending what you need.

I would perform calculation with astronomical numbers and atomic precision.

March 26

On Saturday, 26 March 2022 at 04:02:18 UTC, Murilo wrote:

>

I would perform calculation with astronomical numbers and atomic precision.

If you aren't sure what size of numbers you need, BigInt/BigNum would be better.

If you need fractions, might be more interested in using GMP, as it will give you floating precision you want.

https://gmplib.org/

float/double/real (32/64/80) allow a very large range of rough values within ranges and are built in with the FPU.

If you want a fixed int-type, then int/long/cent or others would be practical.

So question, what doesn't BigInt do that you need cent/ucent for?

March 26

On Friday, 25 March 2022 at 23:50:39 UTC, Adam Ruppe wrote:

>

What would you do with it? There's a number of alternatives available today depending what you need.

Is there any implementation similar to the C# decimal type?

March 26

On Friday, 25 March 2022 at 23:33:45 UTC, Murilo wrote:

>

I have been waiting for years now, can't you guys just add these 2 types to the language?

The code is a bit old, but it works flawlessly and has useful aliases:

https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d

March 26

On Saturday, 26 March 2022 at 11:37:28 UTC, Salih Dincer wrote:

>

On Friday, 25 March 2022 at 23:33:45 UTC, Murilo wrote:

>

I have been waiting for years now, can't you guys just add these 2 types to the language?

The code is a bit old, but it works flawlessly and has useful aliases:

https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d

I think it just need to be in a dub package one can find.

March 26

On Saturday, 26 March 2022 at 11:37:28 UTC, Salih Dincer wrote:

>

The code is a bit old, but it works flawlessly and has useful aliases:

https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d

Flawless maybe, but definitely slow when you get to division. It can only double the size of integers.

If memory serves me right, it uses shift and subtraction for division, but it also uses 2 lower types so if you do say a 256bit type, it creates and uses 2 128 bit types, which uses 2 64 bit types to do the job.

« First   ‹ Prev
1 2 3 4 5 6 7 8