please tell me what to do in this code:
UnicodeString Str;
double x, y;
double z1, z2;
x= 2.0;
y= 5.0;
z1= x/y;
z2= x/y;
if(z1>z2)
Str= "> not ok\n";
else
Str= "> ok\n";
Application->MessageBox(Str.c_str(), L"Info", MB_OK);
The result is ">not ok". Why????
it should be z1>z2= false; but it is true.
if i use the standard compiler than it is ok. But the clang compiler give wrong result.
the disassemble using CLang compiler (gives wrong result):
Unit1.cpp.24: if(z1>z2)
00403D7B DD8568FFFFFF fld qword ptr [ebp-$00000098]
00403D81 DFE9 fucomip st(1)
00403D83 DDD8 fstp st(0)
00403D85 0F86E7000000 jbe $00403e72
00403D8B EB00 jmp $00403d8d
00403D8D 8B45B0 mov eax,[ebp-$50]
the disassemble using Standard compiler (gives right result):
Unit1.cpp.24: if(z1>z2)
004031C7 DD45AC fld qword ptr [ebp-$54]
004031CA DD45A4 fld qword ptr [ebp-$5c]
004031CD D9C9 fxch st(1)
004031CF DAE9 fucompp
004031D1 DFE0 fstsw ax
004031D3 F6C445 test ah,$45
004031D6 753D jnz $00403215