home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / perl / 7622 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.5 KB  |  59 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!cti1!kmeek
  3. From: kmeek@cti.com (Kevin Meek)
  4. Subject: Perl messing up simple multiplication
  5. Message-ID: <1992Dec29.142231.4984@cti.com>
  6. Keywords: math perl 
  7. Organization: Comprehensive Technologies Int., Inc.
  8. Date: Tue, 29 Dec 1992 14:22:31 GMT
  9. Lines: 51
  10.  
  11. Hi:
  12.  
  13. I compiled perl on one of our At&T 3B2's and have copied that 
  14. same executable to about 20 other machines.  I've been running perl 
  15. scripts on these machines for about 2 years and never had any problems.
  16.  
  17. Yesterday I was setting up another machine and had a problem with 
  18. one of my scripts producing strange numbers.  I tracked the problem 
  19. down to something screwy with the math.  It was messing up simple 
  20. multiplication.
  21.  
  22. Below is a simple script that shows the problem:
  23.  
  24. $ cat test.prl
  25. eval "exec /usr/local/perl -S $0 $*"
  26.   if $running_under_some_shell;
  27.  
  28.   $| = 1;
  29.   print "\nEnter number of blocks: ";
  30.   $blocks = <>;
  31.   $mbytes = $blocks * 512 / 1000000;
  32.   print "Megabytes = $mbytes\n";
  33.  
  34. $ test.prl
  35.  
  36. Enter number of blocks: 34378
  37. Megabytes = 1.7580310727061837e-314
  38.  
  39.  
  40. This number should be 17.6015 or some such which is what I get on
  41. all my other machines.
  42.  
  43. Am I missing something basic or is there something different about the
  44. size of an integer or something.
  45.  
  46. As far as I can tell there is nothing different about this machine
  47. than the others that run the script beautifully.
  48.  
  49. I guess I could build perl on this machine and it might fix it
  50.  
  51. Any Idea what could be causing these strange results?
  52.  
  53. Thanks
  54.  
  55. Kevin
  56. -- 
  57. Kevin Meek 
  58. kmeek@cti.com
  59.