Path: utzoo!mnetor!uunet!lll-winken!lll-tis!mordor!sri-spam!ames!ll-xn!oberon!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: <#a?GP4|0@sea.sm.unisys.com> Date: 14 Apr 88 21:56:49 GMT References: <873@cresswell.quintus.UUCP> Organization: Unisys Santa Monica Lines: 20 In article <873@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) argues that a Prolog implementation cannot obey the IEEE floating point standard while following the proposed rule "If a number can be exactly represented in both floating point and integer formats, then use integer format." His argument has one crucial flaw that invalidates its conclusion. O'Keefe writes: (5) For any integer N for which all expressions are defined, if ZI is N-N, NF is float(N), ZF is NF-NF then ZF is distinguishable from -ZF by IEEE rules, but ZI is not distinguishable from -ZI. Not so. Under the proposed rule, "N is -0" unifies N with -0.0, not with 0, so ZI can be distinguished from -ZI. I don't argue that the proposed rule should be part of a Prolog standard, because it would slow many Prologs down. But I maintain that the rule is consistent, that the rule conforms to the IEEE standard, and that it is more intuitive for "1 = 1.0" to succeed than to fail.