473,468 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Long Integer

34 New Member
Hi All,
I have the following code,
Expand|Select|Wrap|Line Numbers
  1. $min=12345678901234567890;
  2. $max=12345678901234567899;
  3. print "max=$max, min=$min \n";
  4. if ($min < $max)
  5. {
  6.     print "Output : ok \n";
  7. }
  8. else
  9. {
  10.     print "Output : not ok \n";
  11. }
  12.  
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 2753
eWish
971 Recognized Expert Contributor
What are you expecting the results to be?

--Kevin
Apr 15 '08 #2
pnsreee
34 New Member
Hi All,
I have the following code,
Expand|Select|Wrap|Line Numbers
  1. $min=12345678901234567890;
  2. $max=12345678901234567899;
  3. print "max=$max, min=$min \n";
  4. if ($min < $max)
  5. {
  6.     print "Output : ok \n";
  7. }
  8. else
  9. {
  10.     print "Output : not ok \n";
  11. }
  12.  
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
eWish
971 Recognized Expert Contributor
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
  1. my $min = 12345678901234567890;
  2. my $max = 12345678901234567899;
  3.  
  4.    print "max=$max, min=$min \n";
  5.        if ($min == $max) {
  6.         print "Output : Equal \n";
  7.     } elsif ($min < $max) {
  8.         print "Output : Less Than \n";
  9.     } elsif ($min > $max) {
  10.         print "Output: Greater Than\n";
  11.     } else {
  12.         print "Output not equal, not less than not greater than\n";
  13.     }
--Kevin
Apr 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

45
by: Trevor Best | last post by:
I did a test once using a looping variable, first dimmed as Integer, then as Long. I found the Integer was quicker at looping. I knew this to be true back in the 16 bit days where the CPU's (80286)...
12
by: Peter Ammon | last post by:
When I add an unsigned long long and an int, what type do each of the values get promoted to before the addition is performed? What is the type of the resulting expression? What occurs if the...
3
by: Mike Miller | last post by:
What is the best way to convert a managed unsigned int64 to an unsigned long? Basically I need to do the following: System::UInt64 managedInt = 10; unsigned long unmanagedInt; unmanagedInt =...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
9
by: luke | last post by:
Hi everybody, please, can someone explain me this behaviour. I have the following piece of code: long long ll; unsigned int i = 2; ll = -1 * i; printf("%lld\n", ll);
2
by: fniles | last post by:
In VB6, we use Integer and Long. In VB.NET does Integer becomes Int32 and Long becomes Integer ? Thanks.
73
by: Yevgen Muntyan | last post by:
Hey, I was reading C99 Rationale, and it has the following two QUIET CHANGE paragraphs: 6.5.3.4: "With the introduction of the long long and extended integer types, the sizeof operator may...
24
by: Paulo Matos | last post by:
Hello, Is it safe to assume a size_t is an unsigned long? (is it forced by the standard?) Thank you, Paulo Matos
4
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the...
11
by: Steven Woody | last post by:
long i = nnn; long j; double d; d = i; j = ( long )d; in this case, i == j ? thanks.
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.