December 20, 200520 yr 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?
December 20, 200520 yr comment your resourceful..ness in terms of links will never seem to amaze me :
December 20, 200520 yr 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
December 20, 200520 yr 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?
December 20, 200520 yr Author No I was saying after my changes it didn't. But yours if you do .5 returns 2/4.
December 20, 200520 yr 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 ) )
February 3, 200619 yr 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.
February 3, 200619 yr 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
Create an account or sign in to comment