Control.Lens.Setter (**~) doctest fails on some platforms #310

Closed
cjwatson opened this Issue Jun 14, 2013 · 5 comments

Projects

None yet

3 participants

@cjwatson

On a couple of Debian architectures, one of the doctests for **~ fails due to a slight floating-point inequality, as follows:

https://buildd.debian.org/status/fetch.php?pkg=haskell-lens&arch=kfreebsd-i386&ver=3.9.0.2-2&stamp=1369593382
https://buildd.debian.org/status/fetch.php?pkg=haskell-lens&arch=hurd-i386&ver=3.9.0.2-2%2Bb1&stamp=1371039197

Failure in src/Control/Lens/Setter.hs:672: expression `_2 **~ pi $ (1,3)'

expected: (1,31.54428070019754)
but got: (1,31.544280700197532)

Would it be possible to either compare this to (1,3pi) directly, or else to tolerate some slight difference in the exact floating-point representation of 3pi? It doesn't look as though the precise representation is important to this test.

@ion1 ion1 closed this in ab2c8ee Jun 17, 2013
@ion1
Collaborator

I suppose that ought to work on all platforms.

@pthariensflame
Collaborator

It actually only works on platforms whose fundamental number system is binary; there is at least one known system that uses balanced ternary instead. ;-)

@ion1
Collaborator

:-) Feel free to reopen the bug when trying to build lens on one.

@cjwatson

Looks likely, indeed. Uploading to Debian shortly to make sure.

@cjwatson

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment