Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
-vim-342711dTook me a good minute to understand this was a rounding thing!
Edit: wait! Does this literally round up 1.000001 to 2
nanoandrew4173411dUhhh since you're working with Double, can't you use the Math class? Or am I missing something here... That just seems very inefficient...
JohnScott173711dI feel like I need PEMDAS to unscramble some of this.
@-vim- yes - sorry There was one part I was forgetting that I just remembered. They were doing this on the Double:
So they were using String.format() to get 2 decimal places rather than using BigDecimal's ability to set a rounding factor <facepalm>
@nanoandrew4: yes that was my suggestion, Math.ceil() on the BigDecimal after setting the rounding factor to 2. Apparently that's too complicated though <shrug>
@JohnScott: LOL yes, basically it was this,
1. Multiply price by point factor (eg 2%)
2. Convert double amount to string with 2 decimal places
3. Split String by decimal point, using first element in array as point value, and adding one if the second element in the array isn't 0.
It was so terrible. The rage was strong. When I fought to get it changed to something a bit more sane like Math.ceil() and she didn't agree is honestly when I lost a lot of respect from an angineering standpoint.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job
karasube21Big event. Massive traffic in production, so we were monitoring all night. I was in a room with 2 devs of my ...
dfox10I’ve had a good amount of incompetent co-workers in the past. One that stands out was this junior developer ...
JMoodyFWD14I absolutely HATE "web developers" who call you in to fix their FooBar'd mess, yet can't stop themselves from ...