Comments (10)
Former I think is worth fixing. When it doesn't introduce huge performance losses, basic stuff should work the way it works in Number.
Latter is working as intended. Only use fc_nn if you know what you're doing or you're willing to accept arbitrary consequences.
from break_eternity.js.
Ok, thanks for answer.
Honestly yeah, about the 2nd one, you should face the consequences of creating arbitary non-normalized Decimals.
from break_eternity.js.
Hmm. Just throught about it now - new Decimal(true)
is 0 which is also probably unexpected?
from break_eternity.js.
I have no idea what that should be. Probably undefined behaviour - why would you ever write that on purpose?
from break_eternity.js.
Because Number(true)
is 1 shouldn't new Decimal(true)
be 1 too?
from break_eternity.js.
I guess! (Does break_infinity also fail this?)
from break_eternity.js.
Uh, I don't know. I can check
from break_eternity.js.
I just tested in FE000000, which uses break_infinity.min.js
and new Decimal(true)
throws TypeError: t.indexOf is not a function
with stacktrace s.fromString
, new s
.
Throws exception from here (-1 !== t.indexOf("e")
):
s.prototype.fromString = function(t) {
if (-1 !== t.indexOf("e")) {
var n = t.split("e");
from break_eternity.js.
Oh, because it tries to do fromString if input is not undefined, Decimal or number.
from break_eternity.js.
First statement evaluates to true now, as 1.4.1 normalizes infinities. However, second statement is still false, as I set negative infinity to be normalized to have layer Infinity rather than negative Infinity. Patashu, can you explain why Decimal.dNegInf has layer -Infinity? Shouldn't it have sign -1, mag Infinity, layer Infinity? I guess I should have tested 1.4.1 a little more - I'll have to make a 1.4.2 fixing this, but first I think we need to decide what negative infinity should be and why.
Fourth and fifth statements are now false, as they should be. Third is still false, but that's actually intended - NaN is not equal to itself, that's a rule of floating point. In fact, Decimal.eq(Decimal.NaN, Decimal.NaN) returns false.
EDIT: Okay, I've submitted a pull request that makes the normalization of infinities have {-1, -Infinity, -Infinity} for negative infinity, and this makes your second statement true. Once that pull request is merged, this issue can be closed.
EDIT 2: This issue is solved - well, unless we care about the Decimal(true) thing.
from break_eternity.js.
Related Issues (20)
- equivalent to afford/sum geometric series for 'if the price exponentiates by a certain factor each purchase' HOT 1
- Bug? Missed cases with Add and multiply HOT 5
- Reduant constants? HOT 1
- `Decimal.ceil` is incorrect for very small positive numbers HOT 1
- Typescript CommonJS not exported properly HOT 2
- Documentation - Read.me - weirdy weirdo HOT 8
- Can't convert BigInt to Decimal without setting its value to 0 HOT 8
- different results when expexting the same result HOT 5
- `Decimal.lambertw("ee4992767175317001")` errors instead of returning a value HOT 1
- The next step HOT 5
- [enhancement] I think I’ve figured out how to do arbitrary-height super-roots. HOT 3
- Tetration/iteratedexp has incorrect behavior for large heights on small bases with large payloads HOT 2
- Wrong String for reciprocals HOT 1
- Wrong factorial approximation HOT 2
- `Decimal.lambertw` occasionally spikes with inputs around the ee31 range
- Unexpected NaN from sqrt()
- Decimal.isValid() ?
- `new Decimal("(e^x)1")` returns `Decimal` with fractional `layer` if `x` is not an integer
- `new Decimal("(e^x)1")` returns `Decimal` with negative `layer` if `x` is negative
- The normalization of `new Decimal(-Infinity)` breaks some operations and may be incorrect HOT 2
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 break_eternity.js.