PROGRAM pentium1 (INPUT, OUTPUT); {$N+} {needed so that 80x87 code is generated} {$E+} {needed to test emulator when 80x87 chip turned off} { Dr. John Nagy, Brookhaven Nat'l Lab, Upton NY v 1.0 20 December 1994 Original Ref.: Borland Pascal with Objects 7.0, Language Guide, Chapter 15 } {Bob Simons, CoHort Software, changed program name also, program based on info in Inforworld article} VAR var_single: RECORD a,b,c, y1,y2,p: Single; END; {IEEE 4-byte, 7-8 significant} var_double: RECORD a,b,c, y1,y2,p: Double; END; {IEEE 8-byte, 15-16 significant} var_real : RECORD a,b,c, y1,y2,p: REAL ; END; {Borland 6-byte, 11-12 significant} BEGIN WRITELN; WRITELN ('Program Pentium1: Run infamous Pentium test in TurboPascal 7'); WRITELN ('------------------------------------------------------------'); WRITELN; WRITELN ('*** Use twice, with DOS command SET 87=N and SET 87=Y ***'); {See what the Borland Test8087 variable has to say.} WRITELN; WRITE ('Test8087 = ', Test8087:1, ': '); CASE Test8087 OF 0: WRITELN ('No coprocessor detected'); 1: WRITELN ('8087 detected'); 2: WRITELN ('80287 detected'); 3: WRITELN ('80387 or 80487 detected') Else WRITELN ('<-- this value not in TP7 manual!'); END; {case} WRITELN; {Do test using different precision starting variables. Output A - (A/B)*B where A, B from InfoWorld article. } WRITE ('Using '); IF Test8087 = 0 THEN WRITELN ('emulation and...') ELSE WRITELN ('80x87 and...'); {Start with 4-byte floating point numbers and evaluate} WITH var_single DO BEGIN a := 4195835.0; b := 3145727.0; y1 := b; {trying to fool optimizer} p := a/y1; y2 := b; c := p*y2; WRITELN (' single precision input. Error = ', (a-c)); END; {single} {Start with 6-byte floating point numbers and evaluate} WITH var_real DO BEGIN a := 4195835.0; b := 3145727.0; y1 := b; {trying to fool optimizer} p := a/y1; y2 := b; c := p*y2; WRITELN (' Borland precision input. Error = ', (a-c)); END; {real} {Start with 8-byte floating point numbers and evaluate} WITH var_double DO BEGIN a := 4195835.0; b := 3145727.0; y1 := b; {trying to fool optimizer} p := a/y1; y2 := b; c := p*y2; WRITELN (' double precision input. Error = ', (a-c)); END; {double} END. {program 'Pentium1'}