Assembly code for sin(x) using Taylor expansion

后端 未结 4 1704
一整个雨季
一整个雨季 2021-02-05 15:53

In x86 Linux, how can I implement sin(x) in assembly code using Taylor Expansion?

4条回答
  •  旧巷少年郎
    2021-02-05 16:08

    long double LD_COS(long double __X)
    {
        register long double __VALUE;
    
        __asm__ __volatile__(
            "fcos                  \n\t"
            : "=t" (__VALUE)
            : "0" (__X)
        );
        return __VALUE;
    }
    
    long double LD_SIN(long double __X)
    {
        register long double __VALUE;
    
        __asm__ __volatile__(
            "fsin                  \n\t"
            : "=t" (__VALUE)
            : "0" (__X)
        );
        return __VALUE;
    }
    

提交回复
热议问题