Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,870
    • Issues 4,870
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7069
Closed
Open
Created Jul 12, 2012 by shahn@trac-shahn

precision/rounding bug with floating point numbers on 32-bit-platforms

Comparing floating point numbers (Floats or Doubles, using (==)) that are constructed by equal terms sometimes evaluates to False. A term that produces normal floating point values (as opposed to NaN or Infinity) should always be equal to itself. This bug effectively breaks referential transparency.

This bug occurs with ghc-7.4.2 when compiling with "-O2" on 32-bit linux ubuntu-11.10. (I guess, it happens on all 32-bit platforms.)

The attached file demonstrates the bug.

Simon Marlow expressed his doubts, this bug will be fixed. See also: http://www.haskell.org/pipermail/glasgow-haskell-users/2012-July/thread.html#22565

Possible workarounds:

  • compile with "-msse2" if available
  • use approximate equivalence
Trac metadata
Trac field Value
Version 7.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking