Comments (3)
@bguiz Agreed. These libraries would be nice to have, but we first want to cover all our bases and get the basics right before moving on to higher order concerns. Much to do, so little time!
Also, if you have any other general questions, feel free to also seek us out and leave a message on Gitter.
from stdlib.
@bguiz Yeah, thanks for the question. This behavior is expected.
> 0.1 + 0.2
0.30000000000000004
This is not because JavaScript implementors have failed to properly implement floating-point math. The reason the answer is not exactly 0.3
is because not all numbers are exactly representable as double-precision floating-point numbers (see here). In short, addition is working as expected.
In general, this type of imprecision is not an issue, as floating-point rounding errors tend to cancel out. What we are concerned about is the types of algorithms used to implement basic math functions, such as trig and other special functions. The errors arising from these algorithms are of a different kind than the errors arising from floating-point math.
To "address" floating-point errors, you can use symbolic or arbitrary precision arithmetic libraries, which is not currently within the scope of this library, but may at some point in the future.
from stdlib.
Thanks for the answer!
To "address" floating-point errors, you can use symbolic or arbitrary precision arithmetic libraries, which is not currently within the scope of this library, but may at some point in the future.
With the name stdlib
I think including this at some point in the future might make sense. For example, you already have some util functions which overlap with these libraries, for example this one which converts a higher precision float to a lower precision one: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/utils/float64-to-float32
from stdlib.
Related Issues (20)
- [RFC]: add `@stdlib/array/base/count-same-value-zero` HOT 4
- [RFC]: add `@stdlib/array/base/join` HOT 2
- [RFC]: add `@stdlib/array/base/with` HOT 3
- [RFC]: improve README examples in namespace packages HOT 5
- [RFC]: add tests to `@stdlib/utils/compact-adjacency-matrix` HOT 9
- [RFC]: add `@stdlib/math/iter/sequences/tribonacci` HOT 2
- [RFC]: add `@stdlib/complex/parse-float32` HOT 6
- [RFC]: add `@stdlib/complex/parse-float64` HOT 9
- [RFC]: add `@stdlib/iter/cartesian-square` HOT 2
- [RFC]: add `@stdlib/iter/cartesian-product` HOT 5
- [RFC]: add `@stdlib/iter/cartesian-power` HOT 5
- [RFC]: add `@stdlib/assert/is-same-date-object` HOT 6
- random-base-uniform 0.2.0 depends on random-base 0.1.1, causing installation of duplicate versions of dependencies HOT 5
- [RFC]: add `@stdlib/assert/is-nonpositive-finite` HOT 4
- [RFC]: add `@stdlib/assert/is-nonnegative-finite` HOT 2
- [RFC]: add `@stdlib/assert/is-negative-finite` HOT 7
- [RFC]: add `@stdlib/assert/is-positive-finite` HOT 2
- [RFC]: add `@stdlib/assert/is-ragged-nested-array` HOT 7
- [RFC]: add `@stdlib/assert/is-complex-string` HOT 14
- [RFC]: improving the stdlib developer development experience HOT 7
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 stdlib.