[Haskell-beginners] rational exponents

Brandon Allbery allbery.b at gmail.com
Wed Sep 7 22:38:21 CEST 2011

On Wed, Sep 7, 2011 at 16:25, Christopher Howard <
christopher.howard at frigidcode.com> wrote:

> Hi. I'm working with simple functions involving rational exponents. I
> noticed that the (**) function seems to do okay with negative powers, but
> that something else is needed for rational exponents:

Nothing else is needed; you're just seeing the inevitable failure mode of
floating point math (once you get into exponents that aren't integers, you
can't escape it).  You may want to restrict printing precision.

(No, this is not a bug.  No, there is no workaround that magically makes
floating point behave the way new users think it should.  And no, this is
absolutely *not* Haskell-specific; the same kind of question constantly
comes up with C, C++, Perl, Java, PHP, ....)

brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110907/6ba1f3c5/attachment.htm>

More information about the Beginners mailing list