Implementing C23 _Float16 in ImportC
Tim
tim.dlang at t-online.de
Tue Jan 14 16:19:26 UTC 2025
On Tuesday, 14 January 2025 at 07:43:42 UTC, Sergey wrote:
> On Tuesday, 14 January 2025 at 06:13:04 UTC, Walter Bright
> wrote:
>> _Float16 is new in C23 Appendix H.11-6
>>
>> https://github.com/dlang/dmd/issues/20516
>>
>> For the moment, I submitted a PR with a workaround:
>>
>> https://github.com/dlang/dmd/pull/20699
>>
>> Amazingly, some years ago I implemented 16 bit floats in D:
>>
>> https://github.com/DigitalMars/sargon/blob/master/src/sargon/halffloat.d
>>
>> Would anyone like to put halffloat.d into Druntime and make it
>> our implementation of _Float16?
>
> Amazing. Is it extendable to Float8?
Phobos also contains CustomFloat:
https://dlang.org/library/std/numeric/custom_float.html
This allows to have floats with a custom number of bits,
including 8 bits.
More information about the Digitalmars-d
mailing list