Re: Floating point printing bug(s)

Gary Byers <[email protected]> Mon, 22 Jul 2002 23:35:03 -0600 (MDT)
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
The bug seems to be in (of all places) a LAP function used to compare
bignums. A patch is enclosed; changing a "cmpw" (signed compare) to
"cmplw" (unsigned compare) seems to fix the single-float printer.

Sorry it took so long to respond; a lot of messages were stuck in a
mail queue until a few minutes ago.


On Wed, 10 Jul 2002, John Carroll wrote:

> I'm printing out lots of floats and occasionally get incorrect or very
> strange looking numbers in the output, e.g.
>
> ? (coerce 1.4470288761911116D-4 'single-float)
> 1.0E-4
> ? (format t "~,6G" *)
> >.470290E-5
> NIL
>
> I think the problem is with the printer because the single float appears
> to behave normally wrt arithmetic operations:
>
> ? (coerce 1.4470288761911116D-4 'single-float)
> 1.0E-4
> ? (* * 2)
> 2.8940578E-4
>
> Another strange printout:
>
> ? (format t "~,10G" 1.3648871727442815D-4)
> 0.=648871727D-4
> NIL
>
> And two more (I've only seen = > and : inserted in the numbers output):
>
> ? (coerce 9.979289D-6 'single-float)
> 9.979289E-6
> ? (format t "~,6G" *)
> :.000000E-6
> NIL
>
> ? (coerce 1.3648871727442815D-4 'single-float)
> 1.0E-4
> ? (format t "~,6G" *)
> =.648870E-5
> NIL
>
> This is with OpenMCL Version (Beta: Darwin) 0.12.1
>
> John Carroll
>
> --
> Cognitive and Computing Sciences,   E-Mail: [email protected]
> University of Sussex,               Tel: (+44 / 0)1273 678029
> Falmer, Brighton BN1 9QH, UK        Fax: (+44 / 0)1273 671320
>
> _______________________________________________
> bug-openmcl mailing list
> [email protected]
> http://clozure.com/cgi-bin/mailman/listinfo/bug-openmcl
>
>
compare-digits.diff (text/plain, 550 B)
Index: level-0/PPC/ppc-bignum.lisp
===================================================================
RCS file: /usr/local/publiccvs/ccl/level-0/PPC/ppc-bignum.lisp,v
retrieving revision 1.7
diff -u -r1.7 ppc-bignum.lisp
--- level-0/PPC/ppc-bignum.lisp	16 Jun 2002 13:20:13 -0000	1.7
+++ level-0/PPC/ppc-bignum.lisp	23 Jul 2002 05:32:24 -0000
@@ -645,7 +645,7 @@
   (la imm0 arch::misc-data-offset idx)
   (lwzx imm1 a imm0)
   (lwzx imm0 b imm0)
-  (cmpw imm1 imm0)
+  (cmplw imm1 imm0)
   (li arg_z '0)
   (beqlr)
   (li arg_z '1)