I have this formula works fine for converting into fractions.

function decimal2frac(xvalue)
{
// x value is decimal portion
        var numer = xvalue;
        var denom1 = 1;
        var i = 0;
                for (i=0; i lt (len(xvalue) -1);i=i+1)
                {
                        numer = numer *10;
                        denom1 = denom1 *10;
                }
        for (i=2; i lte numer; i = i+1)
        {
                while ( numer mod i eq 0 and  denom1 mod i eq 0)
                {
                        numer = numer /i;
                        denom1 = denom1 /i;
                }
        }
        numer = numer & "/" & denom1;
        return numer;
}

Trying to figure out how i can round the fractions to nearest 16th. Its late 
and the math side of my brain is sleeping.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235520
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to