
(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 13 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 (let* ((t_1 (atan (* (tan t) (/ (- eh) ew))))) (fabs (fma ew (* (cos t_1) (- (cos t))) (* eh (* (sin t) (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((tan(t) * (-eh / ew)));
return fabs(fma(ew, (cos(t_1) * -cos(t)), (eh * (sin(t) * sin(t_1)))));
}
function code(eh, ew, t) t_1 = atan(Float64(tan(t) * Float64(Float64(-eh) / ew))) return abs(fma(ew, Float64(cos(t_1) * Float64(-cos(t))), Float64(eh * Float64(sin(t) * sin(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(ew * N[(N[Cos[t$95$1], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] + N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\\
\left|\mathsf{fma}\left(ew, \cos t_1 \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin t_1\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* ew (cos t)) (/ 1.0 (hypot 1.0 (* (tan t) (/ eh ew))))) (* eh (* (sin t) (sin (atan (* (tan t) (/ (- eh) ew)))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * (1.0 / hypot(1.0, (tan(t) * (eh / ew))))) - (eh * (sin(t) * sin(atan((tan(t) * (-eh / ew))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.cos(t)) * (1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew))))) - (eh * (Math.sin(t) * Math.sin(Math.atan((Math.tan(t) * (-eh / ew))))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) * (1.0 / math.hypot(1.0, (math.tan(t) * (eh / ew))))) - (eh * (math.sin(t) * math.sin(math.atan((math.tan(t) * (-eh / ew))))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) * Float64(1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(tan(t) * Float64(Float64(-eh) / ew)))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) * (1.0 / hypot(1.0, (tan(t) * (eh / ew))))) - (eh * (sin(t) * sin(atan((tan(t) * (-eh / ew)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in eh around 0 99.8%
mul-1-neg99.8%
associate-*l/99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac99.8%
Simplified99.8%
*-commutative99.8%
distribute-rgt-neg-out99.8%
distribute-lft-neg-out99.8%
associate-*r/99.8%
cos-atan99.8%
hypot-1-def99.8%
add-sqr-sqrt52.6%
sqrt-unprod96.3%
sqr-neg96.3%
sqrt-unprod47.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* ew (cos t)) (/ 1.0 (hypot 1.0 (* (tan t) (/ eh ew))))) (* eh (* (sin t) (sin (atan (/ (tan t) (/ (- ew) eh)))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * (1.0 / hypot(1.0, (tan(t) * (eh / ew))))) - (eh * (sin(t) * sin(atan((tan(t) / (-ew / eh))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.cos(t)) * (1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew))))) - (eh * (Math.sin(t) * Math.sin(Math.atan((Math.tan(t) / (-ew / eh))))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) * (1.0 / math.hypot(1.0, (math.tan(t) * (eh / ew))))) - (eh * (math.sin(t) * math.sin(math.atan((math.tan(t) / (-ew / eh))))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) * Float64(1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(tan(t) / Float64(Float64(-ew) / eh)))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) * (1.0 / hypot(1.0, (tan(t) * (eh / ew))))) - (eh * (sin(t) * sin(atan((tan(t) / (-ew / eh)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] / N[((-ew) / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\tan t}{\frac{-ew}{eh}}\right)\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in eh around 0 99.8%
mul-1-neg99.8%
associate-*l/99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac99.8%
Simplified99.8%
*-commutative99.8%
distribute-rgt-neg-out99.8%
distribute-lft-neg-out99.8%
associate-*r/99.8%
cos-atan99.8%
hypot-1-def99.8%
add-sqr-sqrt52.6%
sqrt-unprod96.3%
sqr-neg96.3%
sqrt-unprod47.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
distribute-frac-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-out99.8%
add-sqr-sqrt52.6%
sqrt-unprod94.3%
sqr-neg94.3%
sqrt-unprod47.1%
add-sqr-sqrt98.8%
associate-*r/98.8%
frac-2neg98.8%
distribute-lft-neg-out98.8%
add-sqr-sqrt51.7%
sqrt-unprod93.7%
sqr-neg93.7%
sqrt-unprod47.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
associate-/l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* ew (cos t)) (cos (atan (/ (* (tan t) (- eh)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* t (- eh)) ew)))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * cos(atan(((tan(t) * -eh) / ew)))) - ((eh * sin(t)) * sin(atan(((t * -eh) / 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((((ew * cos(t)) * cos(atan(((tan(t) * -eh) / ew)))) - ((eh * sin(t)) * sin(atan(((t * -eh) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.cos(t)) * Math.cos(Math.atan(((Math.tan(t) * -eh) / ew)))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((t * -eh) / ew))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) * math.cos(math.atan(((math.tan(t) * -eh) / ew)))) - ((eh * math.sin(t)) * math.sin(math.atan(((t * -eh) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew)))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(t * Float64(-eh)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) * cos(atan(((tan(t) * -eh) / ew)))) - ((eh * sin(t)) * sin(atan(((t * -eh) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 98.9%
associate-*r/59.5%
*-commutative59.5%
associate-*r*59.5%
neg-mul-159.5%
Simplified98.9%
Final simplification98.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (tan t) (/ eh ew))))
(if (<= eh -1.28e+50)
(fabs
(-
(* ew (cos (atan t_1)))
(* (* eh (sin t)) (sin (atan (/ (* (tan t) (- eh)) ew))))))
(if (<= eh 42000000000.0)
(fabs
(* (* ew (cos t)) (cos (atan (/ (cbrt (pow (* (tan t) eh) 3.0)) ew)))))
(fabs
(-
(* ew (/ 1.0 (hypot 1.0 t_1)))
(* eh (* (sin t) (sin (atan (* (tan t) (/ (- eh) ew))))))))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) * (eh / ew);
double tmp;
if (eh <= -1.28e+50) {
tmp = fabs(((ew * cos(atan(t_1))) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew))))));
} else if (eh <= 42000000000.0) {
tmp = fabs(((ew * cos(t)) * cos(atan((cbrt(pow((tan(t) * eh), 3.0)) / ew)))));
} else {
tmp = fabs(((ew * (1.0 / hypot(1.0, t_1))) - (eh * (sin(t) * sin(atan((tan(t) * (-eh / ew))))))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) * (eh / ew);
double tmp;
if (eh <= -1.28e+50) {
tmp = Math.abs(((ew * Math.cos(Math.atan(t_1))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * -eh) / ew))))));
} else if (eh <= 42000000000.0) {
tmp = Math.abs(((ew * Math.cos(t)) * Math.cos(Math.atan((Math.cbrt(Math.pow((Math.tan(t) * eh), 3.0)) / ew)))));
} else {
tmp = Math.abs(((ew * (1.0 / Math.hypot(1.0, t_1))) - (eh * (Math.sin(t) * Math.sin(Math.atan((Math.tan(t) * (-eh / ew))))))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) * Float64(eh / ew)) tmp = 0.0 if (eh <= -1.28e+50) tmp = abs(Float64(Float64(ew * cos(atan(t_1))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew)))))); elseif (eh <= 42000000000.0) tmp = abs(Float64(Float64(ew * cos(t)) * cos(atan(Float64(cbrt((Float64(tan(t) * eh) ^ 3.0)) / ew))))); else tmp = abs(Float64(Float64(ew * Float64(1.0 / hypot(1.0, t_1))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(tan(t) * Float64(Float64(-eh) / ew)))))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -1.28e+50], N[Abs[N[(N[(ew * N[Cos[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 42000000000.0], N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[Power[N[Power[N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[(1.0 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan t \cdot \frac{eh}{ew}\\
\mathbf{if}\;eh \leq -1.28 \cdot 10^{+50}:\\
\;\;\;\;\left|ew \cdot \cos \tan^{-1} t_1 - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right)\right|\\
\mathbf{elif}\;eh \leq 42000000000:\\
\;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\sqrt[3]{{\left(\tan t \cdot eh\right)}^{3}}}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \frac{1}{\mathsf{hypot}\left(1, t_1\right)} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|\\
\end{array}
\end{array}
if eh < -1.28000000000000006e50Initial program 99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
associate-*l/99.8%
add-sqr-sqrt57.2%
sqrt-unprod90.5%
sqr-neg90.5%
sqrt-unprod42.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 91.5%
if -1.28000000000000006e50 < eh < 4.2e10Initial program 99.8%
Applied egg-rr87.8%
+-inverses87.8%
*-commutative87.8%
associate-/l*87.8%
div087.8%
Simplified87.8%
add-cbrt-cube87.8%
pow387.8%
*-commutative87.8%
add-sqr-sqrt44.2%
sqrt-unprod87.8%
sqr-neg87.8%
sqrt-unprod43.6%
add-sqr-sqrt87.8%
Applied egg-rr87.8%
if 4.2e10 < eh Initial program 99.8%
Taylor expanded in eh around 0 99.8%
mul-1-neg99.8%
associate-*l/99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac99.8%
Simplified99.8%
*-commutative99.8%
distribute-rgt-neg-out99.8%
distribute-lft-neg-out99.8%
associate-*r/99.8%
cos-atan99.8%
hypot-1-def99.8%
add-sqr-sqrt55.4%
sqrt-unprod92.4%
sqr-neg92.4%
sqrt-unprod44.4%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 95.6%
Final simplification90.2%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -3.75e+50) (not (<= eh 126000000000.0)))
(fabs
(-
(* ew (/ 1.0 (hypot 1.0 (* (tan t) (/ eh ew)))))
(* eh (* (sin t) (sin (atan (* (tan t) (/ (- eh) ew))))))))
(fabs
(* (* ew (cos t)) (cos (atan (/ (cbrt (pow (* (tan t) eh) 3.0)) ew)))))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -3.75e+50) || !(eh <= 126000000000.0)) {
tmp = fabs(((ew * (1.0 / hypot(1.0, (tan(t) * (eh / ew))))) - (eh * (sin(t) * sin(atan((tan(t) * (-eh / ew))))))));
} else {
tmp = fabs(((ew * cos(t)) * cos(atan((cbrt(pow((tan(t) * eh), 3.0)) / ew)))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -3.75e+50) || !(eh <= 126000000000.0)) {
tmp = Math.abs(((ew * (1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew))))) - (eh * (Math.sin(t) * Math.sin(Math.atan((Math.tan(t) * (-eh / ew))))))));
} else {
tmp = Math.abs(((ew * Math.cos(t)) * Math.cos(Math.atan((Math.cbrt(Math.pow((Math.tan(t) * eh), 3.0)) / ew)))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((eh <= -3.75e+50) || !(eh <= 126000000000.0)) tmp = abs(Float64(Float64(ew * Float64(1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(tan(t) * Float64(Float64(-eh) / ew)))))))); else tmp = abs(Float64(Float64(ew * cos(t)) * cos(atan(Float64(cbrt((Float64(tan(t) * eh) ^ 3.0)) / ew))))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -3.75e+50], N[Not[LessEqual[eh, 126000000000.0]], $MachinePrecision]], N[Abs[N[(N[(ew * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[Power[N[Power[N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -3.75 \cdot 10^{+50} \lor \neg \left(eh \leq 126000000000\right):\\
\;\;\;\;\left|ew \cdot \frac{1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\sqrt[3]{{\left(\tan t \cdot eh\right)}^{3}}}{ew}\right)\right|\\
\end{array}
\end{array}
if eh < -3.75e50 or 1.26e11 < eh Initial program 99.8%
Taylor expanded in eh around 0 99.8%
mul-1-neg99.8%
associate-*l/99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac99.8%
Simplified99.8%
*-commutative99.8%
distribute-rgt-neg-out99.8%
distribute-lft-neg-out99.8%
associate-*r/99.8%
cos-atan99.8%
hypot-1-def99.8%
add-sqr-sqrt56.3%
sqrt-unprod91.4%
sqr-neg91.4%
sqrt-unprod43.4%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 93.6%
if -3.75e50 < eh < 1.26e11Initial program 99.8%
Applied egg-rr87.8%
+-inverses87.8%
*-commutative87.8%
associate-/l*87.8%
div087.8%
Simplified87.8%
add-cbrt-cube87.8%
pow387.8%
*-commutative87.8%
add-sqr-sqrt44.2%
sqrt-unprod87.8%
sqr-neg87.8%
sqrt-unprod43.6%
add-sqr-sqrt87.8%
Applied egg-rr87.8%
Final simplification90.2%
(FPCore (eh ew t) :precision binary64 (fabs (* (* ew (cos t)) (pow (cbrt (cos (atan (* (tan t) (/ eh ew))))) 3.0))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) * pow(cbrt(cos(atan((tan(t) * (eh / ew))))), 3.0)));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) * Math.pow(Math.cbrt(Math.cos(Math.atan((Math.tan(t) * (eh / ew))))), 3.0)));
}
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) * (cbrt(cos(atan(Float64(tan(t) * Float64(eh / ew))))) ^ 3.0))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Power[N[Power[N[Cos[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot {\left(\sqrt[3]{\cos \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)}\right)}^{3}\right|
\end{array}
Initial program 99.8%
Applied egg-rr68.8%
+-inverses68.8%
*-commutative68.8%
associate-/l*68.8%
div068.8%
Simplified68.8%
add-cube-cbrt68.8%
pow368.8%
*-commutative68.8%
associate-/l*68.8%
add-sqr-sqrt34.8%
sqrt-unprod62.4%
sqr-neg62.4%
sqrt-unprod34.0%
add-sqr-sqrt68.8%
un-div-inv68.8%
clear-num68.8%
Applied egg-rr68.8%
Final simplification68.8%
(FPCore (eh ew t) :precision binary64 (fabs (* (* ew (cos t)) (expm1 (log1p (cos (atan (* (tan t) (/ eh ew)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) * expm1(log1p(cos(atan((tan(t) * (eh / ew))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) * Math.expm1(Math.log1p(Math.cos(Math.atan((Math.tan(t) * (eh / ew))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) * math.expm1(math.log1p(math.cos(math.atan((math.tan(t) * (eh / ew))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) * expm1(log1p(cos(atan(Float64(tan(t) * Float64(eh / ew)))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[(Exp[N[Log[1 + N[Cos[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)\right)\right|
\end{array}
Initial program 99.8%
Applied egg-rr68.8%
+-inverses68.8%
*-commutative68.8%
associate-/l*68.8%
div068.8%
Simplified68.8%
expm1-log1p-u68.8%
*-commutative68.8%
associate-/l*68.8%
add-sqr-sqrt34.8%
sqrt-unprod62.4%
sqr-neg62.4%
sqrt-unprod34.0%
add-sqr-sqrt68.8%
un-div-inv68.8%
clear-num68.8%
Applied egg-rr68.8%
Final simplification68.8%
(FPCore (eh ew t) :precision binary64 (fabs (* (* ew (cos t)) (cos (atan (/ (* (tan t) eh) ew))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) * cos(atan(((tan(t) * eh) / 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(((ew * cos(t)) * cos(atan(((tan(t) * eh) / ew)))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) * Math.cos(Math.atan(((Math.tan(t) * eh) / ew)))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) * math.cos(math.atan(((math.tan(t) * eh) / ew)))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(tan(t) * eh) / ew))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) * cos(atan(((tan(t) * eh) / ew))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\tan t \cdot eh}{ew}\right)\right|
\end{array}
Initial program 99.8%
Applied egg-rr68.8%
+-inverses68.8%
*-commutative68.8%
associate-/l*68.8%
div068.8%
Simplified68.8%
expm1-log1p-u61.7%
expm1-udef61.7%
*-commutative61.7%
add-sqr-sqrt28.6%
sqrt-unprod56.5%
sqr-neg56.5%
sqrt-unprod31.4%
add-sqr-sqrt63.3%
Applied egg-rr63.3%
expm1-def63.2%
expm1-log1p68.8%
*-commutative68.8%
Simplified68.8%
Final simplification68.8%
(FPCore (eh ew t) :precision binary64 (fabs (* (* ew (cos t)) (cos (atan (/ (* t (- eh)) ew))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) * cos(atan(((t * -eh) / 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(((ew * cos(t)) * cos(atan(((t * -eh) / ew)))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) * Math.cos(Math.atan(((t * -eh) / ew)))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) * math.cos(math.atan(((t * -eh) / ew)))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(t * Float64(-eh)) / ew))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) * cos(atan(((t * -eh) / ew))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
Applied egg-rr68.8%
+-inverses68.8%
*-commutative68.8%
associate-/l*68.8%
div068.8%
Simplified68.8%
Taylor expanded in t around 0 59.5%
associate-*r/59.5%
*-commutative59.5%
associate-*r*59.5%
neg-mul-159.5%
Simplified59.5%
Final simplification59.5%
(FPCore (eh ew t) :precision binary64 (fabs (/ ew (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t)))))
double code(double eh, double ew, double t) {
return fabs((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((ew / (Math.hypot(1.0, (Math.tan(t) * (eh / ew))) / Math.cos(t))));
}
def code(eh, ew, t): return math.fabs((ew / (math.hypot(1.0, (math.tan(t) * (eh / ew))) / math.cos(t))))
function code(eh, ew, t) return abs(Float64(ew / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t)))) end
function tmp = code(eh, ew, t) tmp = abs((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t)))); end
code[eh_, ew_, t_] := N[Abs[N[(ew / N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}}\right|
\end{array}
Initial program 99.8%
Applied egg-rr68.8%
+-inverses68.8%
*-commutative68.8%
associate-/l*68.8%
div068.8%
Simplified68.8%
expm1-log1p-u68.8%
*-commutative68.8%
associate-/l*68.8%
add-sqr-sqrt34.8%
sqrt-unprod62.4%
sqr-neg62.4%
sqrt-unprod34.0%
add-sqr-sqrt68.8%
un-div-inv68.8%
clear-num68.8%
Applied egg-rr68.8%
Applied egg-rr23.9%
expm1-def41.7%
expm1-log1p68.5%
associate-/r/68.5%
Simplified68.5%
Final simplification68.5%
(FPCore (eh ew t) :precision binary64 (fabs (/ (* ew (cos t)) (hypot 1.0 (* (tan t) (/ eh ew))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew)))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) / Math.hypot(1.0, (Math.tan(t) * (eh / ew)))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) / math.hypot(1.0, (math.tan(t) * (eh / ew)))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right|
\end{array}
Initial program 99.8%
Applied egg-rr68.8%
+-inverses68.8%
*-commutative68.8%
associate-/l*68.8%
div068.8%
Simplified68.8%
expm1-log1p-u68.8%
*-commutative68.8%
associate-/l*68.8%
add-sqr-sqrt34.8%
sqrt-unprod62.4%
sqr-neg62.4%
sqrt-unprod34.0%
add-sqr-sqrt68.8%
un-div-inv68.8%
clear-num68.8%
Applied egg-rr68.8%
expm1-log1p-u68.8%
cos-atan68.5%
un-div-inv68.5%
hypot-1-def68.5%
Applied egg-rr68.5%
Final simplification68.5%
(FPCore (eh ew t) :precision binary64 (fabs ew))
double code(double eh, double ew, double t) {
return fabs(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(ew)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(ew);
}
def code(eh, ew, t): return math.fabs(ew)
function code(eh, ew, t) return abs(ew) end
function tmp = code(eh, ew, t) tmp = abs(ew); end
code[eh_, ew_, t_] := N[Abs[ew], $MachinePrecision]
\begin{array}{l}
\\
\left|ew\right|
\end{array}
Initial program 99.8%
Applied egg-rr68.8%
+-inverses68.8%
*-commutative68.8%
associate-/l*68.8%
div068.8%
Simplified68.8%
Taylor expanded in t around 0 47.1%
add-cbrt-cube19.7%
pow1/310.4%
Applied egg-rr10.3%
Taylor expanded in ew around inf 47.3%
Final simplification47.3%
herbie shell --seed 2023293
(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)))))))