Post Reply 
Need to convert FIF49 to Prime version
06-24-2018, 01:37 PM
Post: #17
RE: Need to convert FIF49 to Prime version
There is an alternate approach which is to use 3 element lists to represent feet, inches and fractions of inches.

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} which then just needs to be 'normalised'.

The function FIF does this normalisation:
Code:
EXPORT FIF(m)
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) := FP(in);
  RETURN res;
END;

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}

It is an easy matter to modify the code to use fixed 8ths or 16ths for the third value in the list if so desired.
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 - BruceH - 06-24-2018 01:37 PM



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