in reply to Re: Okay! What!?!?!?
in thread Okay! What!?!?!?
It's been about 15 years since I've written any Pascal, but here you go...
program floating; var A, B :real; begin A := 14.4e0; B := 10.0e0 + 14.4e0 - 10.0e0; writeln( A ); writeln( B ); if A = B then writeln('they are equal') else writeln('they differ'); end.
Compiled using Free Pascal Compiler 2.6.2-5 (i386), I get the following output:
1.44000000000000E+001 1.44000000000000E+001 they are equal
I don't know if FPC is especially smart at optimizing the mathematical expressions, or especially smart at DWIM output and comparisons on floating point numbers. But it's being smart somehow.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Okay! What!?!?!? (order)
by tye (Sage) on Apr 23, 2014 at 14:32 UTC | |
|
Re^3: Okay! What!?!?!?
by davido (Cardinal) on Apr 23, 2014 at 14:11 UTC |