1 # ifndef CPPAD_CORE_ZDOUBLE_HPP
2 # define CPPAD_CORE_ZDOUBLE_HPP
146 # define CPPAD_ZDOUBLE_NORMAL_ASSIGN_OPERATOR(op) \
147 zdouble& operator op (const zdouble& z) \
151 zdouble& operator op (const double& x) \
160 # define CPPAD_ZDOUBLE_UNARY_OPERATOR(op) \
161 zdouble operator op (void) const \
162 { return zdouble( op dbl_ ); }
169 # define CPPAD_ZDOUBLE_NORMAL_BINARY_OPERATOR(op) \
170 zdouble operator op (const zdouble& z) const \
171 { return zdouble( dbl_ op z.dbl_ ); } \
172 zdouble operator op (const double& x) const \
173 { return zdouble( dbl_ op x ); }
179 # define CPPAD_ZDOUBLE_COMPARE_OPERATOR(op) \
180 bool operator op (const zdouble& z) const \
181 { return dbl_ op z.dbl_; } \
182 bool operator op (const double& x) const \
183 { return dbl_ op x; }
190 # define CPPAD_ZDOUBLE_OTHER_BINARY_OPERATOR(op) \
191 inline zdouble operator op(const double& x, const zdouble& z) \
192 { return zdouble(x) op z; }
201 # define CPPAD_ZDOUBLE_OTHER_COMPARE_OPERATOR(op, op_switch) \
202 inline bool operator op(const double& x, const zdouble& z) \
203 { return z op_switch x; }
209 # define CPPAD_ZDOUBLE_STD_MATH_FRIEND(fun) \
210 friend zdouble fun(const zdouble& z);
215 # define CPPAD_ZDOUBLE_STD_MATH(fun) \
216 inline zdouble fun(const zdouble& z ) \
217 { return zdouble( std::fun(z.dbl_) ); }
259 # if CPPAD_USE_CPLUSPLUS_2011
328 {
bool zero = (
dbl_ == 0.0) || (z.dbl_ == 0.0);
333 {
bool zero = (
dbl_ == 0.0) || (x == 0.0);
338 {
bool zero = (
dbl_ == 0.0);
343 {
bool zero = (
dbl_ == 0.0);
349 {
bool zero = (
dbl_ == 0.0) || (z.
dbl_ == 0.0);
350 zero ? (
dbl_ = 0.0) : (dbl_ *= z.
dbl_);
355 {
bool zero = (
dbl_ == 0.0) || (x == 0.0);
356 zero ? (
dbl_ = 0.0) : (dbl_ *= x);
362 {
bool zero = (
dbl_ == 0.0);
363 zero ? (
dbl_ = 0.0) : (dbl_ /= z.
dbl_);
368 {
bool zero = (
dbl_ == 0.0);
369 zero ? (
dbl_ = 0.0) : (dbl_ /= x);
378 return zdouble( std::numeric_limits<double>::quiet_NaN() );
428 {
return (x == 0.0); }
430 {
return (x == 1.); }
442 {
return static_cast<int>(x.
dbl_); }
489 # if CPPAD_USE_CPLUSPLUS_2011
527 # undef CPPAD_ZDOUBLE_NORMAL_ASSIGN_OPERATOR
528 # undef CPPAD_ZDOUBLE_UNARY_OPERATOR
529 # undef CPPAD_ZDOUBLE_NORMAL_BINARY_OPERATOR
530 # undef CPPAD_ZDOUBLE_COMPARE_OPERATOR
531 # undef CPPAD_ZDOUBLE_OTHER_BINARY_OPERATOR
532 # undef CPPAD_ZDOUBLE_OTHER_COMPARE_OPERATOR
533 # undef CPPAD_ZDOUBLE_STD_MATH_FRIEND
534 # undef CPPAD_ZDOUBLE_STD_MATH
std::complex< double > erf(const std::complex< double > &x)
AD< Base > cosh(const AD< Base > &x)
#define CPPAD_ZDOUBLE_NORMAL_ASSIGN_OPERATOR(op)
Define a compound assignment member operator that functions the same as corresponding double operator...
friend zdouble log1p(const zdouble &z)
C++2011 standard math function.
AD< Base > azmul(const AD< Base > &x, const AD< Base > &y)
friend zdouble fabs(const zdouble &z)
Normal standard math function.
Class that is like double, except that it has an absolute zero.
#define CPPAD_ZDOUBLE_OTHER_COMPARE_OPERATOR(op, op_switch)
Define a comparison operator that is not a member because the double operand is on the left...
AD< Base > log(const AD< Base > &x)
friend zdouble tan(const zdouble &z)
Normal standard math function.
std::ostream & operator<<(std::ostream &os, const CppAD::vector< Type > &vec)
output a vector
friend zdouble cos(const zdouble &z)
Normal standard math function.
~zdouble(void)
Destructor.
std::complex< double > atan(const std::complex< double > &x)
#define CPPAD_ZDOUBLE_NORMAL_BINARY_OPERATOR(op)
define CPPAD_ZDOUBLE_NORMAL_BINARY_OPERATOR(op)Define a binary arithmetic member operator that functi...
AD< Base > sinh(const AD< Base > &x)
#define CPPAD_ZDOUBLE_COMPARE_OPERATOR(op)
Define a comparison member operator.
#define CPPAD_ZDOUBLE_UNARY_OPERATOR(op)
Define a unary compound assignment member operator.
double dbl_
The value for this object.
bool GreaterThanOrZero(const std::complex< double > &x)
friend zdouble log10(const zdouble &z)
Normal standard math function.
ResultType CondExpTemplate(enum CompareOp cop, const CompareType &left, const CompareType &right, const ResultType &exp_if_true, const ResultType &exp_if_false)
Template function to implement Conditional Expressions for simple types that have comparision operato...
friend zdouble acosh(const zdouble &z)
C++2011 standard math function.
AD< Base > abs(const AD< Base > &x)
zdouble(const double &dbl)
Constructor from double.
friend int Integer(const zdouble &z)
Base type requirement: Integer.
friend zdouble sin(const zdouble &z)
Normal standard math function.
zdouble & operator*=(const zdouble &z)
Compute assignmnet *= with absolute zero.
std::complex< double > acos(const std::complex< double > &x)
bool IdenticalPar(const std::complex< double > &x)
zdouble nan< zdouble >(const zdouble &zero)
Must specialize CppAD::nan because zdouble 0/0 is not nan.
AD< Base > tan(const AD< Base > &x)
bool EqualOpSeq(const std::complex< double > &x, const std::complex< double > &y)
friend zdouble atanh(const zdouble &z)
C++2011 standard math function.
#define CPPAD_ZDOUBLE_STD_MATH_FRIEND(fun)
Declare that a standard math function is a friend.
bool IdenticalZero(const std::complex< double > &x)
AD< Base > exp(const AD< Base > &x)
AD< Base > log10(const AD< Base > &x)
Compute the log of base 10 of x where has type AD<Base>
friend zdouble atan(const zdouble &z)
Normal standard math function.
std::complex< double > asinh(const std::complex< double > &x)
bool abs_geq(const std::complex< double > &x, const std::complex< double > &y)
std::complex< double > acosh(const std::complex< double > &x)
Type pow(const Type &x, const int &n)
zdouble & operator=(const zdouble &z)
Assignment from zdouble.
bool LessThanOrZero(const std::complex< double > &x)
std::complex< double > expm1(const std::complex< double > &x)
friend zdouble expm1(const zdouble &z)
C++2011 standard math function.
friend std::ostream & operator<<(std::ostream &os, const zdouble &z)
For zdouble objects z1, z2, and std::ostream os, declare the following friends:
AD< Base > sqrt(const AD< Base > &x)
zdouble(const zdouble &z)
Copy constructor.
friend zdouble erf(const zdouble &z)
C++2011 standard math function.
AD< Base > tanh(const AD< Base > &x)
#define CPPAD_NUMERIC_LIMITS(Other, Base)
zdouble operator*(const zdouble &z) const
Binary arithmetic * with absolute zero.
std::complex< double > atanh(const std::complex< double > &x)
zdouble & operator=(const double &dbl)
Assignment from double.
friend zdouble asin(const zdouble &z)
Normal standard math function.
zdouble & operator/=(const zdouble &z)
Compute assignmnet /= with absolute zero.
AD< Base > sin(const AD< Base > &x)
zdouble operator/(const zdouble &z) const
Binary arithmetic / with absolute zero.
std::complex< double > sign(const std::complex< double > &x)
friend zdouble tanh(const zdouble &z)
Normal standard math function.
bool IdenticalEqualPar(const std::complex< double > &x, const std::complex< double > &y)
AD< Base > cos(const AD< Base > &x)
friend zdouble acos(const zdouble &z)
Normal standard math function.
bool IdenticalOne(const std::complex< double > &x)
friend zdouble exp(const zdouble &z)
Normal standard math function.
std::complex< double > asin(const std::complex< double > &x)
friend zdouble log(const zdouble &z)
Normal standard math function.
int Integer(const std::complex< double > &x)
bool LessThanZero(const std::complex< double > &x)
#define CPPAD_COND_EXP_REL(Type)
The macro defines the operations.
friend zdouble sqrt(const zdouble &z)
Normal standard math function.
zdouble(void)
Default constructor.
friend bool abs_geq(const zdouble &x, const zdouble &y)
friend zdouble asinh(const zdouble &z)
C++2011 standard math function.
std::complex< double > CondExpOp(enum CppAD::CompareOp cop, const std::complex< double > &left, const std::complex< double > &right, const std::complex< double > &trueCase, const std::complex< double > &falseCase)
#define CPPAD_ZDOUBLE_STD_MATH(fun)
Define a standard math function.
friend zdouble cosh(const zdouble &z)
Normal standard math function.
std::complex< double > fabs(const std::complex< double > &x)
bool GreaterThanZero(const std::complex< double > &x)
friend zdouble pow(const zdouble &x, const zdouble &y)
Base type requirement: pow.
friend zdouble sinh(const zdouble &z)
Normal standard math function.
std::complex< double > log1p(const std::complex< double > &x)
#define CPPAD_ZDOUBLE_OTHER_BINARY_OPERATOR(op)
Define a binary arithmetic operator that is not a member because the double operand is on the left...