[Haskell-beginners] How to improve the accuracy of floating point calculation?
zhiwudazhanjiangshi at gmail.com
Wed Feb 6 00:04:06 CET 2013
I'll try CReal.
But can I set *significant figures **myself?*
On Wed, Feb 6, 2013 at 6:50 AM, Brandon Allbery <allbery.b at gmail.com> wrote:
> On Tue, Feb 5, 2013 at 5:41 PM, yi lu <zhiwudazhanjiangshi at gmail.com>wrote:
>> I found that in ghci, I input
>> and run, I get a result of
>> But, as you know, it is not the exact answer.
>> So, I wonder if there is something I can do to achieve a better
>> performance and get [0.1,0.2,0.3,0.4..] as the result.
> Welcome to the world of floating point numbers. Perfect accuracy is not
> possible; the CReal type from the "numbers" package may handle cases you
> care about, or may not. (Other languages often use output formats that can
> largely hide the errors, but they're still there and will eventually
> accumulate into visibility.)
> brandon s allbery kf8nh sine nomine
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners