Changes

Jump to: navigation, search

Locomotive BASIC

99 bytes added, 09:13, 26 November 2013
/* Type Conversions */
== Type Conversions ==
The BASIC functions <code>ROUND</code>, <code>INT</code> and <code>FIX</code> can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - <code>ROUND</code> rounds to nearest, <code>FIX</code> rounds to zero, whereas <code>INT</code> always rounds down. e.g., <code>value%=INT(3.14)</code>. Note that if you don't specify the % you will actually get a real number still.
To convert an integer to a real number, you can use the <code>UNT</code> keywordfunction which will take the value supplied and return the two's complement number. e.g., <code>real=UNT(&ABCD)</code>.
<pre>
-15536
Ready
</pre>
17
edits