Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
-vim-350969dTook me a good minute to understand this was a rounding thing!
Edit: wait! Does this literally round up 1.000001 to 2
nanoandrew4199869dUhhh since you're working with Double, can't you use the Math class? Or am I missing something here... That just seems very inefficient...
JohnScott193668dI feel like I need PEMDAS to unscramble some of this.
lindgrenj633367d@-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
karasube26Big event. Massive traffic in production, so we were monitoring all night. I was in a room with 2 devs of my ...
stackodev17Manager: “We need you to stay in the room and not go outside to make personal calls on your mobile.” Me: ...
dfox10I’ve had a good amount of incompetent co-workers in the past. One that stands out was this junior developer ...