> -----Original Message-----
> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 17, 2007 11:46 AM
> To: CF-Talk
> Subject: Re: Simple JS math?
> 
> num + eval(frac)
> 
> The latter operand will evaluate the string as if it were javascript
> (i.e. do 3 / 8), which will give you the floating-point equivalent of
> the fraction, which can then be added to the integer (giving 20.375).

That's assuming that the fraction has to be a string (and maybe it does).
If it doesn't have to be then you should just be able to do "num + (3/8)" -
that will come out with a decimal answer (should be the same answer as
Barney's).

Converting that answer to a fractional display (assuming you need to do
that) will be more difficult I think.

Jim Davis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283905
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