Discussion:
Another question about precision
(too old to reply)
Tony R
2010-05-25 07:23:17 UTC
Permalink
This is the output from Money.out

Command: -$2.22
== -$2.23

Command: -$2.22 a
== -2.230

Command: -$1.11
== -$1.12

Command: -$1.11 a
== -1.120

Command: -$3.22
== -$3.22

Command: -$3.22 a
== -3.220

Command: $-.12
== -$0.12

Command: $.12 a
== 0.120

Command: -$1.01 d
== -$2.00

Command: $1.01 d
== $1.00

Command: -$0.01 d
== -$1.00


Are we supposed to follow this output?

(PreciseMoney.out has sane outputs)
Joanne Atlee
2010-05-25 12:08:05 UTC
Permalink
You needn't try to emulate this output.

This problem occurs in Money.out because the input values are read into
a variable of double type, and the double type cannot precisely
represent all number values.

We won't be testing your programs on input values that cannot be
represented precisely as a double.

Jo
Post by Tony R
This is the output from Money.out
Command: -$2.22
== -$2.23
Command: -$2.22 a
== -2.230
Command: -$1.11
== -$1.12
Command: -$1.11 a
== -1.120
Command: -$3.22
== -$3.22
Command: -$3.22 a
== -3.220
Command: $-.12
== -$0.12
Command: $.12 a
== 0.120
Command: -$1.01 d
== -$2.00
Command: $1.01 d
== $1.00
Command: -$0.01 d
== -$1.00
Are we supposed to follow this output?
(PreciseMoney.out has sane outputs)
Loading...