Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 21, 2016 Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types? Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos? Thanks, Saurabh |
May 21, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saurabh Das | On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote:
> I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types?
>
> Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos?
>
> Thanks,
> Saurabh
There is BigInt in phobos.
|
May 21, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saurabh Das | On Saturday, May 21, 2016 09:43:38 Saurabh Das via Digitalmars-d-learn wrote: > I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types? The keywords are reserved for future use not in current use. So, no, there are no 128-bit integer types in D currently. It's just that we left the door open for ourselves to add them later without breaking programs due to having to create a new keyword. > Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos? We've had that for years. It's BigInt in std.bigint. - Jonathan M Davis |
May 22, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Saturday, 21 May 2016 at 21:51:34 UTC, Jonathan M Davis wrote:
> On Saturday, May 21, 2016 09:43:38 Saurabh Das via Digitalmars-d-learn wrote:
>> I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types?
>
> The keywords are reserved for future use not in current use. So, no, there are no 128-bit integer types in D currently. It's just that we left the door open for ourselves to add them later without breaking programs due to having to create a new keyword.
>
>> Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos?
>
> We've had that for years. It's BigInt in std.bigint.
>
> - Jonathan M Davis
Thankyou. I'll have a look at that.
Saurabh
|
May 22, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Saturday, 21 May 2016 at 09:56:51 UTC, Stefan Koch wrote:
> On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote:
>> I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types?
>>
>> Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos?
>>
>> Thanks,
>> Saurabh
>
> There is BigInt in phobos.
I think cent and ucent could be implemented as ulong is possible to be used on 32-bit systems by adding extra assembly instructions. This way, when (and if) 128-bit systems are developed, compiler would be updated only.
|
May 22, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saurabh Das | On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote:
> I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types?
>
> Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos?
>
> Thanks,
> Saurabh
There is a recursive arbitrary sized integer implementation floating around somewhere. Perhaps try dub for some math libraries.
|
May 22, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | On Sunday, 22 May 2016 at 07:40:08 UTC, Nicholas Wilson wrote: > On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote: >> I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types? >> >> Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos? >> >> Thanks, >> Saurabh > > There is a recursive arbitrary sized integer implementation floating around somewhere. Perhaps try dub for some math libraries. https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d |
May 22, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Sunday, 22 May 2016 at 09:07:32 UTC, Guillaume Piolat wrote:
> On Sunday, 22 May 2016 at 07:40:08 UTC, Nicholas Wilson wrote:
>> On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote:
>>> I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types?
>>>
>>> Alternatively, is there an any effort towards implementation of arbitrary-sized integers in Phobos?
>>>
>>> Thanks,
>>> Saurabh
>>
>> There is a recursive arbitrary sized integer implementation floating around somewhere. Perhaps try dub for some math libraries.
>
> https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d
wideint was exactly what I was looking for! Thank you so much :)
Saurabh
|
May 22, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saurabh Das | On Sunday, 22 May 2016 at 09:39:45 UTC, Saurabh Das wrote:
> On Sunday, 22 May 2016 at 09:07:32 UTC, Guillaume Piolat wrote:
>> https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d
>
> wideint was exactly what I was looking for! Thank you so much :)
I WANT! If this does the job, I want it as part of the Phobos library!!
|
May 22, 2016 Re: Is there a 128-bit integer in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Era Scarecrow | On Sunday, 22 May 2016 at 09:47:54 UTC, Era Scarecrow wrote:
> On Sunday, 22 May 2016 at 09:39:45 UTC, Saurabh Das wrote:
>> On Sunday, 22 May 2016 at 09:07:32 UTC, Guillaume Piolat wrote:
>>> https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d
>>
>> wideint was exactly what I was looking for! Thank you so much :)
>
> I WANT! If this does the job, I want it as part of the Phobos library!!
This request again ;)
I don't know how this works, someone has to propose it, clean it up and respond to feedback I guess.
|
Copyright © 1999-2021 by the D Language Foundation