2009-04-19 17:13:29 +02:00
|
|
|
//***************************************************************************
|
|
|
|
// include/cxx/cmath
|
|
|
|
//
|
2021-02-03 11:33:49 +01:00
|
|
|
// Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
// contributor license agreements. See the NOTICE file distributed with
|
|
|
|
// this work for additional information regarding copyright ownership. The
|
|
|
|
// ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance with the
|
|
|
|
// License. You may obtain a copy of the License at
|
2009-04-19 17:13:29 +02:00
|
|
|
//
|
2021-02-03 11:33:49 +01:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2009-04-19 17:13:29 +02:00
|
|
|
//
|
2021-02-03 11:33:49 +01:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing permissions and limitations
|
|
|
|
// under the License.
|
2009-04-19 17:13:29 +02:00
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_CXX_CMATH
|
|
|
|
#define __INCLUDE_CXX_CMATH
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
// Included Files
|
|
|
|
//***************************************************************************
|
|
|
|
|
2012-11-03 16:48:03 +01:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/compiler.h>
|
|
|
|
|
2009-04-19 17:13:29 +02:00
|
|
|
#include <math.h>
|
|
|
|
|
2024-05-15 15:56:28 +02:00
|
|
|
#undef signbit
|
|
|
|
#undef fpclassify
|
|
|
|
#undef isfinite
|
|
|
|
#undef isinf
|
|
|
|
#undef isnan
|
|
|
|
|
2009-04-19 17:13:29 +02:00
|
|
|
//***************************************************************************
|
|
|
|
// Namespace
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
2020-06-30 17:42:07 +02:00
|
|
|
using ::float_t;
|
2020-06-28 08:04:30 +02:00
|
|
|
using ::double_t;
|
|
|
|
|
2015-09-01 15:04:09 +02:00
|
|
|
#ifdef CONFIG_HAVE_FLOAT
|
2012-11-03 16:48:03 +01:00
|
|
|
using ::acosf;
|
|
|
|
using ::asinf;
|
|
|
|
using ::atanf;
|
|
|
|
using ::atan2f;
|
|
|
|
using ::ceilf;
|
|
|
|
using ::cosf;
|
|
|
|
using ::coshf;
|
|
|
|
using ::expf;
|
2024-07-11 15:11:46 +02:00
|
|
|
using ::expm1f;
|
2012-11-03 16:48:03 +01:00
|
|
|
using ::fabsf;
|
|
|
|
using ::floorf;
|
|
|
|
using ::fmodf;
|
|
|
|
using ::frexpf;
|
|
|
|
using ::ldexpf;
|
|
|
|
using ::logf;
|
2024-05-15 15:56:28 +02:00
|
|
|
using ::log1pf;
|
2012-11-03 16:48:03 +01:00
|
|
|
using ::log10f;
|
|
|
|
using ::log2f;
|
|
|
|
using ::modff;
|
2024-07-11 15:11:46 +02:00
|
|
|
using ::rintf;
|
2012-12-07 17:00:56 +01:00
|
|
|
using ::roundf;
|
2012-11-03 16:48:03 +01:00
|
|
|
using ::powf;
|
|
|
|
using ::sinf;
|
|
|
|
using ::sinhf;
|
|
|
|
using ::sqrtf;
|
|
|
|
using ::tanf;
|
|
|
|
using ::tanhf;
|
2017-08-08 15:01:33 +02:00
|
|
|
using ::gamma;
|
|
|
|
using ::lgamma;
|
2024-05-15 15:56:28 +02:00
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
signbit(float __x)
|
|
|
|
{ return __builtin_signbit(__x); }
|
|
|
|
|
|
|
|
constexpr int
|
|
|
|
fpclassify(float __x)
|
|
|
|
{ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
|
|
|
|
FP_SUBNORMAL, FP_ZERO, __x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isfinite(float __x)
|
|
|
|
{ return __builtin_isfinite(__x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isinf(float __x)
|
|
|
|
{ return __builtin_isinf(__x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isnan(float __x)
|
|
|
|
{ return __builtin_isnan(__x); }
|
|
|
|
|
|
|
|
|
2012-11-03 16:48:03 +01:00
|
|
|
#endif
|
|
|
|
|
2015-09-01 15:04:09 +02:00
|
|
|
#ifdef CONFIG_HAVE_DOUBLE
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::acos;
|
|
|
|
using ::asin;
|
|
|
|
using ::atan;
|
|
|
|
using ::atan2;
|
|
|
|
using ::ceil;
|
|
|
|
using ::cos;
|
|
|
|
using ::cosh;
|
|
|
|
using ::exp;
|
2024-07-11 15:11:46 +02:00
|
|
|
using ::expm1f;
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::fabs;
|
|
|
|
using ::floor;
|
|
|
|
using ::fmod;
|
|
|
|
using ::frexp;
|
|
|
|
using ::ldexp;
|
|
|
|
using ::log;
|
2024-05-15 15:56:28 +02:00
|
|
|
using ::log1p;
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::log10;
|
2012-11-03 16:48:03 +01:00
|
|
|
using ::log2;
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::modf;
|
2024-07-11 15:11:46 +02:00
|
|
|
using ::rint;
|
2012-12-07 17:00:56 +01:00
|
|
|
using ::round;
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::pow;
|
|
|
|
using ::sin;
|
|
|
|
using ::sinh;
|
|
|
|
using ::sqrt;
|
|
|
|
using ::tan;
|
|
|
|
using ::tanh;
|
2024-05-15 15:56:28 +02:00
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
signbit(double __x)
|
|
|
|
{ return __builtin_signbit(__x); }
|
|
|
|
|
|
|
|
constexpr int
|
|
|
|
fpclassify(double __x)
|
|
|
|
{ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
|
|
|
|
FP_SUBNORMAL, FP_ZERO, __x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isfinite(double __x)
|
|
|
|
{ return __builtin_isfinite(__x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isinf(double __x)
|
|
|
|
{ return __builtin_isinf(__x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isnan(double __x)
|
|
|
|
{ return __builtin_isnan(__x); }
|
|
|
|
|
2012-11-03 16:48:03 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
|
|
|
using ::acosl;
|
|
|
|
using ::asinl;
|
|
|
|
using ::atanl;
|
|
|
|
using ::atan2l;
|
|
|
|
using ::ceill;
|
|
|
|
using ::cosl;
|
|
|
|
using ::coshl;
|
|
|
|
using ::expl;
|
|
|
|
using ::fabsl;
|
|
|
|
using ::floorl;
|
|
|
|
using ::fmodl;
|
|
|
|
using ::frexpl;
|
|
|
|
using ::ldexpl;
|
|
|
|
using ::logl;
|
2024-05-15 15:56:28 +02:00
|
|
|
using ::log1pl;
|
2012-11-03 16:48:03 +01:00
|
|
|
using ::log10l;
|
|
|
|
using ::log2l;
|
|
|
|
using ::modfl;
|
2012-12-07 17:00:56 +01:00
|
|
|
using ::roundl;
|
2012-11-03 16:48:03 +01:00
|
|
|
using ::powl;
|
|
|
|
using ::sinl;
|
|
|
|
using ::sinhl;
|
|
|
|
using ::sqrtl;
|
|
|
|
using ::tanl;
|
|
|
|
using ::tanhl;
|
2024-05-15 15:56:28 +02:00
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
signbit(long double __x)
|
|
|
|
{ return __builtin_signbit(__x); }
|
|
|
|
|
|
|
|
constexpr int
|
|
|
|
fpclassify(long double __x)
|
|
|
|
{ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
|
|
|
|
FP_SUBNORMAL, FP_ZERO, __x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isfinite(long double __x)
|
|
|
|
{ return __builtin_isfinite(__x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isinf(long double __x)
|
|
|
|
{ return __builtin_isinf(__x); }
|
|
|
|
|
|
|
|
constexpr bool
|
|
|
|
isnan(long double __x)
|
|
|
|
{ return __builtin_isnan(__x); }
|
|
|
|
|
2012-11-03 16:48:03 +01:00
|
|
|
#endif
|
|
|
|
|
2009-04-19 17:13:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __INCLUDE_CXX_CMATH
|