Need to convert FIF49 to Prime version
06-24-2018, 01:37 PM
Post: #17
 BruceH Senior Member Posts: 506 Joined: Dec 2013
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.
 « Next Oldest | Next Newest »

 Messages In This Thread Need to convert FIF49 to Prime version - Mikebike - 06-16-2018, 02:23 PM RE: Need to convert FIF49 to Prime version - Eddie W. Shore - 06-18-2018, 12:51 PM RE: Need to convert FIF49 to Prime version - Mikebike - 06-18-2018, 02:16 PM RE: Need to convert FIF49 to Prime version - grsbanks - 06-18-2018, 03:27 PM RE: Need to convert FIF49 to Prime version - Joe Horn - 06-18-2018, 03:29 PM RE: Need to convert FIF49 to Prime version - DavidM - 06-18-2018, 03:42 PM RE: Need to convert FIF49 to Prime version - Eddie W. Shore - 06-21-2018, 12:35 PM RE: Need to convert FIF49 to Prime version - Mikebike - 06-21-2018, 01:03 PM RE: Need to convert FIF49 to Prime version - Eddie W. Shore - 06-21-2018, 07:49 PM RE: Need to convert FIF49 to Prime version - Mikebike - 06-22-2018, 01:58 AM RE: Need to convert FIF49 to Prime version - grsbanks - 06-22-2018, 06:39 AM RE: Need to convert FIF49 to Prime version - Stevetuc - 06-22-2018, 07:02 AM RE: Need to convert FIF49 to Prime version - DrD - 06-22-2018, 10:57 AM RE: Need to convert FIF49 to Prime version - Mikebike - 06-22-2018, 12:19 PM RE: Need to convert FIF49 to Prime version - Eddie W. Shore - 06-22-2018, 01:07 PM RE: Need to convert FIF49 to Prime version - DrD - 06-22-2018, 04:44 PM RE: Need to convert FIF49 to Prime version - BruceH - 06-24-2018 01:37 PM RE: Need to convert FIF49 to Prime version - DrD - 06-24-2018, 03:38 PM RE: Need to convert FIF49 to Prime version - Didier Lachieze - 06-24-2018, 04:41 PM RE: Need to convert FIF49 to Prime version - DrD - 06-24-2018, 06:31 PM RE: Need to convert FIF49 to Prime version - Didier Lachieze - 06-24-2018, 07:22 PM RE: Need to convert FIF49 to Prime version - Mikebike - 06-24-2018, 07:33 PM