MC: Why different? Why not a bug? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: MC: Why different? Why not a bug? (/thread-10515.html) |
MC: Why different? Why not a bug? - Joe Horn - 04-15-2018 08:59 PM 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. 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. The whole thing was done during the same Date. RE: MC: Why different? Why not a bug? - Mark Hardman - 04-16-2018 02:51 AM (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. 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. RE: MC: Why different? Why not a bug? - Joe Horn - 04-16-2018 03:33 AM Mark: Exactly correct, and clearly explained! Well done! |