Code: Select all
(long int)sqrt(2.0)
Code: Select all
(long int)floor(sqrt(2.0))
Besta regards
Dominik
Moderator: Board moderators
Code: Select all
(long int)sqrt(2.0)
Code: Select all
(long int)floor(sqrt(2.0))
Code: Select all
const unsigned short int Round_Zero= 0x0000; // towards zero
const unsigned short int Round_Nearest= 0x0C00; // nearest
const unsigned short int Round_Up= 0x0400; // towards+Inf
const unsigned short int Round_Down= 0x0800; // towards -Inf
inline int irint(double f, unsigned short int rm)
{
unsigned short int a1, a2;
int rv;
__asm {
fstcw [a2]
mov ax, [a2]
or ax, 0xE3F
xor ax, [rm]
mov [a1], ax
fldcw [a1]
fld [f]
fistp [rv]
fldcw [a2]
}
return rv;
}
Code: Select all
long int table[X];
int i;
double d = 0.0;
for(i=0;i<X;i++)
{
d += something_with_math_calculation(some_parameters);
table[i] = (long int)sqrt(d); // or something like log(d), I don't remember, but I think that it's not important ...
}
Code: Select all
table[i] = (long int)floor(sqrt(d));