HP Forums
(42S) Convert Decimal to Tape Measure Fractions - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (42S) Convert Decimal to Tape Measure Fractions (/thread-6864.html)



(42S) Convert Decimal to Tape Measure Fractions - Logan - 09-16-2016 02:28 PM

Video demonstration here:
https://www.youtube.com/watch?v=JfFE8taPRQI

Program code and raw file (for Free42) can be found here:
https://goo.gl/03Tj59

The program takes a decimal input (which the user can produce using the help of the interface) and then converts it to the precision specified by the user.

I won't say its perfect, and perhaps it duplicates some other program out there (I couldn't find it if there is one) and I welcome any feedback as this is one of my first programming attempts.


RE: (42s) Convert Decimal to Tape Measure Fractions - Dieter - 09-16-2016 06:12 PM

(09-16-2016 02:28 PM)Logan Wrote:  I won't say its perfect, and perhaps it duplicates some other program out there (I couldn't find it if there is one) and I welcome any feedback as this is one of my first programming attempts.

Using the menu 42s system sure is a nice feature. As far as the conversion itself is concerned: this has been discussed here before, the last time in January in this thread for the 41-series. Maybe the underlying algorithm can be useful.

Dieter


RE: (42s) Convert Decimal to Tape Measure Fractions - Logan - 09-16-2016 06:42 PM

Thank you! Those definitely give me some ideas and defaulting to a 16th as the precision seems good enough for most purposes and that will trim things down a bit.

I was trying to avoid changing the display mode, though that would have simplified things I know.


RE: (42s) Convert Decimal to Tape Measure Fractions - Dieter - 09-16-2016 07:03 PM

(09-16-2016 06:42 PM)Logan Wrote:  Thank you! Those definitely give me some ideas and defaulting to a 16th as the precision seems good enough for most purposes and that will trim things down a bit.

The linked program allows the user to set the precision he prefers. 1/8 is just as fine as 1/64. If possible (and set by the user) the program reduces the resulting fraction to the one with the least denominator.

(09-16-2016 06:42 PM)Logan Wrote:  I was trying to avoid changing the display mode, though that would have simplified things I know.

On the 41 (C/CV) there is no AIP command that appends the integer portion to Alpha. So ARCL has to be used and the display mode is set to FIX 4 without radix mark (flag 29). On the 42s you can of course use AIP (and a few stack exchange commands as AIP only works with X).

Maybe you have also seen the discussion on using RCL d/STO d on the 41. This synthetic 41 command saves all flag settings (not only those for the display) resp. restores them later.

Dieter