Talk:Differences from Previous Scripting

From the CreationKit Wiki
Jump to navigation Jump to search

Auto-casting from Int to Float[edit source]

Just a note: technically, since both int and float are 32-bit numbers, and at least some of the float's memory is dedicated to the exponent, int as float will not always work. This means the statement that "the compiler can automatically cast for you with no chance of error" with respect to "Int -> Float" is not strictly true.

The likelihood of this coming up in a mod is rather slim, however. Presumably the float follows the IEEE standard and has a 23-bit mantissa; thus you would need an integer that uses 24 or more bits (i.e. >= 16,777,216 or <= -16,777,216) to cause errors.
Dragoon Wraith TALK 12:05, 22 January 2012 (EST)