Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

round

Name: Anonymous 2007-05-17 11:03 ID:ewt37wAw

Prelude> round 0.5
0
Prelude> round 1.5
2
Prelude> round 2.5
2
Prelude> round 3.5
4


WHAT THE FUCK

Name: Anonymous 2007-05-20 14:39 ID:FThWZ74W

>>30

I think you'd be surprised how much financial code is implemented using floating point, especially in software for small and medium businesses. It's fine unless you're handling huge amounts that can't be accurately stored by the precision available.

But yes, ideally you should implement currency calculations as integer calculations in the smallest denomination (e.g. cents, pennies etc)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List