Comments (6)
I think that a library like decimal should never panic.
I never felt good about the panics myself. They were in there primarily because I had not worked on incorporating +/- Inf
, which leads me to...
It might be good idea to introduce +Inf and -Inf values for Decimal objects.
Yes. I've been working on this tonight and am planning on following the IEEE 754 Inf
rules much like the math
package does.
from decimal.
BTW, math/big.Float doesn't support NaN. There is https://golang.org/pkg/math/big/#ErrNaN instead. Probably your library should use the same approach.
from decimal.
Yeah. I'm curious how I'd handle cases like -Inf + -Inf where (to my
knowledge) IEEE dictates the result should be NaN.
I'd like to get away from NaN, though, since +/- Inf should be good enough
(I think).
On Thu, Jan 14, 2016 at 6:47 PM kostya-sh [email protected] wrote:
BTW, math/big.Float doesn't support NaN. There is
https://golang.org/pkg/math/big/#ErrNaN instead. Probably your library
should use the same approach.—
Reply to this email directly or view it on GitHub
#4 (comment)
.
from decimal.
From https://golang.org/pkg/math/big/#Float.Add:
Add panics with ErrNaN if x and y are infinities with opposite signs. The value of z is undefined in that case.
from decimal.
I wonder if it's worth adding traps to the Context so the user can decide
whether they want to have quiet or signaling NaN.
There could be a flag (defaults to signaling?) that determines the behavior
of operations that result in NaN.
On Thu, Jan 14, 2016 at 8:27 PM kostya-sh [email protected] wrote:
From https://golang.org/pkg/math/big/#Float.Add:
Add panics with ErrNaN if x and y are infinities with opposite signs. The
value of z is undefined in that case.—
Reply to this email directly or view it on GitHub
#4 (comment)
.
from decimal.
I do not think I want to implement Accuracy
. I'm not quite sure what benefit it adds, tbh.
from decimal.
Related Issues (20)
- Split a value x ways
- Mantissa retrieval? HOT 3
- Big.Float64() returns incorrect results for large integers
- Precision on math.Ceil HOT 1
- [Critical] Invalid rounding algorithm implementation
- math: Pow returns wrong results when base is negative and power is an integer HOT 1
- UnmarshalBSON and MarshalBSON serialization HOT 2
- SetString("4e絙谶涩)鶤Ŭ廓+踁YÏ豒=iC÷綳") returns 4 instead of an error HOT 6
- undefined: math.MaxInt with Go 1.16 HOT 3
- Float64 conversion HOT 1
- ERROR cannot convert type: types.Decimal HOT 1
- When scale is negative, the result is sci HOT 2
- Incorrect string formatting when rounding up to include additional digit HOT 2
- Imports error
- Rounding issue (expect round up, but down) HOT 1
- Benchmarks add unnecessary dependencies HOT 6
- Invalid Cmp result after using SetString multiple times on same Big HOT 2
- `QuoRem` returns remainder with incorrect scale
- UnmarshalText doesn't reset the number before parsing HOT 1
- Unmarshaling empty string returns `io.EOF` error and it breaks/stops JSON unmarshaling
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 decimal.