Help! Perl fails op.int test

Gordon Burditt gordon at sneaky.UUCP
Fri Nov 25 16:12:33 AEST 1988


In article <1162 at devon.UUCP> paul at devon.UUCP (Paul Sutcliffe Jr.) writes:
>I've recently ported PERL to a Tandy 6000 (MC68000 CPU, Xenix/68k 3.0).
>Perl passes every test in the t/ directory *except* op.int, which tests
>the use of perl's int() function.  All four tests in op.int fail.  It
>appears that the crux of the problem is that "int(1.234)" does not
>return 1.000000 exactly.  The following will illustrate this:
>
>    $ perl -e "print int(1.234);"
>    1.0000002407468855
>    $
I get:
% perl -e 'printf "%50.40lf\n", int(1.234);'
        1.0000000000000000000000000000000000000000
but I'm using the 3.2 libc.a

>In short, what can I do to get perl's int() function to behave?
Fix modf().  See below.
>Or am I (quoting the man page) "at the mercy of [my] machine's
>definitions of various operations such as type casting, atof() and
>sprintf()."
You are.  But this bug has a fairly simple fix. (The 3.2 version already
has this in it).

# cd /tmp
# copy -m /lib/libc.a /lib/libc.old		(Just in case)
# ar xv /lib/libc.a modf.o
# adb -w modf.o
_modf+0x9e?x
_modf+158:	0x4241
		^^^^^^ If you get some other number, do not proceed.
_modf+0x9e?w 0x7200
_modf+158:	0x4241	=	0x7200
^D
# ar rv /lib/libc.a modf.o
Do not run ranlib on /lib/libc.a.  If you did, or you get complaints about
__.SYMDEF being out of date, you can undo the damage by running:

# ar dv /lib/libc.a __.SYMDEF

Convince yourself that the new version works, then remove /tmp/modf.o and
/lib/libc.old.

					Gordon L. Burditt
					...!texbell!sneaky!gordon

The preceeding information is provided by an individual, and it comes
with no guarantee, warranty, or support whatsoever, by any individual
or organization.



More information about the Comp.sources.bugs mailing list