Typecast var to double #292
Manushanker
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi! For forward types ( /// Explicitly convert this Variable object into its underlying arithmetic type.
explicit operator T() const { return expr->val; } in /// Convert this Dual number into a value of type @p U.
#if defined(AUTODIFF_ENABLE_IMPLICIT_CONVERSION_DUAL) || defined(AUTODIFF_ENABLE_IMPLICIT_CONVERSION)
operator T() const { return val; }
template<typename U>
operator U() const { return static_cast<U>(val); }
#else
explicit operator T() const { return val; }
template<typename U>
explicit operator U() const { return static_cast<U>(val); }
#endif |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying use reverse mode differentiator to compute higher order derivatives. I use var data type and in the function I use a int cast operator to convert data into integer type. Please see the below code
static var a0;
static int n0;
n0 = (int) (a0 * 1.1f) + 1;
The error message from the compiler is "E0413 no suitable conversion function from "autodiff::detail::ExprPtr" to "int" exists"
May I know if there is a function in Autodiff to convert data type to double?
Beta Was this translation helpful? Give feedback.
All reactions