mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-29 04:39:10 +00:00
LibM: Use fcos for cosine
For some reason we were using sin(x+M_PI_2) instead
This commit is contained in:
parent
fdb5367da1
commit
119f280f34
Notes:
sideshowbarker
2024-07-18 10:20:33 +09:00
Author: https://github.com/Hendiadyoin1
Commit: 119f280f34
Pull-request: https://github.com/SerenityOS/serenity/pull/8459
1 changed files with 23 additions and 6 deletions
|
@ -357,23 +357,40 @@ long double truncl(long double x) NOEXCEPT
|
|||
|
||||
long double cosl(long double angle) NOEXCEPT
|
||||
{
|
||||
return sinl(angle + M_PI_2);
|
||||
long double ret = 0.0;
|
||||
asm(
|
||||
"fcos"
|
||||
: "=t"(ret)
|
||||
: "0"(angle));
|
||||
return ret;
|
||||
}
|
||||
|
||||
double cos(double angle) NOEXCEPT
|
||||
{
|
||||
return sin(angle + M_PI_2);
|
||||
double ret = 0.0;
|
||||
asm(
|
||||
"fcos"
|
||||
: "=t"(ret)
|
||||
: "0"(angle));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
float cosf(float angle) NOEXCEPT
|
||||
{
|
||||
return sinf(angle + static_cast<float>(M_PI_2));
|
||||
float ret = 0.0;
|
||||
asm(
|
||||
"fcos"
|
||||
: "=t"(ret)
|
||||
: "0"(angle));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
long double sinl(long double angle) NOEXCEPT
|
||||
{
|
||||
long double ret = 0.0;
|
||||
__asm__(
|
||||
asm(
|
||||
"fsin"
|
||||
: "=t"(ret)
|
||||
: "0"(angle));
|
||||
|
@ -388,7 +405,7 @@ long double sinl(long double angle) NOEXCEPT
|
|||
double sin(double angle) NOEXCEPT
|
||||
{
|
||||
double ret = 0.0;
|
||||
__asm__(
|
||||
asm(
|
||||
"fsin"
|
||||
: "=t"(ret)
|
||||
: "0"(angle));
|
||||
|
@ -399,7 +416,7 @@ double sin(double angle) NOEXCEPT
|
|||
float sinf(float angle) NOEXCEPT
|
||||
{
|
||||
float ret = 0.0f;
|
||||
__asm__(
|
||||
asm(
|
||||
"fsin"
|
||||
: "=t"(ret)
|
||||
: "0"(angle));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue