On 10/20/26 12:41 PM, marcel hendrix wrote:
> On 10/20/2026 7:26 PM, marcel hendrix wrote:
>> On 10/20/2026 6:15 PM, Krishna Myneni wrote:
>>> On 10/20/26 8:47 AM, Krishna Myneni wrote:
>>> ...
>>>>
>>>> ...
>>>> The output shows that (DDFS.) as presently implemented in dd_io.4th fails for one of the test cases (test 2), and probably for many more cases.
>>>> ...
>>>
>>> Typing the string outputs from (FS.) and (DDFS.) shows that (DDFS.) is not rounding properly.
>> Simply setting the low part of a double double to 0 might be a bit too simplistic? Is the difference in the range of 1e-15 .. 1e-17 ?
>>
>
> FORTH> 53-bits! S" 9.9999993504564039e-39" >DD fswap +E. 2 spaces +E. 9.9999993504564044884e-0039 -2.4574614153997716484e-0056 ok
> FORTH> 53-bits! S" 0.30000000000000003e0" >DD fswap +E. 2 spaces +E. 3.0000000000000005126e-0001 -1.4408920985006246408e-0017 ok
> FORTH> 53-bits! S" -1.0000000133514319e-10" >DD fswap +E. 2 spaces +E. -1.0000000133514319362e-0010 6.0018089739605790726e-0027 ok
> FORTH> 53-bits! S" -9007199254740991.5e0" >DD fswap +E. 2 spaces +E. -9.0071992547409920000e+0015 5.0000000000000000000e-0001 ok
>
> The second number is critical, on the fourth one may be lucky because the low word is exactly 0.5?
>
Below is a comparison of the output from (fs.) with a precision of 32 digits, from Bailey's ddfun package, and the implementation of (ddfs.) used here. The output from (fs.) uses just the first double. A space has been inserted between the printed significand and the exponent in each case to make comparing the last digits easier.
--
KM
=== begin output comparisons ===
20 Oct 2026
Comparison of (ddfs.) output vs dp2_to_dd output
to 32 digits
dp2_to_dd conversion is based on Bailey's Fortran 90 ddfun library
(ddfs.) output is from kForth-64/32/Win32 dd_io.4th
( 1 ) 0.30000000000000003d0,0.0e0
(fs.) 3.0000000000000004440892098500626 e-01
dp2_to_dd 3.0000000000000004440892098500626 e-1
(ddfs.) 3.0000000000000004440892098500619 dd-1
( 2 ) 9.9999993504564039d-39,0.0d0
(fs.) 9.9999993504564039245746141539977 e-39
dp2_to_dd 9.9999993504564039245746141539976 e-39
(ddfs.) 9.9999993504564039245746141539972 dd-39
( 3 ) -1.0000000133514319d-10,0.0d0
(fs.) -1.0000000133514319600180897396058 e-10
dp2_to_dd -1.0000000133514319600180897396057 e-10
(ddfs.) -1.0000000133514319600180897396057 dd-10
( 4 )
(fs.) -9.0071992547409920000000000000000 e+15
dp2_to_dd -9.0071992547409920000000000000000 e15
(ddfs.) -9.0071992547409920000000000000000 dd15
=== end output comparisons ===