This content has been marked as final.
Show 1 reply

1. Re: Rounding
davidanders Sep 17, 2013 9:08 AM (in response to germain)Googleing did not find much
FROM Newb trying to create fractions from decimals...
 posted February 27, 2009 by comment
I'd suggest you make this in two steps, otherwise your formula will be utterly unreadable in version 6. The first step is to divide X by Y and round the result to nearest 1/32 (result is Number):
Round ( X / Y * 32, 0 ) / 32
Note that here we have no protection against Y being 0 or empty, which will result in an error.
Let's call the previous result n and move to the second and final step* (result is Text) =
Case ( Int ( n ) , Int ( n ) & " " )
&
Case (
Mod ( n, 1 ),
Mod ( n, 1 ) * 2^( Length ( Mod ( n, 1 ) )  1 )
& "/" &
2^( Length ( Mod ( n, 1 ) )  1 )
)

(*) adapted from http://www.onegasoft.com/tools/commonfractions/index.shtmlSearch for "fraction" http://www.briandunning.com/filemakercustomfunctions/results.php
Fractions to Decimals By: John Mark Osborne http://www.databasepros.com Number to Fraction By: John Mark Osborne http://www.fmfiles.com/tnt1.html