[LCP]Linux sin() code
Angus Mackay
amackay at gusnet.cx
Mon Mar 11 15:13:05 UTC 2002
on x86 it is just "fldl" then "fsin" asm calls:
(amackay at ess4)~$ ar x /usr/lib/libm.a s_sin.o
(amackay at ess4)~$ objdump --disassemble-all s_sin.o
s_sin.o: file format elf32-i386
Disassembly of section .text:
00000000 <__sin>:
0: dd 44 24 04 fldl 0x4(%esp,1)
4: d9 fe fsin
6: df e0 fnstsw
8: a9 00 04 00 00 testl $0x400,%eax
d: 75 01 jne 10 <__sin+0x10>
f: c3 ret
10: d9 eb fldpi
12: d8 c0 fadd %st(0),%st
14: d9 c9 fxch %st(1)
16: d9 f5 fprem1
18: df e0 fnstsw
1a: a9 00 04 00 00 testl $0x400,%eax
1f: 75 f5 jne 16 <__sin+0x16>
21: dd d9 fstp %st(1)
23: d9 fe fsin
25: c3 ret
Disassembly of section .data:
if you want a emulated sin() that uses integer math then I think GNU libc has
one.
cheers, Angus.
It would seem that Mohd Saifullah (saif at lantana.tenet.res.in) said:
> Can some one help me in getting the sin() (math sine function) function
> complete code. I mean the complete function with all expansions.
More information about the linuxCprogramming
mailing list