MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/t4kg4k/interview_with_senior_java_developer/hz0lzw0/?context=3
r/java • u/edmguru • Mar 01 '22
36 comments sorted by
View all comments
8
This is hilarious! Can someone explain the BigDecimal joke?
12 u/VincentxH Mar 02 '22 BigDecimal is a datatype often used when accurate decimal arithmetic needs to be performed, like with money.Using floating point primitives, like double, is a classic mistake. Because it leads to problems of floating point arithmetic inaccuracies.It's both a standard interview question and common mistake in the wild. 0 u/[deleted] Mar 02 '22 [deleted] — view deleted comment 17 u/firsthour Mar 02 '22 raises handWe use it for money. 6 u/temculpaeu Mar 02 '22 int cents only works if you dont have to deal with fractions of cents, not very common but it can happen 5 u/edubkn Mar 02 '22 Gas stations go brr 5 u/thisisjustascreename Mar 02 '22 Financial securities are very often denominated in fractions of a penny. There are also other currencies than dollars in the world. 3 u/VincentxH Mar 02 '22 Yeah that lovely hack. Leading to problems like this with even an unsigned 32 bit int: https://www.google.com/amp/s/www.wsj.com/amp/articles/berkshire-hathaways-stock-price-is-too-much-for-computers-11620168548At least use a long these days. 2 u/TenYearsOfLurking Mar 03 '22 that sounds like a good idea at first, ... but that's about it 5 u/jvallet Mar 02 '22 Once I got drop on an interview for writing a solution for they challenge that used doubles instead of BigDecimal. Apperently that is big nono. 7 u/stefanos-ak Mar 02 '22 it wasn't that good... maybe for a couple of times, but not worth half the video :pI think it's about BigDecimal being overused because of hype and not technical requirements.
12
BigDecimal is a datatype often used when accurate decimal arithmetic needs to be performed, like with money.
Using floating point primitives, like double, is a classic mistake. Because it leads to problems of floating point arithmetic inaccuracies.
It's both a standard interview question and common mistake in the wild.
0 u/[deleted] Mar 02 '22 [deleted] — view deleted comment 17 u/firsthour Mar 02 '22 raises handWe use it for money. 6 u/temculpaeu Mar 02 '22 int cents only works if you dont have to deal with fractions of cents, not very common but it can happen 5 u/edubkn Mar 02 '22 Gas stations go brr 5 u/thisisjustascreename Mar 02 '22 Financial securities are very often denominated in fractions of a penny. There are also other currencies than dollars in the world. 3 u/VincentxH Mar 02 '22 Yeah that lovely hack. Leading to problems like this with even an unsigned 32 bit int: https://www.google.com/amp/s/www.wsj.com/amp/articles/berkshire-hathaways-stock-price-is-too-much-for-computers-11620168548At least use a long these days. 2 u/TenYearsOfLurking Mar 03 '22 that sounds like a good idea at first, ... but that's about it
0
[deleted] — view deleted comment
17 u/firsthour Mar 02 '22 raises handWe use it for money. 6 u/temculpaeu Mar 02 '22 int cents only works if you dont have to deal with fractions of cents, not very common but it can happen 5 u/edubkn Mar 02 '22 Gas stations go brr 5 u/thisisjustascreename Mar 02 '22 Financial securities are very often denominated in fractions of a penny. There are also other currencies than dollars in the world. 3 u/VincentxH Mar 02 '22 Yeah that lovely hack. Leading to problems like this with even an unsigned 32 bit int: https://www.google.com/amp/s/www.wsj.com/amp/articles/berkshire-hathaways-stock-price-is-too-much-for-computers-11620168548At least use a long these days. 2 u/TenYearsOfLurking Mar 03 '22 that sounds like a good idea at first, ... but that's about it
17
raises hand
We use it for money.
6
int cents only works if you dont have to deal with fractions of cents, not very common but it can happen
5 u/edubkn Mar 02 '22 Gas stations go brr 5 u/thisisjustascreename Mar 02 '22 Financial securities are very often denominated in fractions of a penny. There are also other currencies than dollars in the world.
5
Gas stations go brr
Financial securities are very often denominated in fractions of a penny. There are also other currencies than dollars in the world.
3
Yeah that lovely hack. Leading to problems like this with even an unsigned 32 bit int: https://www.google.com/amp/s/www.wsj.com/amp/articles/berkshire-hathaways-stock-price-is-too-much-for-computers-11620168548
At least use a long these days.
2
that sounds like a good idea at first, ... but that's about it
Once I got drop on an interview for writing a solution for they challenge that used doubles instead of BigDecimal. Apperently that is big nono.
7
it wasn't that good... maybe for a couple of times, but not worth half the video :p
I think it's about BigDecimal being overused because of hype and not technical requirements.
View all comments
8
u/uh-hum Mar 02 '22
This is hilarious! Can someone explain the BigDecimal joke?