Groups > Borland > Borland Delphi migration > Re: BC 3.1 float division <> Delphi 2005 Single division




BC 3.1 float division <> Delphi 2005 Single division

BC 3.1 float division <> Delphi 2005 Single division
9 May 2007 16:29:40 -0700
In upgrading code written in Borland C++ 3.1 to Delphi 2005, I
have found subtle differences in the results of a division of the
form:

A = (B - C) / I;

where A, B, and C are floats in C or Singles in Delphi and I is
an int or Integer (I is 2).  Some of the results differ in the
least significant digit.  I know that the '/' operator is defined
differently in C and Delphi, but all floating point operations
ought to be done in the 8087 in extended precision, so why is
there a difference in A depending on the development system?

Can Delphi be forced to produce the same result as the old 
system?

I do not have access to BC++, only the compiled application.

Post Reply
Re: BC 3.1 float division <> Delphi 2005 Single division
15 May 2007 07:40:03 -0700
The 16 bit code is using win87em.dll. The version of the DLL in
the \System directory gives slightly different results than the
8087, but the newer version in \System32 agrees with the 
hardware.

John

"John Algeo" <john@algeoconsulting.com> wrote:
>
>In upgrading code written in Borland C++ 3.1 to Delphi 2005, I
>have found subtle differences in the results of a division of the
>form:
>
>A = (B - C) / I;
>
>where A, B, and C are floats in C or Singles in Delphi and I is
>an int or Integer (I is 2).  Some of the results differ in the
>least significant digit.  I know that the '/' operator is defined
>differently in C and Delphi, but all floating point operations
>ought to be done in the 8087 in extended precision, so why is
>there a difference in A depending on the development system?
>
>Can Delphi be forced to produce the same result as the old 
>system?
>
>I do not have access to BC++, only the compiled application.
>
>John
Post Reply
about | contact