Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Money as Double? #1

Open
DiegoNolan opened this issue Sep 8, 2015 · 4 comments
Open

Money as Double? #1

DiegoNolan opened this issue Sep 8, 2015 · 4 comments

Comments

@DiegoNolan
Copy link

Why is money not fixed point? Haskell has Rational.

@wraithm
Copy link
Owner

wraithm commented Sep 8, 2015

The reason why I did this is that the Lending Club API uses floating point,
at least superficially (eg.
https://www.lendingclub.com/developers/summary.action). You caught me. I
was lazy.

You're absolutely right that it makes more sense to use fixed point
instead. Something like scientific might be a good candidate.

What do you think Integer, scientific, something else? I'm very open to
other suggestions.

On Mon, Sep 7, 2015 at 11:38 PM, Nolan Sandberg notifications@github.com
wrote:

Why is money not fixed point? Haskell has Rational.


Reply to this email directly or view it on GitHub
#1.

@dmjio
Copy link
Collaborator

dmjio commented Sep 8, 2015

Scientific or Decimal, probably

Sent from my iPhone

On Sep 7, 2015, at 11:57 PM, Matthew Wraith notifications@github.com wrote:

The reason why I did this is that the Lending Club API uses floating point,
at least superficially (eg.
https://www.lendingclub.com/developers/summary.action). You caught me. I
was lazy.

You're absolutely right that it makes more sense to use fixed point
instead. Something like scientific might be a good candidate.

What do you think Integer, scientific, something else? I'm very open to
other suggestions.

On Mon, Sep 7, 2015 at 11:38 PM, Nolan Sandberg notifications@github.com
wrote:

Why is money not fixed point? Haskell has Rational.


Reply to this email directly or view it on GitHub
#1.


Reply to this email directly or view it on GitHub.

@DiegoNolan
Copy link
Author

I'm wondering if it is necessary though. If we are using application/json I don't know if it matters since in javascript all numbers are represented as doubles. I guess when we end of doing arithmetic operations on the results we get from the API it may matter.

@wraithm
Copy link
Owner

wraithm commented Sep 8, 2015

Yeah, you're exactly where I was thinking when I wrote this thing. You're
exactly right that lending club is using doubles for the json, and that's
why I used doubles. Again, you're right that you get precision issues when
you do arithmetic on that data using this library.

I don't know anything about Decimal. My favorite would probably be using
Integer.
On Sep 8, 2015 12:09, "Nolan Sandberg" notifications@github.com wrote:

I'm wondering if it is necessary though. If we are using application/json
I don't know if it matters since in javascript all numbers are represented
as doubles. I guess when we end of doing arithmetic operations on the
results we get from the API it may matter.


Reply to this email directly or view it on GitHub
#1 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants