Skip to content

Commit

Permalink
Added f and l versions of math functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxSagebaum committed Oct 13, 2023
1 parent b04f45e commit 6ba78b1
Show file tree
Hide file tree
Showing 10 changed files with 409 additions and 872 deletions.
88 changes: 86 additions & 2 deletions include/codi/expressions/real/binaryOperators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ namespace codi {
};
#define OPERATION_LOGIC OperationAtan2
#define FUNCTION atan2
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationAtan2
#define FUNCTION atan2f
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationAtan2
#define FUNCTION atan2l
#include "binaryOverloads.tpp"

/// BinaryOperation implementation for copysign
Expand Down Expand Up @@ -313,6 +321,10 @@ namespace codi {

#define OPERATION_LOGIC OperationCopysign
#define FUNCTION copysignf
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationCopysign
#define FUNCTION copysignl
#include "binaryOverloads.tpp"

/// BinaryOperation implementation for fmod
Expand Down Expand Up @@ -357,6 +369,10 @@ namespace codi {

#define OPERATION_LOGIC OperationFmod
#define FUNCTION fmodf
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationFmod
#define FUNCTION fmodl
#include "binaryOverloads.tpp"

/// BinaryOperation implementation for frexp
Expand Down Expand Up @@ -411,6 +427,18 @@ namespace codi {
#define FUNCTION frexp
#define SECOND_ARG_TYPE int*
#define SECOND_ARG_CONVERSION IntPointerConversion
#include "binaryFirstArgumentOverloads.tpp"

#define OPERATION_LOGIC OperationFrexp
#define FUNCTION frexpf
#define SECOND_ARG_TYPE int*
#define SECOND_ARG_CONVERSION IntPointerConversion
#include "binaryFirstArgumentOverloads.tpp"

#define OPERATION_LOGIC OperationFrexp
#define FUNCTION frexpl
#define SECOND_ARG_TYPE int*
#define SECOND_ARG_CONVERSION IntPointerConversion
#include "binaryFirstArgumentOverloads.tpp"

/// BinaryOperation implementation for hypot
Expand Down Expand Up @@ -467,13 +495,14 @@ namespace codi {
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationHypot
#define FUNCTION hypotl
#define FUNCTION hypotf
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationHypot
#define FUNCTION hypotf
#define FUNCTION hypotl
#include "binaryOverloads.tpp"


/// BinaryOperation implementation for ldexp
template<typename T_Real>
struct OperationLdexp : public BinaryOperation<T_Real> {
Expand Down Expand Up @@ -507,6 +536,18 @@ namespace codi {
#define FUNCTION ldexp
#define SECOND_ARG_TYPE int
#define SECOND_ARG_CONVERSION ConstantDataConversion
#include "binaryFirstArgumentOverloads.tpp"

#define OPERATION_LOGIC OperationLdexp
#define FUNCTION ldexpl
#define SECOND_ARG_TYPE int
#define SECOND_ARG_CONVERSION ConstantDataConversion
#include "binaryFirstArgumentOverloads.tpp"

#define OPERATION_LOGIC OperationLdexp
#define FUNCTION ldexpf
#define SECOND_ARG_TYPE int
#define SECOND_ARG_CONVERSION ConstantDataConversion
#include "binaryFirstArgumentOverloads.tpp"

/// BinaryOperation implementation for max
Expand Down Expand Up @@ -555,6 +596,14 @@ namespace codi {

#define OPERATION_LOGIC OperationMax
#define FUNCTION fmax
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationMax
#define FUNCTION fmaxf
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationMax
#define FUNCTION fmaxl
#include "binaryOverloads.tpp"

/// BinaryOperation implementation for min
Expand Down Expand Up @@ -602,6 +651,14 @@ namespace codi {

#define OPERATION_LOGIC OperationMin
#define FUNCTION fmin
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationMin
#define FUNCTION fminf
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationMin
#define FUNCTION fminl
#include "binaryOverloads.tpp"

/// BinaryOperation implementation for pow
Expand Down Expand Up @@ -664,6 +721,10 @@ namespace codi {

#define OPERATION_LOGIC OperationPow
#define FUNCTION powf
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationPow
#define FUNCTION powl
#include "binaryOverloads.tpp"

/// BinaryOperation implementation for remainder
Expand Down Expand Up @@ -712,6 +773,14 @@ namespace codi {
};
#define OPERATION_LOGIC OperationRemainder
#define FUNCTION remainder
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationRemainder
#define FUNCTION remainderf
#include "binaryOverloads.tpp"

#define OPERATION_LOGIC OperationRemainder
#define FUNCTION remainderl
#include "binaryOverloads.tpp"

/// @}
Expand All @@ -734,21 +803,36 @@ namespace codi {

namespace std {
using codi::atan2;
using codi::atan2f;
using codi::atan2l;
using codi::copysign;
using codi::copysignf;
using codi::copysignl;
using codi::fmax;
using codi::fmaxf;
using codi::fmaxl;
using codi::fmin;
using codi::fminf;
using codi::fminl;
using codi::fmod;
using codi::fmodf;
using codi::fmodl;
using codi::frexp;
using codi::frexpf;
using codi::frexpl;
using codi::hypot;
using codi::hypotf;
using codi::hypotl;
using codi::ldexp;
using codi::ldexpf;
using codi::ldexpl;
using codi::max;
using codi::min;
using codi::pow;
using codi::powf;
using codi::powl;
using codi::remainder;
using codi::remainderf;
using codi::remainderl;
using codi::swap;
}
Loading

0 comments on commit 6ba78b1

Please sign in to comment.