| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Dec 20, 2004, at 4:44 AM, Mike Hall wrote:
if it's already a double, then it's already base-2 "imprecise", and susceptible as such. Converting it to a String buys you nothing, though you might do new BigDecimal("1.8");
This was my guess and one other person confirmed off-list. Assuming I have
been forced to a interim calculation double which has resulted in a
"imprecise" base-2 value. Then doing something like String isprecise =
Double.toString(interim); BigDecimal backtoprecise = new
BigDecimal(isprecise); will not work. Because isprecise won't be.
Is what you are saying that you can sidestep the issue by trying to workAn easy but inefficient way to get a numerical (non-string) value of the form a.b into BigDecimal precisely is to say: new BigDecimal(ab).movePointLeft(1) For example, new BigDecimal(18).movePointLeft(1) is 1.8 exactly.
integer or fixed-point somehow and only when done convert back to the
floating-point representation?
Sean
_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden
| References: | |
| >Re: Math conundrum (From: Sean Luke <email@hidden>) | |
| >Re: Math conundrum (From: "Mike Hall" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.