Post Reply 
Need to convert FIF49 to Prime version
06-24-2018, 03:38 PM (This post was last modified: 06-24-2018 04:03 PM by DrD.)
Post: #18
RE: Need to convert FIF49 to Prime version
Thats cool!
You might like to keep the units and fraction format:

Code:

// Enter list of feet, inches, fractional inches AND architectural precision!
EXPORT FIF(m,a)
BEGIN
  LOCAL res := {0,0,0};
  LOCAL in;
  in := ΣLIST(m * {12,1,1});
  res(1) := IP(in/12);
  res(2) := IP(in MOD 12);
  res(3) := ROUND(FP(in)*a,0)/a;  //  Adjust for architectural units 
  RETURN exact(res * {1_(ft),1_(inch),1_(inch)}); // Return with units and fractions
END;

Shortened version:

Code:

//                                 From BruceH on MoHPC
//                         modified for architectural fraction
//
//                                     FIF(m,a)
//                                    6/24/2018
//                                       drd
//
// INPUTS:  Use 3 element list to represent feet, inches and fractions of inches.
//
// A 15' 9-1/2" wall is to have three 14-5/8" windows installed equally spaced. What is the horizontal space between the windows? 
// To solve the problem you multiply the window width times three, subtract the total window width from the wall length, then
// divide the space remaining by four.
//
// The full windows-in-wall example can be calculated as: ({15,9,1/2}-3*{0,14,5/8})/4 -> {3.75,-8.25,-0.34375} and then FIF(Ans) -> {3, 0, 13/32}
// For example, the 15' 9-1/2" wall from earlier is entered as {15,9,1/2} (which displays as {15,9,0.5} but pressing [a b/c] turns the 0.5 back to a fraction).
// Addition, subtraction and multiplication by a constant work as expected e.g. '3 * {0,14,5/8}' gives {0,42,1.875} This function FIF(m,a) does this

// Enter list of feet, inches, fractional inches AND architectural precision!
EXPORT FIF(m,a)
BEGIN
  LOCAL in;
  in := ΣLIST(m * {12,1,1});
  RETURN exact({IP(in/12),IP(in MOD 12),ROUND(FP(in)*a,0)/a} * {1_(ft),1_(inch),1_(inch)}); //  Adjust for architectural fraction
END;

[attachment=6027]
-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Need to convert FIF49 to Prime version - DrD - 06-24-2018 03:38 PM



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