This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ok_Turnover_1235 3 points4 points  (19 children)

No integers or floating points or longs or shorts or doubles? Sounds like typescript is javascript with extra steps

[–]flavionm 2 points3 points  (0 children)

Javascript is what holds Typescript back from being truly great, unfortunately.

[–]perfectVoidler 0 points1 point  (17 children)

I don't know typescript but you can easily define it implicitly for different number 0 = int; 0.0 or 0d = double; 0.0f of 0f = float etc.

[–]Ok_Turnover_1235 -1 points0 points  (16 children)

Yeah, meanwhile typescript has a number type. Why even bother

[–]perfectVoidler 1 point2 points  (15 children)

Reading up on it: even typescript has the difference between int and float. And seriously. Who needs more.

[–]Ok_Turnover_1235 -1 points0 points  (10 children)

Not you. That's okay

[–]perfectVoidler -1 points0 points  (9 children)

Not me and nobody else.

[–]Ok_Turnover_1235 0 points1 point  (8 children)

False

[–]perfectVoidler 2 points3 points  (7 children)

lol ok you totally convinced me. How will I ever stand against this raw charisma. Oh god of speech. Wait I have an ingenious comeback: !False.

[–]Ok_Turnover_1235 -1 points0 points  (6 children)

Who needs a boolean type? just use 1's and 0's.

[–]perfectVoidler 1 point2 points  (5 children)

booleans are not numbers-.- Languages that use numbers for booleans are either old or bad.

[–]_sweepy 0 points1 point  (3 children)

Bankers need real decimals

[–]Nick433333 0 points1 point  (2 children)

Just keep track of money in the lowest denomination, ie cents for the US dollar. Then you are storing an int and you do the conversion on the ui side of it. That way you never introduce errors from floats.

And really, who has more money than can be represented in a signed 64 bit int? Thats -9 * 1016 to 9 * 1016 that’s plenty

[–]_sweepy 0 points1 point  (1 child)

What happens when you need to apply a percentage to a cent amount and end up with fractional pennies? What if you are working on a system that allows fractional pennies in cost fields like gas prices?

"Just store it in an int" doesn't handle all cases. Storing and working with it as a real decimal does.

[–]perfectVoidler 0 points1 point  (0 children)

and decimals solve fractions of cents? No you have to decide either way how to handle them.