Integer overflow: Difference between revisions

m
→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
Line 1,700:
 
=={{header|Phix}}==
{{libheader|Phix/basics}}
Phix has both 32 and 64 bit implementations. Integers are signed and limited to 31 (or 63) bits, ie
-1,073,741,824 to +1,073,741,823 (-#40000000 to #3FFFFFFF) on 32 bit, whereas on
Line 1,705 ⟶ 1,706:
Integer overflow is handled by automatic promotion to atom (an IEEE float, 64/80 bit for the 32/64 bit implementations respectively),
which triggers a run-time type check if stored in a variable declared as integer, eg:
<!--<lang Phix>integer i = 1000000000 + 1000000000</lang-->
<span style="color: #004080;">integer</span> <span style="color: #000000;">i</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1000000000</span> <span style="color: #0000FF;">+</span> <span style="color: #000000;">1000000000</span>
<!--</lang>-->
{{out}}
<pre>
7,833

edits