Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WithinULP is broken #1229

Closed
Jofagi opened this issue Mar 21, 2018 · 3 comments
Closed

WithinULP is broken #1229

Jofagi opened this issue Mar 21, 2018 · 3 comments

Comments

@Jofagi
Copy link

Jofagi commented Mar 21, 2018

Description

These tests fail:

REQUIRE_THAT(33.69006f, WithinULP(33.69f, 1));
REQUIRE_THAT(33.69006, WithinULP(33.69, 1));

Output is:

  REQUIRE_THAT( 33.69006f, WithinULP(33.69f, 1) )
with expansion:
  33.69006f is within 1 ULPs of 33.6899986267f

  REQUIRE_THAT( 33.69006, WithinULP(33.69, 1) )
with expansion:
  33.69006 is within 1 ULPs of 33.69

From my understanding the tests should also succeed with 2 ULPs but even 0 doesn't work.

Steps to reproduce

Add above two lines of code into Matchers.test.cpp "Floating point matchers" [float|double] tests cases and run SelfTest binary.

Extra information

  • Catch version: Catch v2.2.1
  • Operating System: Ubuntu 16.04.4 LTS
  • Compiler+version: g++-5 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
@horenmar
Copy link
Member

Why do you believe these should succeed?

@Jofagi
Copy link
Author

Jofagi commented Mar 21, 2018

Sorry, I had a fundamental misunderstanding of what ULP means. I mistook "units in last place" for "the last decimal places".
Again, sorry for causing a stir... 😳

@Jofagi Jofagi closed this as completed Mar 21, 2018
@horenmar
Copy link
Member

No worry, I expected as much.

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

No branches or pull requests

2 participants