Live data from Hacker News

UsTaxes – open-source tax filing web application

ustaxes.org

21–30 of 56 posts

Re: UsTaxes – open-source tax filing web application

#21
post #15

Someone else has already noted this: Don't use the native Javascript Number type for calculations involving currency. There's some great reading available online on this subject.[1][2] There are various libraries around that can facilitate precise decimal arithmetic in Javascript. A well known one is BigNumber.js ( https://mikemcl.github.io/bignumber.js/ ) A great quote that I found on StackOverflow regarding this is…

At least in the US, tax calculations may round all inputs to the nearest whole dollar. https://www.taxact.com/support/14396/2017/forms-w-2-or-1099-...

> If you do round to whole dollars, you must round all amounts.

Aww....

Re: UsTaxes – open-source tax filing web application

#22
post #2

To pick on one of the more recent PRs that landed, I would think easily 80% of the value of "legislation into TypeScript" would be *annotating* that source code with the citation where followers on could verify the calculation and teaching future contributors to fish Otherwise, I, too, can just make up 1.45 numbers: https://github.com/ustaxes/UsTaxes/pull/422/files#diff-76e87... The contributor guide spends a lot of…

Thanks for that feedback, having source material links in the comments is definitely a good idea.

I've added an issue to track that based on your feedback:

https://github.com/ustaxes/UsTaxes/issues/458

And another issue about floating point:

https://github.com/ustaxes/UsTaxes/issues/457

I have doubts about the floating point issue just because all values on the tax forms are calculated using floats and then rounded to the nearest whole dollar. But if there's even a possibility that an intermediate calculation could flip a x.49 to a x.50 and change the rounding, then I agree we should switch to a library.

About the contributor guide, we just tried to write it to be as welcoming as possible to new contributors. With respect to "'ask in discord' for the actual content of the tax calculations", I'm just not sure what you mean. That document isn't really relevant to tax calculations. We will give the document another look though based on your feedback.

Re: UsTaxes – open-source tax filing web application

#23
post #15

Someone else has already noted this: Don't use the native Javascript Number type for calculations involving currency. There's some great reading available online on this subject.[1][2] There are various libraries around that can facilitate precise decimal arithmetic in Javascript. A well known one is BigNumber.js ( https://mikemcl.github.io/bignumber.js/ ) A great quote that I found on StackOverflow regarding this is…

Thanks for the write-up. I thought we would be protected because calculations are done using decimal places and then the final return is prepared using rounded integers. But we have heard this a few times, so I think it would be good to make it explicit somewhere that it's done this way, or switch to bignumber. Do you think if all our calculations are done using decimal places, and then numbers are rounded to integer…

the maximum safe integer in JS is 2^53 - 1. [0]

if you can find a way to use only integers within that range, you can do it safely in plain JS.

for example, units of integer microdollars (one millionth of a dollar) allows you to deal in amounts up to $9 billion without exceeding the safe integer limit. if you want a larger range than that, you need to make a corresponding reduction in precision (such as using millidollars).

or, switch to a full-blown bignum / arbitrary precision library.

0: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re: UsTaxes – open-source tax filing web application

#24

Earlier quoted context omitted.

At least in the US, tax calculations may round all inputs to the nearest whole dollar. https://www.taxact.com/support/14396/2017/forms-w-2-or-1099-...

> If you do round to whole dollars, you must round all amounts. Aww....

Calculate it both ways and display decimals or integers in cases where it makes a $1 tax difference!

Re: UsTaxes – open-source tax filing web application

#25
post #7
post #3

Earlier quoted context omitted.

It's a great idea, but based on your points it seems like this implementation ain't it

As long as Intuit can lobby for the tax code to be complex and the process to be slow, painful, and manual, there aren't going to be any viable options that aren't just other commercial alternatives to TurboTax.

Ideally an open-source project where hundreds of contributors can add small contributions based on their specific knowledge might produce a viable non-commercial option.

Re: UsTaxes – open-source tax filing web application

#26

Maybe I missed it, but there doesn't seem to be anything about capital gains.

Schedule D is implemented, and the long-term capital gains worksheet calculations are done, but 8949 and individual non-reported positions are not implemented yet.

Re: UsTaxes – open-source tax filing web application

#29
post #15

Someone else has already noted this: Don't use the native Javascript Number type for calculations involving currency. There's some great reading available online on this subject.[1][2] There are various libraries around that can facilitate precise decimal arithmetic in Javascript. A well known one is BigNumber.js ( https://mikemcl.github.io/bignumber.js/ ) A great quote that I found on StackOverflow regarding this is…

Good general rule. However, if you are doing some kind of general economic modeling, with estimated parameters all around, not claiming to represent anyone's accounts or ledgers, I suspect an exception applies.

"When you are dealing with things that are measured" ... or wild-ass guesses.

And I doubt demographers and actuaries are all using integer arithmetic for projecting technically integer-count human-life outcomes.

Calculating taxes: Be careful and conventional, as you say.

Post reply on HN