Jump to content

Converting a decimal into a fraction measurement?


BowDown
 Share

This topic is 5703 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I see. Well, that was the requirement then.

Here's a more general formula, adapted from Mikhail Edoshin's "Common fractions from their decimal representation". You can adjust the precision parameter (in powers of two) to the smallest division you want to be shown.

Let ( [

precision = 16 ;

num = Round ( Number * precision ; 0 ) / precision ;

fraction = Mod ( num ; 1 ) ;

len = Length ( fraction ) ;

denom = Case ( len ; 2^( len - 1 ) )

] ;

Case ( Int ( num ) or not fraction ; Int ( num) )

&

Case ( Int ( num ) and fraction ; " " )

&

Case ( fraction ; fraction * denom & "/" & denom )

)

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • Newbies

I am a novice with filemaker. I have two fields in which i want to enter a width and height in a fraction ( as 30-1/4") in the next field to calculate the result of total square footage in want the result to be in a whole number, but it does not add up correctly. I have been trying different things with no luck, any insight would be greatly appreciated.

Link to comment
Share on other sites

If I'm understanding you correctly, you want to take a number such as 11 1/5 and have it enter as 11.5 in the field?

If so, go to this URL:

http://www.databasepros.com/resources.html

and do a find for Fraction

and it will return two files. check them both out.

Lee

Link to comment
Share on other sites

This topic is 5703 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.