flat assembler
Message board for the users of flat assembler.
Index
> Main > FPU Questions. |
Author |
|
cod3b453 22 Nov 2011, 21:57
The FPU has 4 possible rounding modes that can be configured using the control word (fldcw/fstcw) and applied using the frndint instruction. In some cases you will need to adjust the value before rounding e.g. ceiling/floor add/sub 0.5 before rounding.
The FPU only has signed representation but you can load a 32bit unsigned as a 64bit signed integer by padding the upper dword with 0; otherwise you have to explicitly convert the unsigned value in the FPU. The instructions ending with "-p" pop from the FPU stack and in some cases double pop (fcompp); there is also the fdecstp and finstp instructions. |
|||
22 Nov 2011, 21:57 |
|
AsmGuru62 22 Nov 2011, 22:10
FSIN parameter is in Radians (as per Intel Manual), so SIN 90 in your case is a sin(90 rads). That is why it is 0.8993...
A proper SIN(90) would be this one: Code: FLDPI PUSH 2 FIDIV DWORD [ESP] ADD ESP,4 FSIN ; ; NOW ST0 = SIN(90 degrees) ; To pop the stack without storing is this: Code: FSTP ST0 ; Sweet! We're still storing! |
|||
22 Nov 2011, 22:10 |
|
Overflowz 23 Nov 2011, 07:38
Thank you guys!
|
|||
23 Nov 2011, 07:38 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.