Why does D not have generics?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sat Jan 16 08:41:18 UTC 2021
On Friday, 15 January 2021 at 18:11:04 UTC, Bruce Carneal wrote:
> value types of the same size. This shows up when implementing
> radix sort where one solution is to map to/from whole numbers
> (NaN semantics being ignored).
If we accept the following encoding for floating point then it
should work out ok?
INPUT OUTPUT
s exp sig s exp sig
1 1100 1111110 0 0011 0000001
1 0011 0000001 0 1100 1111110
1 0000 0000000 0 1111 1111111
0 0000 0000000 1 0000 1111111
0 0011 0000011 1 0011 0000001
0 1100 1111110 1 1100 1111110
Algorithm:
1. flip the signbit
2. if the flipped sign is 0 then negate the exponent and
signficand/mantissa.
And it can be reversed just as easily?
Not too bad!?
More information about the Digitalmars-d
mailing list