mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-15 22:32:19 +03:00
6cdf05f1ec
This adds new `Int8`, `Int16`, `Int32` and `Int64` data types to the compiler, thus working towards properly specified integer types as discussed in #1048. In addition, the following changes / corrections are made: * Support casts from `Char`, `String`, and `Double` to all integer types (and back). This fixes #1270. * Make sure that all casts to limited-precision integers are properly bounds checked (this was not the case so far for casts from `String` and `Double` to `Int`) * Add a thorough set of tests to make sure all bounds checks work correctly for all supported casts and arithmetic operations
32 lines
376 B
Plaintext
32 lines
376 B
Plaintext
Main> "Int"
|
|
Main> 12
|
|
Main> 12
|
|
Main> 12
|
|
Main> 12
|
|
Main> "Negative Int"
|
|
Main> -12
|
|
Main> -12
|
|
Main> -12
|
|
Main> -12
|
|
Main> "Integer"
|
|
Main> 12
|
|
Main> 12
|
|
Main> 12
|
|
Main> 12
|
|
Main> "Negative Integer"
|
|
Main> -12
|
|
Main> -12
|
|
Main> -12
|
|
Main> -12
|
|
Main> "Double"
|
|
Main> 12.0
|
|
Main> 12.3
|
|
Main> 12.5
|
|
Main> 12.7
|
|
Main> "Negative Double"
|
|
Main> -12.0
|
|
Main> -12.3
|
|
Main> -12.5
|
|
Main> -12.7
|
|
Main> Bye for now!
|