Comments (3)
Couple of thoughts:
- The
2.7755575615628914E-17
vs0.0
looks like an expected rounding error. Comparing floats is a hard thing, as IEEE floating point arithmetic can't represent the whole Real space (see e.g. https://docs.python.org/2/tutorial/floatingpoint.html). To cope with this testing frameworks have a way to assert equality in a given delta (see e.g. http://stackoverflow.com/questions/7554281/junit-assertions-make-the-assertion-between-floats) - The
1.0714285714285714
vs1.0
does seem suspicious. Are you sure there is no coding error? - getters and setters are also good to isolate your class implementation from itself, so you could change
this.r
forthis.getR()
from quaternion.
assertEquals(new Quaternion(1, 2, 3, 4).multiply(new Quaternion(
((double)1.0)/28, ((double)-2.0)/28, ((double)-3.0)/28, ((double)-4.0)/28)),
new Quaternion(1, 0, 0, 0)); // Multiplying by right inverse.
The problem with the 1.0714285714285714
vs 1.0
was because the norm of the quaternion was 30, not 28.
The 2.7755575615628914E-17
vs 0.0
was a rounding error problem, so I created a new assert with a tolerance, comparing each component of the two quaternions with an assertEquals
.
from quaternion.
👍
from quaternion.
Related Issues (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 quaternion.