HP Forums

Full Version: MC: Why different? Why not a bug?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The screen shot below was taken in Home view. Notice that the last two results are different. This might SEEM like a bug, but it's not.

Mini-challenge: explain (a) why they are different, and (b) why this is NOT a bug.

[Image: notabug.png]

Hint #1: The same results are obtained regardless of the currently active app.

Hint #2: No, the results were not obtained on different sides of midnight. Big Grin The whole thing was done during the same Date.
(04-15-2018 08:59 PM)Joe Horn Wrote: [ -> ]The screen shot below was taken in Home view. Notice that the last two results are different. This might SEEM like a bug, but it's not.

Mini-challenge: explain (a) why they are different, and (b) why this is NOT a bug.

ifactor is a CAS function and its arguments are evaluated in CAS mode. Because CAS mode does not use BCD, the result of Date*10000 is internally represented as 20180414.999999880791 and ifactor(IP(Date*10000)) is evaluated as ifactor(20180414)--which results in an unexpected result. If you first evaluate IP(Date*10000) in Home, the correct BCD result of 20180415 is assigned to Ans and evaluating ifactor(20180415) returns the correct result. This is not a bug. It is simply the difference in how numbers are stored in Home vs. CAS. An excellent example of something that should be considered when using CAS commands in Home.
Mark: Exactly correct, and clearly explained! Well done! Smile
Reference URL's