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


Groups > comp.lang.forth > #135016

Re: GNU Forth has a floating point floor word, but not floating point ceiling word?

From Krishna Myneni <krishna.myneni@ccreweb.org>
Newsgroups comp.lang.forth
Subject Re: GNU Forth has a floating point floor word, but not floating point ceiling word?
Date 2026-04-29 08:30 -0500
Organization A noiseless patient Spider
Message-ID <10st150$3uddf$1@dont-email.me> (permalink)
References (1 earlier) <69eac411$1@news.ausics.net> <10sooig$2o6bk$1@dont-email.me> <20260428134002.000057e7@tin.it> <10srj60$3htnj$1@dont-email.me> <69f15ce7$1@news.ausics.net>

Show all headers | View raw


On 4/28/26 8:20 PM, dxf wrote:
> On 29/04/2026 10:25 am, Krishna Myneni wrote:
>> On 4/28/26 6:40 AM, peter wrote:
>>> On Mon, 27 Apr 2026 17:39:11 -0500
>>> Krishna Myneni <krishna.myneni@ccreweb.org> wrote:
>>>
>> ...
>>>>
>>>> \ Testing F= for positive and negative special values
>>>> t{ +INF -INF F= -> false }t
>>>> t{ +NAN -NAN F= -> true }t
>>>> t{ F=ZERO F=-ZERO F= -> true }t
>>>
>>> How is your F= defined?
>>> I see that it returns true for comparing two nans.
>>> Shouldn't that return false in IEEE fp math?
>>>
>>> BR
>>> Peter
>> I was just looking for my IEEE 754 documentation, but I think you are correct that +NAN should not equal itself or -NAN, since the equality comparison is not valid for NANs.
>>
>> I am using the x87 FCOMP instruction, which I expected to have IEEE-compatible behavior. Will need to look closer at this.
> 
> I used FCOMP and got the expected results.
> 
> \ fsp points to separate f/p stack in memory
> label tst
>    addr fsp ) di mov
>    qword 1 floats [di] fld  qword 0 [di] fld  fcompp
>    ax fstsw  st(0) fstp  2 floats # addr fsp ) add
>    41 # ah and  bx bx sub  cl ah cmp  1 $ jnz  bx dec
> 1 $:  bx push  next
> end-code
> 
> code F< ( r1 r2 -- flag )  00 # cl mov  tst ju  end-code
> code F> ( r1 r2 -- flag )  01 # cl mov  tst ju  end-code
> code F= ( r1 r2 -- flag )  40 # cl mov  tst ju  end-code
> 
> +NAN +NAN F= . 0  ok
> +NAN -NAN F= . 0  ok
>                                                                                                 
> 

Thank you. There is likely a mistake in handling the flags from FCOMP 
for this case.

--
Krishna

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


Thread

GNU Forth has a floating point floor word, but not floating point ceiling word? Buzz McCool <buzz_mccool@yahoo.com> - 2026-04-23 16:11 -0700
  Re: GNU Forth has a floating point floor word, but not floating point ceiling word? dxf <dxforth@gmail.com> - 2026-04-24 11:14 +1000
    Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Buzz McCool <buzz_mccool@yahoo.com> - 2026-04-24 08:29 -0700
    Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-27 17:39 -0500
      Re: GNU Forth has a floating point floor word, but not floating point ceiling word? peter <peter.noreply@tin.it> - 2026-04-28 13:40 +0200
        Re: GNU Forth has a floating point floor word, but not floating point ceiling word? minforth <minforth@gmx.net> - 2026-04-28 14:01 +0200
        Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-28 19:25 -0500
          Re: GNU Forth has a floating point floor word, but not floating point ceiling word? dxf <dxforth@gmail.com> - 2026-04-29 11:20 +1000
            Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-29 08:30 -0500
              Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-29 20:15 -0500
                Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-02 15:56 -0500
          Re: GNU Forth has a floating point floor word, but not floating point ceiling word? dxf <dxforth@gmail.com> - 2026-04-29 11:47 +1000
      Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-30 04:40 -0500
        Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-30 05:37 -0500
          Re: GNU Forth has a floating point floor word, but not floating point ceiling word? peter <peter.noreply@tin.it> - 2026-04-30 15:55 +0200
            Re: GNU Forth has a floating point floor word, but not floating point ceiling word? Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-30 20:49 -0500
              Special memory access words (was: GNU Forth has a ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-01 06:16 +0000
                Re: Special memory access words (was: GNU Forth has a ...) peter <peter.noreply@tin.it> - 2026-05-01 10:22 +0200
                Re: Special memory access words (was: GNU Forth has a ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-01 08:57 +0000
                Re: Special memory access words Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-01 10:19 -0500
                Re: Special memory access words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-01 15:35 +0000
                Re: Special memory access words Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-01 13:28 -0500
                Re: Special memory access words Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-01 13:30 -0500
                Re: Special memory access words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-02 05:54 +0000
                Re: Special memory access words Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-05-02 15:49 -0500
                Re: Special memory access words Hans Bezemer <the.beez.speaks@gmail.com> - 2026-05-01 13:28 +0200
              Re: GNU Forth has a floating point floor word, but not floating point ceiling word? peter <peter.noreply@tin.it> - 2026-05-01 10:18 +0200

csiph-web