Visa ett inlägg
Oläst 2006-07-30, 13:40 #5
lloigor lloigor är inte uppkopplad
Nykomling
 
Reg.datum: Jul 2006
Inlägg: 3
lloigor lloigor är inte uppkopplad
Nykomling
 
Reg.datum: Jul 2006
Inlägg: 3
Klipper in en snutt av artikeln

Citat:
Binary floating-point cannot exactly represent decimal fractions, so if binary floating-point is used it is not possible to guarantee that results will be the same as those using decimal arithmetic. This makes it extremely difficult to develop and test applications that use exact real-world data, such as commercial and financial values.
...
For example, using the Java or C double datatype, 0.1 × 8 (a binary multiple) gives the result 0.800000000000000044408920985006261616945266723632 8125 but 0.1 added to itself 8 times gives the different answer 0.799999999999999933386618522490607574582099914550 78125. The two results would not compare equal, and further, if these values are multiplied by ten and rounded to the nearest integer below (the ‘floor’ function), the result will be 8 in one case and 7 in the other.
så decimal eller t.om. att räkna pengar i heltals-ören är bättre. Det blir små pengar oftast, om man inte har ohyggligt mycket transaktioner, men det räcker ju för att sabba bokföringen.
lloigor är inte uppkopplad   Svara med citatSvara med citat