Decimal fraction to architectural fraction
02-25-2016, 12:06 PM (This post was last modified: 02-26-2016 01:30 PM by DrD.)
Post: #1
 DrD Senior Member Posts: 1,124 Joined: Feb 2014
Decimal fraction to architectural fraction
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-
 « Next Oldest | Next Newest »

 Messages In This Thread Decimal fraction to architectural fraction - DrD - 02-25-2016 12:06 PM RE: Decimal fraction to architectural fraction - Daniel - 02-25-2016, 10:04 PM RE: Decimal fraction to architectural fraction - Daniel - 02-25-2016, 10:17 PM RE: Decimal fraction to architectural fraction - DrD - 02-26-2016, 01:24 PM RE: Decimal fraction to architectural fraction - Daniel - 02-26-2016, 11:18 PM

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