home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!cti1!kmeek
- From: kmeek@cti.com (Kevin Meek)
- Subject: Perl messing up simple multiplication
- Message-ID: <1992Dec29.142231.4984@cti.com>
- Keywords: math perl
- Organization: Comprehensive Technologies Int., Inc.
- Date: Tue, 29 Dec 1992 14:22:31 GMT
- Lines: 51
-
- Hi:
-
- I compiled perl on one of our At&T 3B2's and have copied that
- same executable to about 20 other machines. I've been running perl
- scripts on these machines for about 2 years and never had any problems.
-
- Yesterday I was setting up another machine and had a problem with
- one of my scripts producing strange numbers. I tracked the problem
- down to something screwy with the math. It was messing up simple
- multiplication.
-
- Below is a simple script that shows the problem:
-
- $ cat test.prl
- eval "exec /usr/local/perl -S $0 $*"
- if $running_under_some_shell;
-
- $| = 1;
- print "\nEnter number of blocks: ";
- $blocks = <>;
- $mbytes = $blocks * 512 / 1000000;
- print "Megabytes = $mbytes\n";
-
- $ test.prl
-
- Enter number of blocks: 34378
- Megabytes = 1.7580310727061837e-314
-
-
- This number should be 17.6015 or some such which is what I get on
- all my other machines.
-
- Am I missing something basic or is there something different about the
- size of an integer or something.
-
- As far as I can tell there is nothing different about this machine
- than the others that run the script beautifully.
-
- I guess I could build perl on this machine and it might fix it
-
- Any Idea what could be causing these strange results?
-
- Thanks
-
- Kevin
- --
- Kevin Meek
- kmeek@cti.com
-