On 10/20/2026 4:55 AM, Paul Rubin wrote:
> Nice, what is the memory representation?
They look like an array of 4 extended doubles, and in fact, they are.
The trick is that *sum* of these four normal 64 bit floats is precisely
equal to a single float with a 4*64 = 256 bit mantissa. This is done by manipulating the exponents. See "Software for Doubled-Precision Floating-Point Computations", Seppo Linnainmaa, ACM Transactions on Mathematical Software, Vol 7, No 3, September 1981, Pages 272-283.
>> The xd-fp library, with a full set of math functions, is only 800
>> lines of Forth including comments.
> That's pretty good, I thought carefully done math functions could be
> messy.
The float library is based on David H. Bailey's paper and is very concise. I used only the paper, but there are special issues with specifying constants and literals that I originally ignored, see a few other threads here. Looking at the (bulky) C, source helped a little:
https://github.com/greggroth/im_learning_cpp/blob/master/comp_programing_exam_solution/qd-2.3.12/src
-marcel