Closed curiousdannii-testing closed 2 years ago
557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:
Comment by zarf :
I think this is not related to 1935, after all. The generated code is
tmp_0 = (REAL_NUMBER_TY_Times(1073741824, NUMBER_TY_to_REAL_NUMBER_TY((Global_Vars-->10))));
That is, it's converting the scaled value (pennies) to a real number, correctly multiplying that by 2.0 (using real multiplication), but then treating the resulting value as a scaled value again. It's missing the step where it converts the real back to an integer (pennies again).
Reported by : mattweiner
Description :
When multiplying a multi-part unit, such as $1.99 specifying a cash-value, by a real number, such as 1.0, the result is some sort of integer overflow.
Steps to reproduce :
Additional information :
Output: Number result: $7.00. Real number result: $11439308.80.
Possibly related to http://inform7.com/mantis/view.php?id=1935.
Forum thread: https://www.intfiction.org/forum/viewtopic.php?f=7&t=26554&p=143414#p143414.
imported from: [Mantis 2075] multiplying a multi-part unit by a real number yields absurd results