
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- ew))))) (* (* (cos (atan (* (/ (tan t) ew) eh))) (cos t)) ew))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((eh * tan(t)) / -ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew)));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * sin(t)) * sin(atan(((eh * tan(t)) / -ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / -ew)))) - ((Math.cos(Math.atan(((Math.tan(t) / ew) * eh))) * Math.cos(t)) * ew)));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / -ew)))) - ((math.cos(math.atan(((math.tan(t) / ew) * eh))) * math.cos(t)) * ew)))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew))))) - Float64(Float64(cos(atan(Float64(Float64(tan(t) / ew) * eh))) * cos(t)) * ew))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan(((eh * tan(t)) / -ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) - \left(\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \cos t\right) \cdot ew\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* eh (sin t)) (sin (atan (/ (* (- eh) t) ew)))) (* (* (cos (atan (* (/ (tan t) ew) eh))) (cos t)) ew))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew)));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * t) / ew)))) - ((Math.cos(Math.atan(((Math.tan(t) / ew) * eh))) * Math.cos(t)) * ew)));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((-eh * t) / ew)))) - ((math.cos(math.atan(((math.tan(t) / ew) * eh))) * math.cos(t)) * ew)))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(Float64(cos(atan(Float64(Float64(tan(t) / ew) * eh))) * cos(t)) * ew))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \left(\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \cos t\right) \cdot ew\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)))
(if (or (<= ew -9.6e-129) (not (<= ew 7.5e-154)))
(fabs
(*
(fma
(/ (tanh (/ (* eh t) ew)) (- ew))
(* (sin t) eh)
(* (cos (atan (* eh t_1))) (- (cos t))))
(- ew)))
(fabs
(-
(* (* eh (sin t)) (sin (atan (/ (* (- eh) t) ew))))
(* (* (cos (atan (* t_1 eh))) 1.0) ew))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double tmp;
if ((ew <= -9.6e-129) || !(ew <= 7.5e-154)) {
tmp = fabs((fma((tanh(((eh * t) / ew)) / -ew), (sin(t) * eh), (cos(atan((eh * t_1))) * -cos(t))) * -ew));
} else {
tmp = fabs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan((t_1 * eh))) * 1.0) * ew)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) tmp = 0.0 if ((ew <= -9.6e-129) || !(ew <= 7.5e-154)) tmp = abs(Float64(fma(Float64(tanh(Float64(Float64(eh * t) / ew)) / Float64(-ew)), Float64(sin(t) * eh), Float64(cos(atan(Float64(eh * t_1))) * Float64(-cos(t)))) * Float64(-ew))); else tmp = abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(Float64(cos(atan(Float64(t_1 * eh))) * 1.0) * ew))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[ew, -9.6e-129], N[Not[LessEqual[ew, 7.5e-154]], $MachinePrecision]], N[Abs[N[(N[(N[(N[Tanh[N[(N[(eh * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision] / (-ew)), $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] + N[(N[Cos[N[ArcTan[N[(eh * t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] * (-ew)), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[N[ArcTan[N[(t$95$1 * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
\mathbf{if}\;ew \leq -9.6 \cdot 10^{-129} \lor \neg \left(ew \leq 7.5 \cdot 10^{-154}\right):\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{\tanh \left(\frac{eh \cdot t}{ew}\right)}{-ew}, \sin t \cdot eh, \cos \tan^{-1} \left(eh \cdot t\_1\right) \cdot \left(-\cos t\right)\right) \cdot \left(-ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \left(\cos \tan^{-1} \left(t\_1 \cdot eh\right) \cdot 1\right) \cdot ew\right|\\
\end{array}
\end{array}
if ew < -9.59999999999999954e-129 or 7.5e-154 < ew Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in ew around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
associate-*r*N/A
Applied rewrites98.2%
Applied rewrites98.2%
Taylor expanded in t around 0
Applied rewrites97.7%
if -9.59999999999999954e-129 < ew < 7.5e-154Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
Applied rewrites95.4%
Final simplification97.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)) (t_2 (* t_1 eh)))
(if (or (<= eh -1.75e+131) (not (<= eh 2.45e+64)))
(fabs
(-
(* (* eh (sin t)) (sin (atan (/ (* (- eh) t) ew))))
(* (* (cos (atan t_2)) 1.0) ew)))
(fabs
(/ (fma (* (* (sin t) t_1) eh) eh (* (cos t) ew)) (cosh (asinh t_2)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double t_2 = t_1 * eh;
double tmp;
if ((eh <= -1.75e+131) || !(eh <= 2.45e+64)) {
tmp = fabs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(t_2)) * 1.0) * ew)));
} else {
tmp = fabs((fma(((sin(t) * t_1) * eh), eh, (cos(t) * ew)) / cosh(asinh(t_2))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) t_2 = Float64(t_1 * eh) tmp = 0.0 if ((eh <= -1.75e+131) || !(eh <= 2.45e+64)) tmp = abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(Float64(cos(atan(t_2)) * 1.0) * ew))); else tmp = abs(Float64(fma(Float64(Float64(sin(t) * t_1) * eh), eh, Float64(cos(t) * ew)) / cosh(asinh(t_2)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * eh), $MachinePrecision]}, If[Or[LessEqual[eh, -1.75e+131], N[Not[LessEqual[eh, 2.45e+64]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[N[ArcTan[t$95$2], $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(N[Sin[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh), $MachinePrecision] * eh + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := t\_1 \cdot eh\\
\mathbf{if}\;eh \leq -1.75 \cdot 10^{+131} \lor \neg \left(eh \leq 2.45 \cdot 10^{+64}\right):\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \left(\cos \tan^{-1} t\_2 \cdot 1\right) \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\left(\sin t \cdot t\_1\right) \cdot eh, eh, \cos t \cdot ew\right)}{\cosh \sinh^{-1} t\_2}\right|\\
\end{array}
\end{array}
if eh < -1.7499999999999999e131 or 2.4500000000000001e64 < eh Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in t around 0
Applied rewrites95.3%
if -1.7499999999999999e131 < eh < 2.4500000000000001e64Initial program 99.8%
Applied rewrites94.2%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fma.f64N/A
Applied rewrites95.8%
Final simplification95.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)) (t_2 (* t_1 eh)))
(if (or (<= eh -1.8e+132) (not (<= eh 2.45e+64)))
(fabs
(-
(* (* eh (sin t)) (sin (atan (/ (* (- eh) t) ew))))
(* (* (cos (atan t_2)) 1.0) ew)))
(fabs
(/ (fma (cos t) ew (* (* (* eh t_1) eh) (sin t))) (cosh (asinh t_2)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double t_2 = t_1 * eh;
double tmp;
if ((eh <= -1.8e+132) || !(eh <= 2.45e+64)) {
tmp = fabs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(t_2)) * 1.0) * ew)));
} else {
tmp = fabs((fma(cos(t), ew, (((eh * t_1) * eh) * sin(t))) / cosh(asinh(t_2))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) t_2 = Float64(t_1 * eh) tmp = 0.0 if ((eh <= -1.8e+132) || !(eh <= 2.45e+64)) tmp = abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(Float64(cos(atan(t_2)) * 1.0) * ew))); else tmp = abs(Float64(fma(cos(t), ew, Float64(Float64(Float64(eh * t_1) * eh) * sin(t))) / cosh(asinh(t_2)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * eh), $MachinePrecision]}, If[Or[LessEqual[eh, -1.8e+132], N[Not[LessEqual[eh, 2.45e+64]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[N[ArcTan[t$95$2], $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * ew + N[(N[(N[(eh * t$95$1), $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := t\_1 \cdot eh\\
\mathbf{if}\;eh \leq -1.8 \cdot 10^{+132} \lor \neg \left(eh \leq 2.45 \cdot 10^{+64}\right):\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \left(\cos \tan^{-1} t\_2 \cdot 1\right) \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t, ew, \left(\left(eh \cdot t\_1\right) \cdot eh\right) \cdot \sin t\right)}{\cosh \sinh^{-1} t\_2}\right|\\
\end{array}
\end{array}
if eh < -1.80000000000000008e132 or 2.4500000000000001e64 < eh Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in t around 0
Applied rewrites95.3%
if -1.80000000000000008e132 < eh < 2.4500000000000001e64Initial program 99.8%
Applied rewrites94.2%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.2
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6495.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.8
Applied rewrites95.8%
Final simplification95.6%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -8500000000.0) (not (<= eh 5e+60)))
(fabs
(-
(* (* eh (sin t)) (sin (atan (/ (* (- eh) t) ew))))
(* (* (cos (atan (* (/ (tan t) ew) eh))) 1.0) ew)))
(fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -8500000000.0) || !(eh <= 5e+60)) {
tmp = fabs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * 1.0) * ew)));
} else {
tmp = fabs((ew * cos(t)));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((eh <= (-8500000000.0d0)) .or. (.not. (eh <= 5d+60))) then
tmp = abs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * 1.0d0) * ew)))
else
tmp = abs((ew * cos(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -8500000000.0) || !(eh <= 5e+60)) {
tmp = Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * t) / ew)))) - ((Math.cos(Math.atan(((Math.tan(t) / ew) * eh))) * 1.0) * ew)));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -8500000000.0) or not (eh <= 5e+60): tmp = math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((-eh * t) / ew)))) - ((math.cos(math.atan(((math.tan(t) / ew) * eh))) * 1.0) * ew))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -8500000000.0) || !(eh <= 5e+60)) tmp = abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(Float64(cos(atan(Float64(Float64(tan(t) / ew) * eh))) * 1.0) * ew))); else tmp = abs(Float64(ew * cos(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -8500000000.0) || ~((eh <= 5e+60))) tmp = abs((((eh * sin(t)) * sin(atan(((-eh * t) / ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * 1.0) * ew))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -8500000000.0], N[Not[LessEqual[eh, 5e+60]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -8500000000 \lor \neg \left(eh \leq 5 \cdot 10^{+60}\right):\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \left(\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot 1\right) \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -8.5e9 or 4.99999999999999975e60 < eh Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6499.2
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites91.8%
if -8.5e9 < eh < 4.99999999999999975e60Initial program 99.8%
Applied rewrites96.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-cos.f6485.5
Applied rewrites85.5%
Final simplification88.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t))) (t_2 (* (- eh) (sin t))))
(if (or (<= eh -8500000000000.0) (not (<= eh 1e+117)))
(fabs (* t_2 (sin (atan (/ t_2 t_1)))))
(fabs t_1))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = -eh * sin(t);
double tmp;
if ((eh <= -8500000000000.0) || !(eh <= 1e+117)) {
tmp = fabs((t_2 * sin(atan((t_2 / t_1)))));
} else {
tmp = fabs(t_1);
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ew * cos(t)
t_2 = -eh * sin(t)
if ((eh <= (-8500000000000.0d0)) .or. (.not. (eh <= 1d+117))) then
tmp = abs((t_2 * sin(atan((t_2 / t_1)))))
else
tmp = abs(t_1)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.cos(t);
double t_2 = -eh * Math.sin(t);
double tmp;
if ((eh <= -8500000000000.0) || !(eh <= 1e+117)) {
tmp = Math.abs((t_2 * Math.sin(Math.atan((t_2 / t_1)))));
} else {
tmp = Math.abs(t_1);
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) t_2 = -eh * math.sin(t) tmp = 0 if (eh <= -8500000000000.0) or not (eh <= 1e+117): tmp = math.fabs((t_2 * math.sin(math.atan((t_2 / t_1))))) else: tmp = math.fabs(t_1) return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = Float64(Float64(-eh) * sin(t)) tmp = 0.0 if ((eh <= -8500000000000.0) || !(eh <= 1e+117)) tmp = abs(Float64(t_2 * sin(atan(Float64(t_2 / t_1))))); else tmp = abs(t_1); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); t_2 = -eh * sin(t); tmp = 0.0; if ((eh <= -8500000000000.0) || ~((eh <= 1e+117))) tmp = abs((t_2 * sin(atan((t_2 / t_1))))); else tmp = abs(t_1); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-eh) * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -8500000000000.0], N[Not[LessEqual[eh, 1e+117]], $MachinePrecision]], N[Abs[N[(t$95$2 * N[Sin[N[ArcTan[N[(t$95$2 / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[t$95$1], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \left(-eh\right) \cdot \sin t\\
\mathbf{if}\;eh \leq -8500000000000 \lor \neg \left(eh \leq 10^{+117}\right):\\
\;\;\;\;\left|t\_2 \cdot \sin \tan^{-1} \left(\frac{t\_2}{t\_1}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1\right|\\
\end{array}
\end{array}
if eh < -8.5e12 or 1.00000000000000005e117 < eh Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6474.3
Applied rewrites74.3%
if -8.5e12 < eh < 1.00000000000000005e117Initial program 99.8%
Applied rewrites96.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-cos.f6484.3
Applied rewrites84.3%
Final simplification80.0%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (cos t))))
double code(double eh, double ew, double t) {
return fabs((ew * cos(t)));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((ew * cos(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.cos(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.cos(t)))
function code(eh, ew, t) return abs(Float64(ew * cos(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * cos(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t\right|
\end{array}
Initial program 99.8%
Applied rewrites69.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-cos.f6461.2
Applied rewrites61.2%
(FPCore (eh ew t) :precision binary64 (fabs (* 1.0 ew)))
double code(double eh, double ew, double t) {
return fabs((1.0 * ew));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((1.0d0 * ew))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((1.0 * ew));
}
def code(eh, ew, t): return math.fabs((1.0 * ew))
function code(eh, ew, t) return abs(Float64(1.0 * ew)) end
function tmp = code(eh, ew, t) tmp = abs((1.0 * ew)); end
code[eh_, ew_, t_] := N[Abs[N[(1.0 * ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|1 \cdot ew\right|
\end{array}
Initial program 99.8%
Applied rewrites69.1%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6430.7
Applied rewrites30.7%
Taylor expanded in ew around inf
Applied rewrites35.8%
Taylor expanded in t around 0
Applied rewrites39.6%
herbie shell --seed 2024340
(FPCore (eh ew t)
:name "Example 2 from Robby"
:precision binary64
(fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))