Thanks Joe,
Yes all vars were integers. Thanks for pointing out two problems,
First I completely overlooked the floating point thing, and two I
could use more sleep! :-)
thanks again.
Craig
Message: 5
Subject: Re: Math 101 help...
From: [EMAIL PROTECTED]
Date: Mon, 2 Oct 2006 14:01:11 -0600
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
_______________________________________________
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>