🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3234

Re: Arithmetic problems with Quintus Prolog

#3234
From: Paul Eggert
Date: Tue, 12 Apr 1988 16:10
20 lines
1360 bytes
In article <869@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe)
writes:

	0.0 -vs- -0.0		-- mandated by IEEE ...
	1 \== 1.0		-- implicitly mandated by IEEE

The IEEE standard does not implicitly mandate that 1 \== 1.0.  Consider the
following rule, used by Silogic Prolog:

	If a number can be exactly represented in both floating point and
	integer formats, then use integer format.

With this rule 1 == 1.0, and 0 == 0.0, but 0 \== -0.0 because 0 and -0.0 are
not the same number.

This rule matches most people's intuition better than Quintus's conversion
rules.  It's not as fast as Quintus's arithmetic, but if you prize correct
answers over fast ones, you will insist on overflow checking anyway, and you
may find that a cheap test for the question "Is the number X exactly
representable in integer format?" folds naturally into overflow checking.
Technical Details
Message-ID: <pQ_:u[!@sea.sm.unisys.com>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!mailrus!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!sdcrdcf!sdcsmb!sea!eggert
References: <11111@shemp.CS.UCLA.EDU> <869@cresswell.quintus.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!mailrus!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!sdcrdcf!sdcsmb!sea!eggert
From: eggert@sea.sm.unisys.com (Paul Eggert)
Newsgroups: comp.lang.prolog
Subject: Re: Arithmetic problems with Quintus Prolog
Message-ID: <pQ_:u[!@sea.sm.unisys.com>
Date: 12 Apr 88 16:10:48 GMT
References: <11111@shemp.CS.UCLA.EDU> <869@cresswell.quintus.UUCP>
Reply-To: eggert@sea.sm.unisys.com (Paul Eggert)
Organization: Unisys Santa Monica
Lines: 20