This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Conversion (unsigned int)double incorrect.

I'm calculate sin by table.

Example fragment code bellow

....
#define Tabl_acos 0x80000000
...
...
double tsin (double arg)
{ double argout;
unsigned int *adr;

adr = (unsigned int *)((unsigned int)Tabl_sin + (unsigned int)fabs(arg)*400); argout = *(double *)adr; return (argout);
}

If I'm write
... + (unsigned int)fabs(arg)*400) -> result correct, but (arg) lose fraction right part and argout lose precition.
If I'm write
... + (unsigned int)(fabs(arg)*400)) -> result incorrect! argout = fantastic value!!!