Skip to content

Commit

Permalink
LibM: Add nan{f, l}
Browse files Browse the repository at this point in the history
  • Loading branch information
RealKC authored and awesomekling committed Mar 9, 2021
1 parent efe4845 commit b07310d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Userland/Libraries/LibM/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,21 @@ static FloatT internal_copysign(FloatT x, FloatT y) NOEXCEPT

extern "C" {

float nanf(const char* s) NOEXCEPT
{
return __builtin_nanf(s);
}

double nan(const char* s) NOEXCEPT
{
return __builtin_nan(s);
}

long double nanl(const char* s) NOEXCEPT
{
return __builtin_nanl(s);
}

double trunc(double x) NOEXCEPT
{
return internal_to_integer(x, RoundingMode::ToZero);
Expand Down
4 changes: 4 additions & 0 deletions Userland/Libraries/LibM/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ __BEGIN_DECLS
#define DOUBLE_MAX ((double)0b0111111111101111111111111111111111111111111111111111111111111111)
#define DOUBLE_MIN ((double)0b0000000000010000000000000000000000000000000000000000000000000000)

long double nanl(const char*) NOEXCEPT;
double nan(const char*) NOEXCEPT;
float nanf(const char*) NOEXCEPT;

double acos(double) NOEXCEPT;
float acosf(float) NOEXCEPT;
double asin(double) NOEXCEPT;
Expand Down

0 comments on commit b07310d

Please sign in to comment.