Comments (4)
The issue was that std::round was not giving me the same results as hlsl for 0.5, but rounding 0.9 to -1 is definitely wrong, I'll take a look at that again, thanks for reporting
from hlslpp.
Can you try latest code? There was an issue with one of the conditions, it should be good now. I also verified that std::round is incorrect wrt to HLSL and the SIMD _mm_round_ps
from hlslpp.
That fixes my immediate issue, but I did not double check that the fixed code is correct for rounding negative numbers, does the unit test cover these cases? (In my particular case where I ran into this bug, negative numbers are clamped to zero after the rounding operation so any bugs in rounding negative numbers would not show up there.)
What are the differences between HLSL and std::round?
from hlslpp.
It's at x.5 that it goes wrong, not just with hlsl but with the simd intrinsics as well. 0.5 rounds to 1 with std::round but to 0 in the other cases.
The unit tests have negative numbers as well. However I may have to improve them because they clearly didn't catch the issue last time. I did do a few more tests locally.
from hlslpp.
Related Issues (20)
- Improve HLSL++ unit tests by using full-featured testing framework HOT 2
- Matrix accessor operator HOT 6
- operator / (float1, float3) looks inverted HOT 8
- How well does this cover HLSL202x? HOT 11
- * operator brake mult function in quaternion HOT 7
- Quaternion slerp returning nan values HOT 2
- Clang error: unused variable 't4' in hlsl++_quaternion.h HOT 6
- Upgrade warnings to errors HOT 2
- round() on ARM Neon uses wrong rounding mode HOT 2
- mul() intrinsic is missing some overloads. HOT 2
- clamp() intrinsic is missing overloads for intN HOT 1
- Some non square matrix definitions are incorrect HOT 6
- Missing matrix constructors HOT 2
- Some vector double functions missing HOT 5
- Undefined behavior when accessing vector elements with operator[] HOT 10
- Build failure on G++13.2 HOT 11
- Errors on building Linux ARM64 HOT 2
- vcpkg support? HOT 11
- Take address of single-component swizzles HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hlslpp.