MantisBT - Core Inform View Issue Details ID Project Category View Status Date Submitted Last Update 0002075 Core Inform Equations, units, arithmetic public 2018-09-09 18:04 2018-09-10 20:48 Reporter mattweiner Assigned To Priority normal Severity serious Reproducibility always Status confirmed Resolution open Platform OS X OS El Capitan OS Version 10.11.6 Product Version 6M62 Target Version Fixed in Version Effect (serious/mild) Game compiles but misbehaves Submitter Summary 0002075: multiplying a multi-part unit by a real number yields absurd results 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. Minimal Source Text To Reproduce Lab is a room. Cash-value is a kind of value. \$1.99 specifies a cash-value. Holdings is a cash-value that varies. Holdings is \$3.50. When play begins: say "Number result: [2 times holdings]. Real number result: [2.0 times holdings]." 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. [^] Tags No tags attached. Relationships Attached Files Issue History Date Modified Username Field Change 2018-09-09 18:04 mattweiner New Issue 2018-09-10 20:48 zarf Note Added: 0004807 2018-09-10 20:48 zarf Status new => confirmed

Notes
 (0004807) zarf 2018-09-10 20:48
 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).