On Oct 02, 2006, at 19:53 UTC, Craig Hoyt wrote:

> I see no difference in the two statements;
> 
> a = y1 / 3
> r = a * 3
> 
> and
> 
> r = (y1 / 3)* 3

There is a difference, if a is an integer.  The first one above does a
floating-point division of y1 by 3, and then truncates to an integer to
store in a, which you then multiply by 3 and assign to r.  The second
one above does a floating-point division by three, then multiplies by
three, so the result is of course r = y1.

To do it in one line, do r = (y1 \ 3) * 3, or r = Floor(y1 \ 3) * 3.

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to