HP Forums
CAS.lcm with decimals - 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: CAS.lcm with decimals (/thread-10958.html)



CAS.lcm with decimals - proostas - 06-23-2018 09:49 AM

Hello everyone,

I've stumbled upon a strange behaviour of CAS.lcm function in both Home and CAS.

lcm(2.5,2) yields 5 while lcm(5/2,4/2) correctly yields 10.

Got last firmware installed: 2018 02 12 (13441)

Is it a bug or I somehow misconfigured my HP Prime?


RE: CAS.lcm with decimals - parisse - 06-23-2018 03:31 PM

lcm returns the product of its arguments if one of them is an approx number. 2.5 is not the same as 5/2, it represents any real in a small interval around 2.5.
One should not use floats in exact arithmetic CAS instructions.


RE: CAS.lcm with decimals - proostas - 06-23-2018 05:32 PM

Yep. My bad. I see CAS.lcm expects only integers, polynomials, and rationals. I should have learned how to use online help before posting it. Got spoiled by my Classpad II.