aboutsummaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorNicolas Schodet2024-03-09 19:35:48 +0100
committerNicolas Schodet2024-03-27 21:25:05 +0100
commit109e9777bb91360fee67d20263886d14cb97b23a (patch)
tree76b05285e7fe5d497fe297a7a0992d28bed41b18 /README
parent3cbab8ace2adcd3cf7df5f000c03dd8e8c4032e8 (diff)
Fix float to integer conversion
When converting a float to an integer, if the integer is not able to represent the value, the behavior is implementation defined. The original firmware source code depends on this implementation defined behavior from the C compiler. The LEGO MINDSTORMS NXT Executable File Specification does not define what is the expected behavior for the firmware because it was released for version 1.03, before float was supported. However it says: "At the scalar level, data type conversions behave identically to type casts in ANSI C.". For NXT Improved Firmware, I decided to follow the behavior of the original firmware binary, which is: - Negative values to unsigned numbers: large positive integer (two's complement). - Round to nearest for SETOUT instruction, truncate for other operations.
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions