Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: ghci: inconsistent return values for succ (Kim-Ee Yeoh)
2. Re: ghci: inconsistent return values for succ (Rein Henrichs)
----------------------------------------------------------------------
Message: 1
Date: Mon, 19 Oct 2015 12:05:12 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] ghci: inconsistent return values for
succ
Message-ID:
<CAPY+ZdRSnLrW5Xh6q1rVz4A6aQVkfLA5BQhd0uM=aysdy8y...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Sun, Oct 18, 2015 at 10:57 PM, Frothy Bits <[email protected]>
wrote:
> Is the behavior I'm seeing actually related to a bug in parsec?
If you're interested in digging deeper, I'd say look at the output, not the
input end. Almost certainly the machine floating-point double for 3.14 and
(3.14+1.0) are identical across ghc, C, and python.
What's not identical is how different languages choose to display 4.14.
C and python do some display rounding so you don't see the issue. The
display algorithm in Haskell probably goes for the simple, naive approach.
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20151019/8e3b7399/attachment-0001.html>
------------------------------
Message: 2
Date: Mon, 19 Oct 2015 10:13:50 +0000
From: Rein Henrichs <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] ghci: inconsistent return values for
succ
Message-ID:
<CAJp6G8xRBAz7vMPAKwAv9EZp2Ds+eM0MwChtAQ3z3S-u+SZu=a...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
> That said, I really appreciate Rein's reply and recognize that picking
Double for the extended default rules is "a good choice."
To follow up a bit, the reason that it's a good choice is pragmatic: we
usually prefer to work with such numbers using native floating point math
for speed rather than using rational or computable real or other
representations which are more accurate but many orders of magnitude
slower. If I said 3.5 + 1 in any general purpose language, I would be
surprised if it did anything other than an immediate floating point
calculation, and so it is (by default) in Haskell.
If we want another representation then we must reach for it, but we don't
need to reach very far.
On Sun, Oct 18, 2015 at 10:05 PM Kim-Ee Yeoh <[email protected]> wrote:
>
> On Sun, Oct 18, 2015 at 10:57 PM, Frothy Bits <[email protected]>
> wrote:
>
>> Is the behavior I'm seeing actually related to a bug in parsec?
>
>
> If you're interested in digging deeper, I'd say look at the output, not
> the input end. Almost certainly the machine floating-point double for 3.14
> and (3.14+1.0) are identical across ghc, C, and python.
>
> What's not identical is how different languages choose to display 4.14.
>
> C and python do some display rounding so you don't see the issue. The
> display algorithm in Haskell probably goes for the simple, naive approach.
>
> -- Kim-Ee
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20151019/b9eaf491/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 88, Issue 16
*****************************************