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

floor() is actually trunc() #19

Open
MrUnbelievable92 opened this issue Dec 4, 2022 · 0 comments
Open

floor() is actually trunc() #19

MrUnbelievable92 opened this issue Dec 4, 2022 · 0 comments

Comments

@MrUnbelievable92
Copy link

As the title says, the 'double custom_floor(const double x)' function actually truncates negative values, not apply the mathematical floor function, which would for instance result in -15 given -14.5 as an input. This is also true for SSE4, where floor is defined as rounding towards negative infinity. The 'custom_floor' function rounds toward zero.

Also, it doesn't handle infinity and NaN as input, which only results in 'MOVQ', 'TEST' 'CMOVAE' as ouput instructions resulting in 1 additional cycle in latency, but I guess that's a design choice.

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

No branches or pull requests

1 participant