mIRC Home    About    Download    Register    News    Help

Print Thread
#73749 05/03/04 12:44 AM
Joined: May 2003
Posts: 31
B
Bleepy Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: May 2003
Posts: 31
//echo -a $calc(100000000000000000000000000000000000000000000000000000000000 + 1)

returns

99999999999999997000000000000000000000000000000000000000000

...


@#HelpDesk - DALnet
#73750 05/03/04 01:14 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
wow hope i never need to add 1 to 100000000000000000000000000000000000000000000000000000000000


#73751 05/03/04 06:31 AM
Joined: Dec 2002
Posts: 1
A
Mostly harmless
Offline
Mostly harmless
A
Joined: Dec 2002
Posts: 1
well according to the post i tried the following:

//echo -a $calc(10000000000000000000000 + 0)
it returns 10000000000000000000000
which is perfectly fine.

but when i try to add another 0 behind
//echo -a $calc(100000000000000000000000 + 0)
it returns 99999999999999992000000

seems like the problems only affect with int numbers bigger than 24char

#73752 05/03/04 08:08 AM
Joined: Dec 2002
Posts: 18
L
Pikka bird
Offline
Pikka bird
L
Joined: Dec 2002
Posts: 18
so crazy, isn't it? smile

#73753 05/03/04 04:18 PM
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Yes, as with all programming/scripting languages, $calc() handles numbers up to a certain size, anything beyond that will result in overflow and the result is indeterminate.

#73754 13/03/04 10:53 AM
Joined: Jan 2004
Posts: 79
C
Babel fish
Offline
Babel fish
C
Joined: Jan 2004
Posts: 79
and it's surprising it can handle so big numbers blush


My ally is the compiler, and a powerful ally it is!

Link Copied to Clipboard