
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* (tan t) ew))))
(fabs
(fma
(* (sin t) ew)
(cos (atan t_1))
(* (tanh (asinh t_1)) (* (cos t) eh))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (tan(t) * ew);
return fabs(fma((sin(t) * ew), cos(atan(t_1)), (tanh(asinh(t_1)) * (cos(t) * eh))));
}
function code(eh, ew, t) t_1 = Float64(eh / Float64(tan(t) * ew)) return abs(fma(Float64(sin(t) * ew), cos(atan(t_1)), Float64(tanh(asinh(t_1)) * Float64(cos(t) * eh)))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision] + N[(N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{\tan t \cdot ew}\\
\left|\mathsf{fma}\left(\sin t \cdot ew, \cos \tan^{-1} t\_1, \tanh \sinh^{-1} t\_1 \cdot \left(\cos t \cdot eh\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-lft-identityN/A
remove-double-negN/A
associate-*l*N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t)))
(t_2 (/ (/ eh (tan t)) ew))
(t_3 (atan (/ (/ eh ew) (tan t))))
(t_4 (* (* ew (sin t)) (cos t_3))))
(if (<= (fabs (+ (* t_1 (sin t_3)) t_4)) 5e+65)
(fabs (/ (fma (* (cos t) t_2) eh (* (sin t) ew)) (cosh (asinh t_2))))
(fabs (+ (* t_1 (sin (atan (/ (/ eh ew) t)))) t_4)))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double t_2 = (eh / tan(t)) / ew;
double t_3 = atan(((eh / ew) / tan(t)));
double t_4 = (ew * sin(t)) * cos(t_3);
double tmp;
if (fabs(((t_1 * sin(t_3)) + t_4)) <= 5e+65) {
tmp = fabs((fma((cos(t) * t_2), eh, (sin(t) * ew)) / cosh(asinh(t_2))));
} else {
tmp = fabs(((t_1 * sin(atan(((eh / ew) / t)))) + t_4));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) t_2 = Float64(Float64(eh / tan(t)) / ew) t_3 = atan(Float64(Float64(eh / ew) / tan(t))) t_4 = Float64(Float64(ew * sin(t)) * cos(t_3)) tmp = 0.0 if (abs(Float64(Float64(t_1 * sin(t_3)) + t_4)) <= 5e+65) tmp = abs(Float64(fma(Float64(cos(t) * t_2), eh, Float64(sin(t) * ew)) / cosh(asinh(t_2)))); else tmp = abs(Float64(Float64(t_1 * sin(atan(Float64(Float64(eh / ew) / t)))) + t_4)); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[N[(N[(t$95$1 * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]], $MachinePrecision], 5e+65], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$2), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t$95$1 * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
t_2 := \frac{\frac{eh}{\tan t}}{ew}\\
t_3 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
t_4 := \left(ew \cdot \sin t\right) \cdot \cos t\_3\\
\mathbf{if}\;\left|t\_1 \cdot \sin t\_3 + t\_4\right| \leq 5 \cdot 10^{+65}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_2, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_2}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) + t\_4\right|\\
\end{array}
\end{array}
if (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))) < 4.99999999999999973e65Initial program 99.8%
Applied rewrites90.3%
if 4.99999999999999973e65 < (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))) Initial program 99.7%
Taylor expanded in t around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f6492.9
Applied rewrites92.9%
Final simplification91.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)) (t_2 (* eh (cos t))))
(if (or (<= eh -3.8e+107) (not (<= eh 3.3e+106)))
(fabs (* t_2 (sin (atan (/ t_2 (* ew (sin t)))))))
(fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double t_2 = eh * cos(t);
double tmp;
if ((eh <= -3.8e+107) || !(eh <= 3.3e+106)) {
tmp = fabs((t_2 * sin(atan((t_2 / (ew * sin(t)))))));
} else {
tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / cosh(asinh(t_1))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) t_2 = Float64(eh * cos(t)) tmp = 0.0 if ((eh <= -3.8e+107) || !(eh <= 3.3e+106)) tmp = abs(Float64(t_2 * sin(atan(Float64(t_2 / Float64(ew * sin(t))))))); else tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / cosh(asinh(t_1)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -3.8e+107], N[Not[LessEqual[eh, 3.3e+106]], $MachinePrecision]], N[Abs[N[(t$95$2 * N[Sin[N[ArcTan[N[(t$95$2 / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
t_2 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -3.8 \cdot 10^{+107} \lor \neg \left(eh \leq 3.3 \cdot 10^{+106}\right):\\
\;\;\;\;\left|t\_2 \cdot \sin \tan^{-1} \left(\frac{t\_2}{ew \cdot \sin t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\end{array}
\end{array}
if eh < -3.7999999999999998e107 or 3.30000000000000008e106 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6461.8
Applied rewrites61.8%
Taylor expanded in eh around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6491.8
Applied rewrites91.8%
if -3.7999999999999998e107 < eh < 3.30000000000000008e106Initial program 99.8%
Applied rewrites89.8%
Final simplification90.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (or (<= eh -3.8e+107) (not (<= eh 3.3e+106)))
(fabs (* t_1 (sin (atan (/ t_1 (* ew (sin t)))))))
(fabs
(/
(fma (sin t) ew (* (/ (* (/ eh ew) eh) (tan t)) (cos t)))
(cosh (asinh (/ (/ eh (tan t)) ew))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if ((eh <= -3.8e+107) || !(eh <= 3.3e+106)) {
tmp = fabs((t_1 * sin(atan((t_1 / (ew * sin(t)))))));
} else {
tmp = fabs((fma(sin(t), ew, ((((eh / ew) * eh) / tan(t)) * cos(t))) / cosh(asinh(((eh / tan(t)) / ew)))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if ((eh <= -3.8e+107) || !(eh <= 3.3e+106)) tmp = abs(Float64(t_1 * sin(atan(Float64(t_1 / Float64(ew * sin(t))))))); else tmp = abs(Float64(fma(sin(t), ew, Float64(Float64(Float64(Float64(eh / ew) * eh) / tan(t)) * cos(t))) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -3.8e+107], N[Not[LessEqual[eh, 3.3e+106]], $MachinePrecision]], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(t$95$1 / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew + N[(N[(N[(N[(eh / ew), $MachinePrecision] * eh), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -3.8 \cdot 10^{+107} \lor \neg \left(eh \leq 3.3 \cdot 10^{+106}\right):\\
\;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{t\_1}{ew \cdot \sin t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, ew, \frac{\frac{eh}{ew} \cdot eh}{\tan t} \cdot \cos t\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
\end{array}
\end{array}
if eh < -3.7999999999999998e107 or 3.30000000000000008e106 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6461.8
Applied rewrites61.8%
Taylor expanded in eh around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6491.8
Applied rewrites91.8%
if -3.7999999999999998e107 < eh < 3.30000000000000008e106Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites86.4%
Final simplification88.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)) (t_2 (* eh (cos t))))
(if (or (<= eh -6000000.0) (not (<= eh 2.7e-36)))
(fabs (* t_2 (sin (atan (/ t_2 (* ew (sin t)))))))
(fabs
(/
(fma (* (cos t) t_1) eh (* (sin t) ew))
(sqrt (+ 1.0 (pow t_1 2.0))))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double t_2 = eh * cos(t);
double tmp;
if ((eh <= -6000000.0) || !(eh <= 2.7e-36)) {
tmp = fabs((t_2 * sin(atan((t_2 / (ew * sin(t)))))));
} else {
tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / sqrt((1.0 + pow(t_1, 2.0)))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) t_2 = Float64(eh * cos(t)) tmp = 0.0 if ((eh <= -6000000.0) || !(eh <= 2.7e-36)) tmp = abs(Float64(t_2 * sin(atan(Float64(t_2 / Float64(ew * sin(t))))))); else tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / sqrt(Float64(1.0 + (t_1 ^ 2.0))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -6000000.0], N[Not[LessEqual[eh, 2.7e-36]], $MachinePrecision]], N[Abs[N[(t$95$2 * N[Sin[N[ArcTan[N[(t$95$2 / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
t_2 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -6000000 \lor \neg \left(eh \leq 2.7 \cdot 10^{-36}\right):\\
\;\;\;\;\left|t\_2 \cdot \sin \tan^{-1} \left(\frac{t\_2}{ew \cdot \sin t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\sqrt{1 + {t\_1}^{2}}}\right|\\
\end{array}
\end{array}
if eh < -6e6 or 2.70000000000000007e-36 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6450.5
Applied rewrites50.5%
Taylor expanded in eh around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6483.8
Applied rewrites83.8%
if -6e6 < eh < 2.70000000000000007e-36Initial program 99.8%
Applied rewrites95.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites91.2%
Final simplification87.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (or (<= eh -7e-81) (not (<= eh 8e-36)))
(fabs (* t_1 (sin (atan (/ t_1 (* ew (sin t)))))))
(fabs
(/
(fma (/ eh (* ew t)) eh (* (sin t) ew))
(cosh (asinh (/ (/ eh (tan t)) ew))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if ((eh <= -7e-81) || !(eh <= 8e-36)) {
tmp = fabs((t_1 * sin(atan((t_1 / (ew * sin(t)))))));
} else {
tmp = fabs((fma((eh / (ew * t)), eh, (sin(t) * ew)) / cosh(asinh(((eh / tan(t)) / ew)))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if ((eh <= -7e-81) || !(eh <= 8e-36)) tmp = abs(Float64(t_1 * sin(atan(Float64(t_1 / Float64(ew * sin(t))))))); else tmp = abs(Float64(fma(Float64(eh / Float64(ew * t)), eh, Float64(sin(t) * ew)) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -7e-81], N[Not[LessEqual[eh, 8e-36]], $MachinePrecision]], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(t$95$1 / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -7 \cdot 10^{-81} \lor \neg \left(eh \leq 8 \cdot 10^{-36}\right):\\
\;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{t\_1}{ew \cdot \sin t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{eh}{ew \cdot t}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
\end{array}
\end{array}
if eh < -6.99999999999999973e-81 or 7.9999999999999995e-36 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6449.5
Applied rewrites49.5%
Taylor expanded in eh around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6482.4
Applied rewrites82.4%
if -6.99999999999999973e-81 < eh < 7.9999999999999995e-36Initial program 99.8%
Applied rewrites95.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6483.5
Applied rewrites83.5%
Final simplification82.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(tanh
(asinh (/ (/ (fma (* (* t t) eh) -0.3333333333333333 eh) t) ew)))))
(if (<= eh -7e-81)
(fabs (* (* (* (/ (cos t) ew) eh) t_1) ew))
(if (<= eh 8e-36)
(fabs
(/
(fma (/ eh (* ew t)) eh (* (sin t) ew))
(cosh (asinh (/ (/ eh (tan t)) ew)))))
(if (<= eh 4.5e+123)
(fabs
(*
(/
(*
(* eh (cos t))
(sin
(atan
(/
(fma (* (/ eh ew) -0.3333333333333333) (* t t) (/ eh ew))
t))))
ew)
ew))
(fabs (* t_1 eh)))))))
double code(double eh, double ew, double t) {
double t_1 = tanh(asinh(((fma(((t * t) * eh), -0.3333333333333333, eh) / t) / ew)));
double tmp;
if (eh <= -7e-81) {
tmp = fabs(((((cos(t) / ew) * eh) * t_1) * ew));
} else if (eh <= 8e-36) {
tmp = fabs((fma((eh / (ew * t)), eh, (sin(t) * ew)) / cosh(asinh(((eh / tan(t)) / ew)))));
} else if (eh <= 4.5e+123) {
tmp = fabs(((((eh * cos(t)) * sin(atan((fma(((eh / ew) * -0.3333333333333333), (t * t), (eh / ew)) / t)))) / ew) * ew));
} else {
tmp = fabs((t_1 * eh));
}
return tmp;
}
function code(eh, ew, t) t_1 = tanh(asinh(Float64(Float64(fma(Float64(Float64(t * t) * eh), -0.3333333333333333, eh) / t) / ew))) tmp = 0.0 if (eh <= -7e-81) tmp = abs(Float64(Float64(Float64(Float64(cos(t) / ew) * eh) * t_1) * ew)); elseif (eh <= 8e-36) tmp = abs(Float64(fma(Float64(eh / Float64(ew * t)), eh, Float64(sin(t) * ew)) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew))))); elseif (eh <= 4.5e+123) tmp = abs(Float64(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(fma(Float64(Float64(eh / ew) * -0.3333333333333333), Float64(t * t), Float64(eh / ew)) / t)))) / ew) * ew)); else tmp = abs(Float64(t_1 * eh)); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Tanh[N[ArcSinh[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] * -0.3333333333333333 + eh), $MachinePrecision] / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -7e-81], N[Abs[N[(N[(N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision] * t$95$1), $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 8e-36], N[Abs[N[(N[(N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 4.5e+123], N[Abs[N[(N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[(N[(eh / ew), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$1 * eh), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{t}}{ew}\right)\\
\mathbf{if}\;eh \leq -7 \cdot 10^{-81}:\\
\;\;\;\;\left|\left(\left(\frac{\cos t}{ew} \cdot eh\right) \cdot t\_1\right) \cdot ew\right|\\
\mathbf{elif}\;eh \leq 8 \cdot 10^{-36}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{eh}{ew \cdot t}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
\mathbf{elif}\;eh \leq 4.5 \cdot 10^{+123}:\\
\;\;\;\;\left|\frac{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{eh}{ew} \cdot -0.3333333333333333, t \cdot t, \frac{eh}{ew}\right)}{t}\right)}{ew} \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1 \cdot eh\right|\\
\end{array}
\end{array}
if eh < -6.99999999999999973e-81Initial program 99.8%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.9%
Taylor expanded in eh around inf
Applied rewrites66.6%
Applied rewrites66.5%
Taylor expanded in t around 0
Applied rewrites66.6%
if -6.99999999999999973e-81 < eh < 7.9999999999999995e-36Initial program 99.8%
Applied rewrites95.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6483.5
Applied rewrites83.5%
if 7.9999999999999995e-36 < eh < 4.49999999999999983e123Initial program 99.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.3%
Taylor expanded in eh around inf
Applied rewrites76.3%
Taylor expanded in t around 0
Applied rewrites76.5%
if 4.49999999999999983e123 < eh Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6469.9
Applied rewrites69.9%
Applied rewrites69.9%
Taylor expanded in t around 0
Applied rewrites70.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(tanh
(asinh (/ (/ (fma (* (* t t) eh) -0.3333333333333333 eh) t) ew)))))
(if (<= eh -8.8e-113)
(fabs (* (* (* (/ (cos t) ew) eh) t_1) ew))
(if (<= eh 2e-36)
(fabs (* ew (sin t)))
(if (<= eh 4.5e+123)
(fabs
(*
(/
(*
(* eh (cos t))
(sin
(atan
(/
(fma (* (/ eh ew) -0.3333333333333333) (* t t) (/ eh ew))
t))))
ew)
ew))
(fabs (* t_1 eh)))))))
double code(double eh, double ew, double t) {
double t_1 = tanh(asinh(((fma(((t * t) * eh), -0.3333333333333333, eh) / t) / ew)));
double tmp;
if (eh <= -8.8e-113) {
tmp = fabs(((((cos(t) / ew) * eh) * t_1) * ew));
} else if (eh <= 2e-36) {
tmp = fabs((ew * sin(t)));
} else if (eh <= 4.5e+123) {
tmp = fabs(((((eh * cos(t)) * sin(atan((fma(((eh / ew) * -0.3333333333333333), (t * t), (eh / ew)) / t)))) / ew) * ew));
} else {
tmp = fabs((t_1 * eh));
}
return tmp;
}
function code(eh, ew, t) t_1 = tanh(asinh(Float64(Float64(fma(Float64(Float64(t * t) * eh), -0.3333333333333333, eh) / t) / ew))) tmp = 0.0 if (eh <= -8.8e-113) tmp = abs(Float64(Float64(Float64(Float64(cos(t) / ew) * eh) * t_1) * ew)); elseif (eh <= 2e-36) tmp = abs(Float64(ew * sin(t))); elseif (eh <= 4.5e+123) tmp = abs(Float64(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(fma(Float64(Float64(eh / ew) * -0.3333333333333333), Float64(t * t), Float64(eh / ew)) / t)))) / ew) * ew)); else tmp = abs(Float64(t_1 * eh)); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Tanh[N[ArcSinh[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] * -0.3333333333333333 + eh), $MachinePrecision] / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -8.8e-113], N[Abs[N[(N[(N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision] * t$95$1), $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 2e-36], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 4.5e+123], N[Abs[N[(N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[(N[(eh / ew), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$1 * eh), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{t}}{ew}\right)\\
\mathbf{if}\;eh \leq -8.8 \cdot 10^{-113}:\\
\;\;\;\;\left|\left(\left(\frac{\cos t}{ew} \cdot eh\right) \cdot t\_1\right) \cdot ew\right|\\
\mathbf{elif}\;eh \leq 2 \cdot 10^{-36}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{elif}\;eh \leq 4.5 \cdot 10^{+123}:\\
\;\;\;\;\left|\frac{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{eh}{ew} \cdot -0.3333333333333333, t \cdot t, \frac{eh}{ew}\right)}{t}\right)}{ew} \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1 \cdot eh\right|\\
\end{array}
\end{array}
if eh < -8.80000000000000016e-113Initial program 99.8%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.3%
Taylor expanded in eh around inf
Applied rewrites66.0%
Applied rewrites65.9%
Taylor expanded in t around 0
Applied rewrites66.2%
if -8.80000000000000016e-113 < eh < 1.9999999999999999e-36Initial program 99.8%
Applied rewrites96.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6475.3
Applied rewrites75.3%
if 1.9999999999999999e-36 < eh < 4.49999999999999983e123Initial program 99.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.3%
Taylor expanded in eh around inf
Applied rewrites76.3%
Taylor expanded in t around 0
Applied rewrites76.5%
if 4.49999999999999983e123 < eh Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6469.9
Applied rewrites69.9%
Applied rewrites69.9%
Taylor expanded in t around 0
Applied rewrites70.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(tanh
(asinh (/ (/ (fma (* (* t t) eh) -0.3333333333333333 eh) t) ew))))
(t_2 (fabs (* (* (* (/ (cos t) ew) eh) t_1) ew))))
(if (<= eh -8.8e-113)
t_2
(if (<= eh 2e-36)
(fabs (* ew (sin t)))
(if (<= eh 4.5e+123) t_2 (fabs (* t_1 eh)))))))
double code(double eh, double ew, double t) {
double t_1 = tanh(asinh(((fma(((t * t) * eh), -0.3333333333333333, eh) / t) / ew)));
double t_2 = fabs(((((cos(t) / ew) * eh) * t_1) * ew));
double tmp;
if (eh <= -8.8e-113) {
tmp = t_2;
} else if (eh <= 2e-36) {
tmp = fabs((ew * sin(t)));
} else if (eh <= 4.5e+123) {
tmp = t_2;
} else {
tmp = fabs((t_1 * eh));
}
return tmp;
}
function code(eh, ew, t) t_1 = tanh(asinh(Float64(Float64(fma(Float64(Float64(t * t) * eh), -0.3333333333333333, eh) / t) / ew))) t_2 = abs(Float64(Float64(Float64(Float64(cos(t) / ew) * eh) * t_1) * ew)) tmp = 0.0 if (eh <= -8.8e-113) tmp = t_2; elseif (eh <= 2e-36) tmp = abs(Float64(ew * sin(t))); elseif (eh <= 4.5e+123) tmp = t_2; else tmp = abs(Float64(t_1 * eh)); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Tanh[N[ArcSinh[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] * -0.3333333333333333 + eh), $MachinePrecision] / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision] * t$95$1), $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -8.8e-113], t$95$2, If[LessEqual[eh, 2e-36], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 4.5e+123], t$95$2, N[Abs[N[(t$95$1 * eh), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{t}}{ew}\right)\\
t_2 := \left|\left(\left(\frac{\cos t}{ew} \cdot eh\right) \cdot t\_1\right) \cdot ew\right|\\
\mathbf{if}\;eh \leq -8.8 \cdot 10^{-113}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 2 \cdot 10^{-36}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{elif}\;eh \leq 4.5 \cdot 10^{+123}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1 \cdot eh\right|\\
\end{array}
\end{array}
if eh < -8.80000000000000016e-113 or 1.9999999999999999e-36 < eh < 4.49999999999999983e123Initial program 99.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.7%
Taylor expanded in eh around inf
Applied rewrites69.5%
Applied rewrites69.4%
Taylor expanded in t around 0
Applied rewrites69.7%
if -8.80000000000000016e-113 < eh < 1.9999999999999999e-36Initial program 99.8%
Applied rewrites96.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6475.3
Applied rewrites75.3%
if 4.49999999999999983e123 < eh Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6469.9
Applied rewrites69.9%
Applied rewrites69.9%
Taylor expanded in t around 0
Applied rewrites70.0%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -1.3e-63) (not (<= t 1.9e-40))) (fabs (/ (fma (* (cos t) (/ (/ eh (tan t)) ew)) eh (* (sin t) ew)) 1.0)) (fabs (* (tanh (asinh (/ (/ eh t) ew))) eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -1.3e-63) || !(t <= 1.9e-40)) {
tmp = fabs((fma((cos(t) * ((eh / tan(t)) / ew)), eh, (sin(t) * ew)) / 1.0));
} else {
tmp = fabs((tanh(asinh(((eh / t) / ew))) * eh));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((t <= -1.3e-63) || !(t <= 1.9e-40)) tmp = abs(Float64(fma(Float64(cos(t) * Float64(Float64(eh / tan(t)) / ew)), eh, Float64(sin(t) * ew)) / 1.0)); else tmp = abs(Float64(tanh(asinh(Float64(Float64(eh / t) / ew))) * eh)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -1.3e-63], N[Not[LessEqual[t, 1.9e-40]], $MachinePrecision]], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Tanh[N[ArcSinh[N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-63} \lor \neg \left(t \leq 1.9 \cdot 10^{-40}\right):\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{1}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\tanh \sinh^{-1} \left(\frac{\frac{eh}{t}}{ew}\right) \cdot eh\right|\\
\end{array}
\end{array}
if t < -1.3000000000000001e-63 or 1.8999999999999999e-40 < t Initial program 99.6%
Applied rewrites81.2%
Taylor expanded in eh around 0
Applied rewrites52.1%
if -1.3000000000000001e-63 < t < 1.8999999999999999e-40Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6478.5
Applied rewrites78.5%
Applied rewrites78.5%
Taylor expanded in t around 0
Applied rewrites78.5%
Final simplification62.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -1.3e-63) (not (<= t 1.9e-40))) (fabs (* ew (sin t))) (fabs (* (tanh (asinh (/ (/ eh t) ew))) eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -1.3e-63) || !(t <= 1.9e-40)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((tanh(asinh(((eh / t) / ew))) * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -1.3e-63) or not (t <= 1.9e-40): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((math.tanh(math.asinh(((eh / t) / ew))) * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -1.3e-63) || !(t <= 1.9e-40)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(tanh(asinh(Float64(Float64(eh / t) / ew))) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -1.3e-63) || ~((t <= 1.9e-40))) tmp = abs((ew * sin(t))); else tmp = abs((tanh(asinh(((eh / t) / ew))) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -1.3e-63], N[Not[LessEqual[t, 1.9e-40]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Tanh[N[ArcSinh[N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-63} \lor \neg \left(t \leq 1.9 \cdot 10^{-40}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\tanh \sinh^{-1} \left(\frac{\frac{eh}{t}}{ew}\right) \cdot eh\right|\\
\end{array}
\end{array}
if t < -1.3000000000000001e-63 or 1.8999999999999999e-40 < t Initial program 99.6%
Applied rewrites81.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6451.6
Applied rewrites51.6%
if -1.3000000000000001e-63 < t < 1.8999999999999999e-40Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6478.5
Applied rewrites78.5%
Applied rewrites78.5%
Taylor expanded in t around 0
Applied rewrites78.5%
Final simplification61.9%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (sin t))))
double code(double eh, double ew, double t) {
return fabs((ew * sin(t)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((ew * sin(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.sin(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.sin(t)))
function code(eh, ew, t) return abs(Float64(ew * sin(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * sin(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t\right|
\end{array}
Initial program 99.8%
Applied rewrites69.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6441.6
Applied rewrites41.6%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (* 1.0 t))))
double code(double eh, double ew, double t) {
return fabs((ew * (1.0 * t)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((ew * (1.0d0 * t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * (1.0 * t)));
}
def code(eh, ew, t): return math.fabs((ew * (1.0 * t)))
function code(eh, ew, t) return abs(Float64(ew * Float64(1.0 * t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * (1.0 * t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[(1.0 * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \left(1 \cdot t\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites69.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6441.6
Applied rewrites41.6%
Taylor expanded in t around 0
Applied rewrites16.5%
Taylor expanded in t around 0
Applied rewrites17.1%
herbie shell --seed 2024353
(FPCore (eh ew t)
:name "Example from Robby"
:precision binary64
(fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))