gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -infinity and REPRESENT


From: mhx
Subject: Re: -infinity and REPRESENT
Date: Tue, 05 May 2020 01:03:31 +0200
User-agent: Roundcube Webmail/1.2.4

On 2020-05-04 17:24, Anton Ertl wrote:
I just re-implemented REPRESENT.

One issue is how to deal with -infinity (e.g., the result of -1e 0e f/).
Previously Gforth 0.7.2+glibc produced "-inf" and f1=0 (positive),
f2=0 (not valid); other libc implementations might lead to different
results.

gforth 0.7.9_20200423 uses an ecvt_r supplied by us and produces
"-inf" and f1=-1 (negative), f2=0 (not valid); the new REPRESENT
currently works in the same way (except that it gives you "-infinity",
space permitting).

In both systems F. and FS. outputs -in.

iForth behaves like gforth 0.7.2.

VFX produces "Inf" and f1=-1, f2=0.

The VFX behaviour looks like the most sensible one to me, but it might
affect code that uses REPRESENT; we can change our own code
accordingly, but what about your code?  Do you have code that uses
REPRESENT and that has been designed for a specific behaviour when
getting -infinity?

( Bernd clarified f1 and f2. )

VFX produces "Inf" and f1=-1, f2=0.

I think I will fix iForth (in due time) to give "-INF", f1=-1 f2=-1.
It does not make sense to me to claim f2=0 when the item has a sign and
gives valid output for many operations.

I have used REPRESENT exactly once in a program, in 1997.
However, it is used in a lib that I use almost daily to print scaled
strings (  1k  1.23u 7.12G  etc. ). I have never seen it return
+/-INF there.

-marcel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]