Results 1 to 3 of 3
Hello users, my problem is this:
Code:
#!/usr/bin/env perl
use strict;
use warnings;
my $number1 = 50000000000000000000000;
my $number2 = 50000000000000000000001;
if ($number1 == $number2) {
print "Nummern sind identisch\n";
...
- 05-29-2008 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 28
[SOLVED] perl numeric variable "overflow" problem
Hello users, my problem is this:
and perl say: yes, this are the same numbers (above 19digits, btw. if perl switch to exponential).Code:#!/usr/bin/env perl use strict; use warnings; my $number1 = 50000000000000000000000; my $number2 = 50000000000000000000001; if ($number1 == $number2) { print "Nummern sind identisch\n"; } else { print "Nummern sind nicht identisch\n"; }

But this is not true. Is there any solution? The numbers couldn't be lesser!
Thanks for any idea/solution.
raphael
- 05-30-2008 #2
You have not an overflow problem, but a precision problem. Go here. I've never actually used this, but in Perl that's where you should go.
Hope this helps.--
Bill
Old age and treachery will overcome youth and skill.
- 05-30-2008 #3Just Joined!
- Join Date
- Aug 2007
- Posts
- 28
[solved]
Yes, this is exactly what I need.
Thank you!
Raphael


