
(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 (/ (* (tan t) eh) (- 0.0 ew))))) (/ (* ew (cos t)) (hypot 1.0 (/ (tan t) (/ ew eh)))))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew))))) - ((ew * cos(t)) / hypot(1.0, (tan(t) / (ew / eh))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * eh) / (0.0 - ew))))) - ((ew * Math.cos(t)) / Math.hypot(1.0, (Math.tan(t) / (ew / eh))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / (0.0 - ew))))) - ((ew * math.cos(t)) / math.hypot(1.0, (math.tan(t) / (ew / eh))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew))))) - Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(tan(t) / Float64(ew / eh)))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew))))) - ((ew * cos(t)) / hypot(1.0, (tan(t) / (ew / eh)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] / N[(ew / eh), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right) - \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)}\right|
\end{array}
Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f6499.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* ew (cos t)) (cos (atan (/ (* (tan t) eh) (- 0.0 ew))))) (* (* eh (sin t)) (sin (atan (- 0.0 (/ (* t eh) ew))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * cos(atan(((tan(t) * eh) / (0.0 - ew))))) - ((eh * sin(t)) * sin(atan((0.0 - ((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) / (0.0d0 - ew))))) - ((eh * sin(t)) * sin(atan((0.0d0 - ((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) / (0.0 - ew))))) - ((eh * Math.sin(t)) * Math.sin(Math.atan((0.0 - ((t * eh) / ew)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) * math.cos(math.atan(((math.tan(t) * eh) / (0.0 - ew))))) - ((eh * math.sin(t)) * math.sin(math.atan((0.0 - ((t * eh) / ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew))))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(0.0 - Float64(Float64(t * eh) / ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) * cos(atan(((tan(t) * eh) / (0.0 - ew))))) - ((eh * sin(t)) * sin(atan((0.0 - ((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] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(0.0 - N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]), $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 eh}{0 - ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(0 - \frac{t \cdot eh}{ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
Simplified99.6%
Final simplification99.6%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (/ (tan t) (/ ew eh))) (cos t))) (* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) (- 0.0 ew))))))))
double code(double eh, double ew, double t) {
return fabs(((ew / (hypot(1.0, (tan(t) / (ew / eh))) / cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew / (Math.hypot(1.0, (Math.tan(t) / (ew / eh))) / Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * eh) / (0.0 - ew)))))));
}
def code(eh, ew, t): return math.fabs(((ew / (math.hypot(1.0, (math.tan(t) / (ew / eh))) / math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / (0.0 - ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(tan(t) / Float64(ew / eh))) / cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew / (hypot(1.0, (tan(t) / (ew / eh))) / cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] / N[(ew / eh), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)}{\cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right)\right|
\end{array}
Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.7%
Applied egg-rr99.7%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
Applied egg-rr99.7%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f6499.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ 1.0 (/ (/ (hypot 1.0 (/ (tan t) (/ ew eh))) (cos t)) ew)) (* (* eh (sin t)) (sin (atan (- 0.0 (/ (* t eh) ew))))))))
double code(double eh, double ew, double t) {
return fabs(((1.0 / ((hypot(1.0, (tan(t) / (ew / eh))) / cos(t)) / ew)) - ((eh * sin(t)) * sin(atan((0.0 - ((t * eh) / ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((1.0 / ((Math.hypot(1.0, (Math.tan(t) / (ew / eh))) / Math.cos(t)) / ew)) - ((eh * Math.sin(t)) * Math.sin(Math.atan((0.0 - ((t * eh) / ew)))))));
}
def code(eh, ew, t): return math.fabs(((1.0 / ((math.hypot(1.0, (math.tan(t) / (ew / eh))) / math.cos(t)) / ew)) - ((eh * math.sin(t)) * math.sin(math.atan((0.0 - ((t * eh) / ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(1.0 / Float64(Float64(hypot(1.0, Float64(tan(t) / Float64(ew / eh))) / cos(t)) / ew)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(0.0 - Float64(Float64(t * eh) / ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((1.0 / ((hypot(1.0, (tan(t) / (ew / eh))) / cos(t)) / ew)) - ((eh * sin(t)) * sin(atan((0.0 - ((t * eh) / ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(1.0 / N[(N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] / N[(ew / eh), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(0.0 - N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\frac{\frac{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)}{\cos t}}{ew}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(0 - \frac{t \cdot eh}{ew}\right)\right|
\end{array}
Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.7%
Applied egg-rr99.7%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
Applied egg-rr99.7%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6499.5%
Simplified99.5%
Final simplification99.5%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ 1.0 (/ 1.0 (* ew (cos t)))) (* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) (- 0.0 ew))))))))
double code(double eh, double ew, double t) {
return fabs(((1.0 / (1.0 / (ew * cos(t)))) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.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 / (1.0d0 / (ew * cos(t)))) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0d0 - ew)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((1.0 / (1.0 / (ew * Math.cos(t)))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * eh) / (0.0 - ew)))))));
}
def code(eh, ew, t): return math.fabs(((1.0 / (1.0 / (ew * math.cos(t)))) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / (0.0 - ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(1.0 / Float64(1.0 / Float64(ew * cos(t)))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((1.0 / (1.0 / (ew * cos(t)))) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(1.0 / N[(1.0 / N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\frac{1}{ew \cdot \cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right)\right|
\end{array}
Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.7%
Applied egg-rr99.7%
Taylor expanded in t around 0
Simplified99.2%
Final simplification99.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* ew (cos t)))))
(if (<= ew -3.3e+66)
t_1
(if (<= ew 4.2e+129)
(fabs
(- ew (* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) (- 0.0 ew)))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (ew <= -3.3e+66) {
tmp = t_1;
} else if (ew <= 4.2e+129) {
tmp = fabs((ew - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew)))))));
} else {
tmp = 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) :: tmp
t_1 = abs((ew * cos(t)))
if (ew <= (-3.3d+66)) then
tmp = t_1
else if (ew <= 4.2d+129) then
tmp = abs((ew - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0d0 - ew)))))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((ew * Math.cos(t)));
double tmp;
if (ew <= -3.3e+66) {
tmp = t_1;
} else if (ew <= 4.2e+129) {
tmp = Math.abs((ew - ((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * eh) / (0.0 - ew)))))));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.cos(t))) tmp = 0 if ew <= -3.3e+66: tmp = t_1 elif ew <= 4.2e+129: tmp = math.fabs((ew - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / (0.0 - ew))))))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * cos(t))) tmp = 0.0 if (ew <= -3.3e+66) tmp = t_1; elseif (ew <= 4.2e+129) tmp = abs(Float64(ew - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew))))))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * cos(t))); tmp = 0.0; if (ew <= -3.3e+66) tmp = t_1; elseif (ew <= 4.2e+129) tmp = abs((ew - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew))))))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.3e+66], t$95$1, If[LessEqual[ew, 4.2e+129], N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -3.3 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 4.2 \cdot 10^{+129}:\\
\;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -3.3000000000000001e66 or 4.19999999999999993e129 < ew Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f6492.8%
Simplified92.8%
if -3.3000000000000001e66 < ew < 4.19999999999999993e129Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified91.7%
Final simplification92.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= eh -2.4e+56) t_1 (if (<= eh 3.3e+40) (fabs (* ew (cos t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -2.4e+56) {
tmp = t_1;
} else if (eh <= 3.3e+40) {
tmp = fabs((ew * cos(t)));
} else {
tmp = 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) :: tmp
t_1 = abs((eh * sin(t)))
if (eh <= (-2.4d+56)) then
tmp = t_1
else if (eh <= 3.3d+40) then
tmp = abs((ew * cos(t)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((eh * Math.sin(t)));
double tmp;
if (eh <= -2.4e+56) {
tmp = t_1;
} else if (eh <= 3.3e+40) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.sin(t))) tmp = 0 if eh <= -2.4e+56: tmp = t_1 elif eh <= 3.3e+40: tmp = math.fabs((ew * math.cos(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -2.4e+56) tmp = t_1; elseif (eh <= 3.3e+40) tmp = abs(Float64(ew * cos(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * sin(t))); tmp = 0.0; if (eh <= -2.4e+56) tmp = t_1; elseif (eh <= 3.3e+40) tmp = abs((ew * cos(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -2.4e+56], t$95$1, If[LessEqual[eh, 3.3e+40], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -2.4 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 3.3 \cdot 10^{+40}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -2.40000000000000013e56 or 3.2999999999999998e40 < eh Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.7%
Applied egg-rr99.7%
Applied egg-rr58.0%
Taylor expanded in ew around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6474.3%
Simplified74.3%
if -2.40000000000000013e56 < eh < 3.2999999999999998e40Initial program 99.9%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.9%
Taylor expanded in ew around inf
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f6488.6%
Simplified88.6%
Final simplification82.2%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= eh -3.3e+53) t_1 (if (<= eh 1.2e+38) (fabs ew) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -3.3e+53) {
tmp = t_1;
} else if (eh <= 1.2e+38) {
tmp = fabs(ew);
} else {
tmp = 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) :: tmp
t_1 = abs((eh * sin(t)))
if (eh <= (-3.3d+53)) then
tmp = t_1
else if (eh <= 1.2d+38) then
tmp = abs(ew)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((eh * Math.sin(t)));
double tmp;
if (eh <= -3.3e+53) {
tmp = t_1;
} else if (eh <= 1.2e+38) {
tmp = Math.abs(ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.sin(t))) tmp = 0 if eh <= -3.3e+53: tmp = t_1 elif eh <= 1.2e+38: tmp = math.fabs(ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -3.3e+53) tmp = t_1; elseif (eh <= 1.2e+38) tmp = abs(ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * sin(t))); tmp = 0.0; if (eh <= -3.3e+53) tmp = t_1; elseif (eh <= 1.2e+38) tmp = abs(ew); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -3.3e+53], t$95$1, If[LessEqual[eh, 1.2e+38], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -3.3 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.2 \cdot 10^{+38}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -3.3000000000000002e53 or 1.20000000000000009e38 < eh Initial program 99.8%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.7%
Applied egg-rr99.7%
Applied egg-rr58.0%
Taylor expanded in ew around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6474.3%
Simplified74.3%
if -3.3000000000000002e53 < eh < 1.20000000000000009e38Initial program 99.9%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified63.8%
(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%
cos-atanN/A
/-lowering-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
frac-2negN/A
distribute-frac-neg2N/A
sqr-negN/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified45.6%
herbie shell --seed 2024138
(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)))))))