public class Test {
public static void main(String[] args) {
System.out.println(15.12 + 59.70 - 74.82);
}
}
Drop that in 'Test.java', run 'javac Test.java', and then 'java Test'
(assuming you've got a Java SDK on your computer), and you'll see that
it's certainly not CF doing something weird. Maybe java's doing it
wrong, but I'd be surprised.
cheers,
barneyb
On 12/6/05, Claude Schneegans <[EMAIL PROTECTED]> wrote:
> >>Unfortunately, that's not the case.
>
> I'm sorry, but it is the case here: floating points always represent
> exact values in computers.
> It is not always the value that was intended, WHEN there is an
> approximation made due to some rounding,
> but ONLY when.
> For instance, the result of 4.0/2.0 is represented exactly by a floating
> value, because all the decimals dropped due of the limited
> number of bits are zero anyway, so absolutely NO rounding error is made.
> On the other hand, something like 1.0/3.0 cannot be represented exactly
> by floating values, but 1.0 and 2.0 are.
>
> In our case here (15.12 + 59.70 - 74.82) there shouldn't be any roundig
> occuring, and if there is, it is only
> due to the manipulation CF is doing to calculate the result, not to the
> nature of floating arithmetics.
>
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 100 invites.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226305
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54