DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦6e2f9f14f⟧ TextFile

    Length: 1152 (0x480)
    Types: TextFile
    Names: »BCD.PAS«

Derivation

└─⟦5e4548e7d⟧ Bits:30005778 Turbo Pascal v.3.01A (CP/M-86)
    └─ ⟦this⟧ »BCD.PAS« 

TextFile

Program PrecisionDemo;
æ
            BCD DEMONSTRATION PROGRAM  Version 1.00A

   This program demonstrates the increase in precision gained
   by using TURBOBCD.  Monetary calculations done in floating
   point lose precision because there is no precise binary
   representation for any power of 1/10 (.1, .01, etc).  Binary
   coded decimals perform all calculations in decimal and thus
   are more precise for financial applications.

   INSTRUCTIONS
   1. Compile and run this program using TURBOBCD.COM.  Note that
      the results are all zero.
   2. Compile and run this program using TURBO.COM and compare
      the results with (1) above.
å

Begin
  ClrScr;
  WriteLn('Each of the following calculations should result in zero:');
  Writeln;
  WriteLn('(((1234.99 - 1235.0) * 10000.0) + 100.0) * 100000.0 = ',
           ((1234.99-1235.0)*10000.0+100.0)*100000.0:1:20);
  WriteLn('((1/5) * 5) - 1                                     = ',
           1/5*5-1:1:20);
  WriteLn('1.34 + 1.66 - 3.0                                   = ',
           1.34+1.66-3.0:1:20);
End.

«eof»