Mailing List Archive: 49091 messages

# integer! which range?

### [1/6] from: yogi:helimail at: 13-Nov-2001 18:29

Hello, I've tested something in the REBOL/Core-Console. But, I don't understand that. Look: In the console, I type the following: testzahl: 1 while [true] [testzahl: testzahl * 10] An Error occured: ** Math Error: Math or number overflow After that, I type "print testzahl" REBOL shows the following: 1000000000 This looks very small. So, if I type in the console simply 999999999999999999999999 , it works! So, why is there such a difference? What is the biggest integer!? cu, yogi

### [2/6] from: lmecir:mbox:vol:cz at: 13-Nov-2001 20:02

Hi yogi, type? 999999999999999999999999 ; == decimal! << (...)What is the biggest integer!? cu, yogi>> == 2147483647 Cheers Ladislav

### [3/6] from: nitsch-lists:netcologne at: 13-Nov-2001 20:31

RE: [REBOL] integer! which range? Hi Yogi,
>> a: to-integer 2 ** 31 - 1
== 2147483647
>> a: to-integer 2 ** 31 - 1 + 1
** Math Error: Math or number overflow
>> type? 999999999999999999999999
== decimal! so if you enter a to large number, it is converted to decimal! . if you multiply two integer!, you are limited. make one 'to-decimal or use 10.0 . -volker [yogi--helimail--de] wrote:

### [4/6] from: sterling:rebol at: 13-Nov-2001 12:24

The trick here is that these are differnt REBOL datatypes.
>> type? 1
== integer!
>> type? 99999999999999
== decimal! As far as largest integer goes:
>> 2147483647
== 2147483647
>> 2147483647 + 1
** Math Error: Math or number overflow ** Near: 2147483647 + 1 There it is. But:
>> 2147483647.0 + 1
== 2147483648 but this is decimal! type, not an integer!. Sterling

### [5/6] from: yogi:helimail at: 13-Nov-2001 22:48

> Hi yogi, > > type? 999999999999999999999999 ; == decimal! > > << (...)What is the biggest integer!? > cu, yogi>> > > == 2147483647 >
Ah, thanks. cu, yogi

### [6/6] from: ammonjohnson::yahoo::com at: 13-Nov-2001 16:27

You wanted to know the range of integer! ??? Straight from Core.pdf: "Integers span a range from -2147483648 to 2147483647." Enjoy!! Ammon