- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I've written versions of
formatNumberWithCommas
in different environments(1), but I've never had the urge to format the part after the decimal point.(1) Including one that (theoretically) takes into account the full gamut of commafication that can be expressed in the Windows locale APIs.(2) That was ... painful.
(2) It's capable of expressing simple stuff like traditional Indian lakhs and crores, all the way up to as elaborate as you'd like.
Admin
Now we know how Python achieved its very undeserved popularity.
Admin
People who use floating point to represent money should receive 38.9999999999999999995959493 lashes.
Admin
Darn it, any handling of money as floating-point numbers is a red flag, but for a budget making app it ought to be a death call.
Admin
Yes, if you are going to use separators in the decimal part (which is unusual), the digits should be grouped in threes starting from the decimal point like: "$1,290.139,999,999,9"
But that's only the third thing this programmer got wrong.
(1) Using floating point for money at all. Add up enough floating point numbers and you get a result that's off by a cent or more. Accountants will notice.
(2) Not rounding off to the customary smallest unit: "$1,290.14". That run on decimal will confuse the heck out of Americans with the usual rudimentary understanding of math. For someone like me that started programming with FORTRAN 2 (IIRC), it just tells me that the programmer doesn't understand what he's doing. What else did he mess up?
(3) Not only displaying what shouldn't have been displayed, but formatting it wrong.
Admin
It says a lot about web developers when the majority of Error'd screenshots are from web apps.
TRWTF is censoring your name in the screenshot, and then having TDWTF post it in the article description anyway.
Admin
And that is why we need certification and licencing. Use floating points for money? Licence revoked, fingers broken so you can't ever code again.
Admin
The price is only going up with the hurricane coming through. ~$14-15/day seems like a lot still... Also, I recommend purchasing more fresh fruits and vegetables at your local grocery store.
At first thought, it's possible the programmer simply converted the decimal to a float at the last minute so they could use the display formatters, but then didn't use them...
Admin
Who says the blurred out name is the same as the one in the article description?