# HP Forums

Full Version: Decimal fraction to architectural fraction
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
No expert here, but there must have been hundreds of times when I have wanted a quick conversion from a decimal fraction to an architectural fraction (quarters, eighths, sixteenths, etc.). There are probably much better ways to do this, but here is a handy approach (I hope) returns the nearest architectural fraction (greater than or equal to) the provided decimal number. I solicit improvements! (Better filename, better method, etc.).

A built-in command for something like this sure would be nice.

Code:
``` //                  A2(N,A) //                 02/24/2016   //  Decimal fraction to Architectural fraction >= provided decimal number. //    INPUT:    A2(Decimal number, desired architectural denominator) //    Example:  A2(3.53553390593,16) ==>  "3 9/16" EXPORT f2a(N,A) BEGIN   return STRING(IP(N)) + " " + STRING(CEILING(ROUND(FP(N)*A,5))) + "/" + STRING(A); END;```

-Dale-
Hello DrD'
For My 2cents.

Arch to Dec.

EXPORT Arch_Dec(ft,in,fn,fd)
BEGIN
LOCAL A,B;
// 02-25-2016 by DGT
// Entering feet,inches,frac numerator,frac denominator
A:=ft+(((in+(fn/fd)))/12)+"_ft"
END;

or Dec to Arch

EXPORT Dec_Arch(dft,dd)
BEGIN
LOCAL A,B,C,D,E,F,G;
// 02-25-2016 by DGT
// Entering decimal feet,desired denominator
B:=IP(dft);
C:=FP(dft);
D:=C*12;
E:=IP(D);
F:=FP(D);
G:=F*dd;
A:=B+"'-"+E+"."+G+"/"+dd+""
END;
Hello DrD'
For My 2cents.

Arch to Dec.

EXPORT Arch_Dec(ft,in,fn,fd)
BEGIN
LOCAL A,B;
// 02-25-2016 by DGT
// Entering feet,inches,frac numerator,frac denominator
A:=ft+(((in+(fn/fd)))/12)+"_ft"
END;

or Dec to Arch

EXPORT Dec_Arch(dft,dd)
BEGIN
LOCAL A,B,C,D,E,F,G;
// 02-25-2016 by DGT
// Entering decimal feet,desired denominator
B:=IP(dft);
C:=FP(dft);
D:=C*12;
E:=IP(D);
F:=FP(D);
G:=F*dd;
A:=B+"'-"+E+"."+G+"/"+dd+""
END;
Thanks for that. I just happened to be making a deck gazebo, which uses cedar fence boards for privacy louvers. I was using Sketchup to design the project, and Sketchup can quickly put an array of louvers just where needed, but gathering real world dimensions, then tweaking the design accordingly, led me to make the program I posted.

A solution, and a handy way to access it on the physical calc, would be terrific. The filename I previously used isn't very quick to use on the calc. It works fine on the emulator, great when I am near the PC, but not so great, outside, on the project! I changed it in the original post to A2, which is easier to key in. I didn't want to reassign a key for this, as it isn't something I will use frequently enough to merit it.

This was the specific purpose this time, but I've often needed to convert decimal to architectural fractions.

-Dale-
I use 3 different calculators for different reasons. My 35s for use in the field which does Arch to Dec real nifty. Then My Prime in the office for most everything else. Then my 50g mainly for an extensive verticle curve program which i wrote several years ago but just too lazy to rewrite on the prime. Sometimes I have all three calcs out on my desk and my co workers walk by and shake their heads. The more I can consolidate into the Prime the better.
Thanks for prompting me with the conversions program.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :