>I'm trying to find a way of converting .25 decimal to 1/4 fraction.

The following works, but not sure if it's the best method...

<cfset Target = 0.25 />
<cfset Result = ""/>

<cfloop index="Numerator" from="1" to="100">
        <cfloop index="Denominator" from="1" to="100">

                <cfif Numerator / Denominator EQ Target>
                        <cfset Result = Numerator &'/'& Denominator />
                        <cfbreak/>
                </cfif>

        </cfloop>
        <cfif Len(Result)><cfbreak/></cfif>
</cfloop>

<cfoutput>#Result#</cfoutput> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315872
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to