News for hackers. Stuff that matters.
Re:Show HN: Etherglade – Accept Ethereum on your site in min... by gabipurcaru on Tuesday April 03, 2018 @09:08AM (#16744259)
This looks nice. One thing though - you should consider using strings instead of numbers for the amounts. The problem is that numbers in JS are actually floats, and you lose precision on high values. Probably not going to make a big difference, but e.g. 100000000000000001 can't be represented as a number in JS.
Re:Show HN: Etherglade – Accept Ethereum on your site in min... by VMG on Tuesday April 03, 2018 @09:15AM (#16744298)
> consider using strings

And because '1' + '1' === '11' is not the pinnacle of arithmetic either, consider using bignumber.js or a better language than JavaScript

Re:Show HN: Etherglade – Accept Ethereum on your site in min... by hakanito on Tuesday April 03, 2018 @09:52AM (#16744561)
So, what other language do you suggest for building an interactive web app?
Re:Show HN: Etherglade – Accept Ethereum on your site in min... by VMG on Tuesday April 03, 2018 @10:08AM (#16744706)
The number of languages that compile to JS or WASM is increasing, maybe I'd use Elm or Rust.
Re:Show HN: Etherglade – Accept Ethereum on your site in min... by hakanito on Tuesday April 03, 2018 @02:05PM (#16747392)
Yes but would it solve the floating point inaccuracies? Compiled to JS is JS after all
Re:Show HN: Etherglade – Accept Ethereum on your site in min... by VMG on Tuesday April 03, 2018 @03:56PM (#16748480)
you could enforce proper types that do not have any inaccuracies
Re:Show HN: Etherglade – Accept Ethereum on your site in min... by vertoc on Tuesday April 03, 2018 @11:46AM (#16745783)
Ah good call - I will definitely be switching to either strings or, as another commenter pointed out, BigNumber. Thanks for catching this!