Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #135069

Re: IEEE floating point comparisons

From minforth <minforth@gmx.net>
Newsgroups comp.lang.forth
Subject Re: IEEE floating point comparisons
Date 2026-05-04 21:53 +0200
Message-ID <n5sboiFm58sU1@mid.individual.net> (permalink)
References <10t9259$3c72d$1@dont-email.me> <20260504094359.00003976@tin.it> <10ta3eo$3l84s$1@dont-email.me>

Show all headers | View raw


Am 04.05.2026 um 14:29 schrieb Krishna Myneni:
> On 5/4/26 02:43, peter wrote:
>> On Sun, 3 May 2026 22:00:56 -0500
>> Krishna Myneni <krishna.myneni@ccreweb.org> wrote:
>>
>>> Below is preliminary test code for floating point comparisons for
>>> systems with expected IEEE 754 behavior.
>>>
>>> Relevant floating point exceptions should be masked.
>>>
>>> Please let me know if you find any errors in the tests.
>>>
>>> The tests pass on recent kForth-32/64 development versions (v2.8.0 and
>>> v0.8.0, respectively):
>>> TESTING F=
>>> TESTING F<>
>>> TESTING F<
>>> TESTING F>
>>> TESTING F<=
>>> TESTING F>=
>>> TESTING F0=
>>> TESTING F0<
>>> TESTING F0>
>>>
>>> The auxiliary code, ieee-754.4th, which defines special values is also
>>> attached below.
>>>
>>> -- 
>>> Krishna Myneni
>>>
>>> 2 attachments:
>>>
>>> ieee-comparisons-test.4th
>>> ieee-754.4th
>>>
>>> \ ===== begin ieee-comparisons-test.4th =====
>>> \ ieee-comparisons-test.4th
>>> \
>>> \ Comparison of IEEE 754 special values
>>> \ Floating point exceptions should be masked.
>>> \
>>> \ include ans-words.4th (needed for kForth only)
>>> include ttester.4th
>>> include ieee-754.4th
>>>
>>
>> Tested it on lxf64. No errors reported!
>>
>> I needed to define +NAN and +INF, I had them as NAN and INF.
>> But I print them out as +INF etc! It makes more sense with the +
>>
>> I did not include the ieee-754.4th as that did not add anything.
>>
>> on lxf there is a problem with f<> and NANs. I need to correct f<>
>> ...
> 
> Good to hear.
> 
> I included ieee-754.4th for Forth systems which did not have +/-INF and 
> +/-NAN defined. It also provides the extremely useful words FINFINITE? 
> and FNAN? to check for infinities and NANs resulting from calculations, 
> as well as FSUBNORMAL? when the results are represented with less 
> precision than standard double precision. These words are all part of 
> David Williams' IEEE proposal.
> 
> The rationale for the signed NAN is unclear to me, but I think David had 
> a good reason to include it in his IEEE proposal. It may be useful in 
> some numerical computation cases. I will look into this further.
> 
The sign is merely an artefact of the preceding calculation and has no
inherent significance. Even in applications that use NaN-boxing, the
possible range of values does not include the bit position of the sign.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

IEEE floating point comparisons Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-03 22:00 -0500
  Re: IEEE floating point comparisons Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-03 22:18 -0500
  Re: IEEE floating point comparisons peter <peter.noreply@tin.it> - 2026-05-04 09:43 +0200
    Re: IEEE floating point comparisons Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-04 07:29 -0500
      Re: IEEE floating point comparisons minforth <minforth@gmx.net> - 2026-05-04 21:53 +0200
        Re: IEEE floating point comparisons Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-04 17:20 -0500
        Re: IEEE floating point comparisons dxf <dxforth@gmail.com> - 2026-05-05 11:32 +1000
  Re: IEEE floating point comparisons Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-06 08:23 -0500

csiph-web