Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Converting a decimal into a fraction measurement?

Featured Replies

I have found a sub routine that will convert a decimal to a fraction with a set degree of accuracy. But I need something that will only work in 1/2, 1/4, 1/8, 1/16 (powers of 2).

Anyone know of anything to help me?

See if this helps.

  • Author

Awesome! I was about 75% to the same type of calculation myself :.

comment your resourceful..ness in terms of links will never seem to amaze me :

in terms of links will never seem to amaze me

LOL - No he's definately under avarage in that dept. : - but when it comes to cleverness, he never SEIZE to amaze me, at least!

--sd

  • Author

I can't figure out how to add in 1/2 conversions? I got it to do .5 to 1/2, but then when I had .75 it would do 1.5/2.

Think you could modify that for me?

Huh? 0.75 returns "3/4", unless we're not talking about the same formula.

  • Author

No I was saying after my changes it didn't. But yours if you do .5 returns 2/4.

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 )

)

  • Author

Thanks!

  • 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.

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

  • Newbies

Thanks for the advise, it was of great value.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.