Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7Sr2zcoRD2watXv1G
18 lines
745 B
Plaintext
18 lines
745 B
Plaintext
value %.1f %.2f exact binary value BigDecimal(HALF_EVEN,2)
|
|
0.125 0.1 0.13 0.125 0.12
|
|
0.25 0.3 0.25 0.25 0.25
|
|
0.35 0.4 0.35 0.34999999999999997779 0.35
|
|
2.675 2.7 2.68 2.67499999999999982236 2.67
|
|
1.005 1.0 1.01 1.00499999999999989341 1.00
|
|
0.5 0.5 0.50 0.5 0.50
|
|
1.5 1.5 1.50 1.5 1.50
|
|
2.5 2.5 2.50 2.5 2.50
|
|
|
|
== %.0f on halves: HALF_UP, away from zero ==
|
|
1 2 3 -3
|
|
|
|
== same number, three routes: %f rounds what it is given ==
|
|
double 2.675 -> 2.68
|
|
new BigDecimal("2.675") -> 2.68
|
|
new BigDecimal(2.675) -> 2.67
|