G
gsarup
Hi,
I am encountering an unusual problem. I have a perl script that adds
the sum of all 6 digit integers in a file. The problem is that ever so
often the sum exceeds the maximum allowable limit for integer size.
When that happens the program appends a '-'ve sign to the sum and
starts to subtract the numbers rather than add them.
The problem is compounded becauce I am also using 'sprintf' to ensure
that the number contains 15 characters in the output. When I remove the
sprintf command, the programs works correctly.
My question is this:
1) Does perl have an equivalent of 'long' in Java for integers?
2) Why does sprintf affect the sum of the result? It does not happen
all the time.
I would appreciate any help on this.
Thanks
Gaurav
I am encountering an unusual problem. I have a perl script that adds
the sum of all 6 digit integers in a file. The problem is that ever so
often the sum exceeds the maximum allowable limit for integer size.
When that happens the program appends a '-'ve sign to the sum and
starts to subtract the numbers rather than add them.
The problem is compounded becauce I am also using 'sprintf' to ensure
that the number contains 15 characters in the output. When I remove the
sprintf command, the programs works correctly.
My question is this:
1) Does perl have an equivalent of 'long' in Java for integers?
2) Why does sprintf affect the sum of the result? It does not happen
all the time.
I would appreciate any help on this.
Thanks
Gaurav