Skip to content
  • bernalex's avatar
    Make Prelude.abs handle -0.0 correctly (#7858) · 6f6ee6ea
    bernalex authored
    
    
    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: default avatarAlexander 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
    6f6ee6ea