I am coding a procedure in ASM that does some calcs with real numbers.
At the moment I use DQ as parameter data type and I am wondering if this is correct if in C I declare parameter as float. Doesn't REAL8 equal QWORD? Is it what float is? or I should use REAL4 or REAL10 instead?
Also, how should I return result (also float) ??
At the moment I use DQ as parameter data type and I am wondering if this is correct if in C I declare parameter as float. Doesn't REAL8 equal QWORD? Is it what float is? or I should use REAL4 or REAL10 instead?
Also, how should I return result (also float) ??
A float in C is a "df" or "real4" in asm.
A double in C is a "dq" or "real8" in asm.
The extended (real10) is "double double" iirc.
Return value depends on compiler... I think visual C++ expects
the return value as ST(0) .
A double in C is a "dq" or "real8" in asm.
The extended (real10) is "double double" iirc.
Return value depends on compiler... I think visual C++ expects
the return value as ST(0) .
Float is usually REAL4, double is REAL8, and long double is TBYTE/REAL10. Some C compilers return floats on the top of the FPU stack, other actually store the value on the stack().
Edit: f0dder beat me by seconds. ;)
Edit: f0dder beat me by seconds. ;)
I was a bit wrong though it is "long double" and not "double double" :)
Thanks on these fast replies! :D
For this:
Yes and No. It is the same size but consider these two statments:
QuadInt will be inialized to 67 in binary by masm. But QuadReal has to have the decimal point suffix because it will be initialized to 67.0's (Floating Point).
So if you had in a program:
You would get some very funny results indeed.
This is the same for REAL4/DWORD, REAL8/QWORD and REAL10/TBYTE.
Doesn't REAL8 equal QWORD?
Yes and No. It is the same size but consider these two statments:
QuadInt QWORD 67
QuadReal REAL8 67.0
QuadInt will be inialized to 67 in binary by masm. But QuadReal has to have the decimal point suffix because it will be initialized to 67.0's (Floating Point).
So if you had in a program:
.DATA
cConstant QWORD 100
.CODE
GetPercent PROC
fdiv cConstant
You would get some very funny results indeed.
This is the same for REAL4/DWORD, REAL8/QWORD and REAL10/TBYTE.