Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

[1313] Division of variables produces unexpected results

2 replies · 1,160 views · Started 02 October 2010

Performing division on a variable seems to produce incorrect results. Take the following output for example:


int non_arg = 120;
Trace(interval); // Interval provided as an argument; outputs 120.
Trace(interval / 2); // Expected 60; outputs -4.4245.
Trace(non_arg / 2); // Expected 60; outputs -4.4245.
Trace(120 / 2); // Outputs 60.

While performing division on literals works fine, performing the same operation on a variable produces a completely different (and wrong) result.

MarioBrosCom wrote:Performing division on a variable seems to produce incorrect results. Take the following output for example:

int non_arg = 120;
Trace(interval); // Interval provided as an argument; outputs 120.
Trace(interval / 2); // Expected 60; outputs -4.4245.
Trace(non_arg / 2); // Expected 60; outputs -4.4245.
Trace(120 / 2); // Outputs 60.

While performing division on literals works fine, performing the same operation on a variable produces a completely different (and wrong) result.

One of my scripts uses division and it started acting weird too on the newer builds.