mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibM: Implement fmin/fmax
This commit is contained in:
parent
987cc904c2
commit
01a49dda85
Notes:
sideshowbarker
2024-07-18 21:19:13 +09:00
Author: https://github.com/RealKC
Commit: 01a49dda85
Pull-request: https://github.com/SerenityOS/serenity/pull/5807
Reviewed-by: https://github.com/awesomekling
3 changed files with 81 additions and 0 deletions
|
@ -1364,4 +1364,64 @@ long double scalblnl(long double x, long exponent) NOEXCEPT
|
|||
{
|
||||
return internal_scalbn(x, exponent);
|
||||
}
|
||||
|
||||
long double fmaxl(long double x, long double y) NOEXCEPT
|
||||
{
|
||||
if (isnan(x))
|
||||
return y;
|
||||
if (isnan(y))
|
||||
return x;
|
||||
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
double fmax(double x, double y) NOEXCEPT
|
||||
{
|
||||
if (isnan(x))
|
||||
return y;
|
||||
if (isnan(y))
|
||||
return x;
|
||||
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
float fmaxf(float x, float y) NOEXCEPT
|
||||
{
|
||||
if (isnan(x))
|
||||
return y;
|
||||
if (isnan(y))
|
||||
return x;
|
||||
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
long double fminl(long double x, long double y) NOEXCEPT
|
||||
{
|
||||
if (isnan(x))
|
||||
return y;
|
||||
if (isnan(y))
|
||||
return x;
|
||||
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
double fmin(double x, double y) NOEXCEPT
|
||||
{
|
||||
if (isnan(x))
|
||||
return y;
|
||||
if (isnan(y))
|
||||
return x;
|
||||
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
float fminf(float x, float y) NOEXCEPT
|
||||
{
|
||||
if (isnan(x))
|
||||
return y;
|
||||
if (isnan(y))
|
||||
return x;
|
||||
|
||||
return x < y ? x : y;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue