Make Prelude.abs handle -0.0 correctly (#7858)
authorAlexander Berntsen <alexander@plaimi.net>
Tue, 19 Aug 2014 02:42:12 +0000 (21:42 -0500)
committerAustin Seipp <austin@well-typed.com>
Tue, 19 Aug 2014 04:26:19 +0000 (23:26 -0500)
commit6f6ee6eaa348b1a4815190c4d526d5c81c264fa7
tree607f3b4db3f206397193fd518f4b889482705d44
parent88b1f99d473e5588378699abeb203c39ea554334
Make Prelude.abs handle -0.0 correctly (#7858)

Summary:
Make the `Float` and `Double` implementations of `abs` handle -0.0
correctly per IEEE-754.

abs (-0.0::Float) and abs (-0.0::Double) previously returned -0.0, when
they should return 0.0. This patch fixes this.

Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
Test Plan: abs (-0.0::Double) should = 0.0 instead of (-0.0)

Reviewers: ekmett, hvr, austin, rwbarton

Reviewed By: austin, rwbarton

Subscribers: phaskell, trofi, simonmar, relrod, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D145

GHC Trac Issues: #7858
libraries/base/GHC/Float.lhs
libraries/base/changelog.md