454,252 Members | 1,346 Online Need help? Post your question and get tips & solutions from a community of 454,252 IT Pros & Developers. It's quick & easy.

# Long Integer

 P: 34 Hi All, I have the following code, Expand|Select|Wrap|Line Numbers \$min=12345678901234567890; \$max=12345678901234567899; print "max=\$max, min=\$min \n"; if (\$min < \$max) {     print "Output : ok \n"; } else {     print "Output : not ok \n"; }   Output: max=1.23456789012346e+19, min=1.23456789012346e+19 Output : not ok Why The output is in floating point. How can I solve this Issue. Apr 15 '08 #1
3 Replies

 Expert 100+ P: 971 What are you expecting the results to be? --Kevin Apr 15 '08 #2

 P: 34 Hi All, I have the following code, Expand|Select|Wrap|Line Numbers \$min=12345678901234567890; \$max=12345678901234567899; print "max=\$max, min=\$min \n"; if (\$min < \$max) {     print "Output : ok \n"; } else {     print "Output : not ok \n"; }   Output: max=1.23456789012346e+19, min=1.23456789012346e+19 Output : not ok Why The output is in floating point. How can I solve this Issue. Hi, when I try to compare the values I am getting the wrong results. The difference between \$max and \$min is "0" Regards Pnsree Apr 16 '08 #3

 Expert 100+ P: 971 You are only comparing to see if it is less than, do a check to see if is is equal, less than or greater than. Expand|Select|Wrap|Line Numbers my \$min = 12345678901234567890; my \$max = 12345678901234567899;      print "max=\$max, min=\$min \n";        if (\$min == \$max) {         print "Output : Equal \n";     } elsif (\$min < \$max) {         print "Output : Less Than \n";     } elsif (\$min > \$max) {         print "Output: Greater Than\n";     } else {         print "Output not equal, not less than not greater than\n";     } --Kevin Apr 16 '08 #4 