mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibM: Implement copysign for float and long double
This commit is contained in:
parent
87b61b0eef
commit
b274120b3c
2 changed files with 26 additions and 8 deletions
|
@ -289,6 +289,17 @@ static FloatT internal_scalbn(FloatT x, int exponent) NOEXCEPT
|
||||||
return extractor.d;
|
return extractor.d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename FloatT>
|
||||||
|
static FloatT internal_copysign(FloatT x, FloatT y) NOEXCEPT
|
||||||
|
{
|
||||||
|
using Extractor = FloatExtractor<FloatT>;
|
||||||
|
Extractor ex, ey;
|
||||||
|
ex.d = x;
|
||||||
|
ey.d = y;
|
||||||
|
ex.sign = ey.sign;
|
||||||
|
return ex.d;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
double trunc(double x) NOEXCEPT
|
double trunc(double x) NOEXCEPT
|
||||||
|
@ -845,14 +856,19 @@ long double nexttowardl(long double, long double) NOEXCEPT
|
||||||
TODO();
|
TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
double copysign(double x, double y)
|
float copysignf(float x, float y) NOEXCEPT
|
||||||
{
|
{
|
||||||
using Extractor = FloatExtractor<decltype(x)>;
|
return internal_copysign(x, y);
|
||||||
Extractor ex, ey;
|
}
|
||||||
ex.d = x;
|
|
||||||
ey.d = y;
|
double copysign(double x, double y) NOEXCEPT
|
||||||
ex.sign = ey.sign;
|
{
|
||||||
return ex.d;
|
return internal_copysign(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
long double copysignl(long double x, long double y) NOEXCEPT
|
||||||
|
{
|
||||||
|
return internal_copysign(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
float scalbnf(float x, int exponent) NOEXCEPT
|
float scalbnf(float x, int exponent) NOEXCEPT
|
||||||
|
|
|
@ -170,6 +170,8 @@ float scalbnlf(float, long) NOEXCEPT;
|
||||||
double scalbln(double, long) NOEXCEPT;
|
double scalbln(double, long) NOEXCEPT;
|
||||||
long double scalblnl(long double, long) NOEXCEPT;
|
long double scalblnl(long double, long) NOEXCEPT;
|
||||||
|
|
||||||
double copysign(double x, double y);
|
float copysignf(float x, float y) NOEXCEPT;
|
||||||
|
double copysign(double x, double y) NOEXCEPT;
|
||||||
|
long double copysignl(long double x, long double y) NOEXCEPT;
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue