Truncating to Integer & Fraction--HP-35A/21A Message #1 Posted by Matt Agajanian on 29 Mar 2012, 11:01 a.m.
Hello all. Fantastic job on the D.MS<-->D.DDD conversion routines. I tried developing some algorithms last night. In comparison, yours were quite streamlined.
Another pair of techniques I've been considering: How do I extract the fractional and integer parts of values. I tried using logs, adding/subtracting 1/2 to round the decimal portion out, etc. and a memory location with some arithmetic manipulation but my methods are pretty cumbersome.
Just as well, I've also been trying to create routines to truncate to n decimal places. My ideas were to add some power of 10 to the number and then subtract it down to the original number with the desired decimal. But, the internal rounding of the 35 would round my values up if the n+1th digit was >=5. Any thoughts?
Edited: 29 Mar 2012, 7:12 p.m. after one or more responses were posted
|