Scientific RPN Calculator (with ATTINY85)

03092018, 10:15 AM
Post: #29




RE: Scientific RPN Calculator (with ATTINY85)
(03092018 09:22 AM)deetee Wrote: For the h/hms converting I developed these formulae (did not check "edge cases"): This will do weird things converting to h.ms The fix is to decompose the number after conversion and check boundary conditions. For seconds, this would be: Code: if ((int)(x * 10000) % 100 == 60) x += 0.004; Likewise for minutes. You also need to be careful of the sign by converting to the absolute value before making any checks and putting the sign back afterwards. Even then, I'm not sure binary arithmetic can even do this because none of the fractions can be represented exactly. Pauli 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)