2015-05-29 07:32:23 UTC
arises of the type of the square root of such numbers.
If lcc-win uses the highest precision available in hardware (what was
doing till last week) it uses then an 80 bit floatiung point number.
The square roots will lose precision!
A customer complained about that last week. I have developed then an
exact INTEGER square root that gives all 128 bit precision.
OK, but now the type of the result is a 128 bit integer, not a floating
Is this correct?
Since C99 and tgmath.h we can decide to what function the expression
expands to, according to the type of the argument. It is possible then
to expand the square root of an integer of 128 bits into a 128 integer
data type without any change to anything in C99.
lcc-win features a software 128 bit floating point. But even those
numbers would not have enough precision to keep the 128 bit precision of
a 128 bit integer. I would have to use the very extended qfloat format
that has 512 bits precision, to be able to match the 128 bit integer
precision. But that format is obviously very slow, by more than two
orders of magnitude!
I am doing now a sqrt(int128) in about 35 ns using several hardware
tricks. Using qfloat would mean multiplying that by around 1000.
If I do this for sqrt (keeping all precision) I should also modify some
other functions like log, for instance or maybe many others, I haven't
really investigated that part...
What should I do?
Note that since 128 bit integers are not in really widespread use, it
would be nice if the committee decided this quickly since there is now
no need to care about existing code...
Later it will be, well... too late