🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1378

FST bug

#1378
From: Pat Terry
Date: Tue, 06 Nov 1990 05:14
31 lines
1340 bytes
There is a slight bug in the FST 2.0 RealConversions module.

It does not round negative values correctly.  Better code would be as follows

For the LONGREAL bit

    PROCEDURE putRealF( x :REAL; nd, n :INTEGER );
    VAR neg :BOOLEAN;
        d   :ARRAY [0..MaxMantDigs] OF CHAR;
        i   :INTEGER;
        decAt, int :INTEGER;
    BEGIN
        IF n < nd+2 THEN ok := FALSE; RETURN END;
        n := n - (nd+2);
*        IF x >= 0.0
*          THEN x := x + SHORT(5.0/TenTo(nd+1));       (* round *)
*          ELSE x := x - SHORT(5.0/TenTo(nd+1));       (* round *)
        END;

and for the REAL bit

*        IF x >= 0.0
*          THEN x := x + 5.0/TenTo(nd+1);       (* round *)
*          ELSE x := x - 5.0/TenTo(nd+1);       (* round *)
*        END;



--  
uucp: uunet!m2xenix!puddle!5!494!4.101!Pat.Terry
Internet: Pat.Terry@p101.f4.n494.z5.fidonet.org
Technical Details
Message-ID: <90.27366ED3@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p101.f4.n494.z5.fidonet.org!Pat.Terry

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p101.f4.n494.z5.fidonet.org!Pat.Terry
From: Pat.Terry@p101.f4.n494.z5.fidonet.org (Pat Terry)
Newsgroups: comp.lang.modula2
Subject: FST bug
Message-ID: <90.27366ED3@puddle.fidonet.org>
Date: 6 Nov 90 05:14:00 GMT
Sender: ufgate@puddle.fidonet.org (newsout1.26)
Organization: FidoNet node 5:494/4.101 - Settler City Fido, Grahamstown RSA
Lines: 31