
(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 (fma (/ ew (hypot 1.0 (/ eh (/ ew (tan t))))) (cos t) (* (sin (atan (/ eh (* ew (/ -1.0 (tan t)))))) (* (sin t) (- 0.0 eh))))))
double code(double eh, double ew, double t) {
return fabs(fma((ew / hypot(1.0, (eh / (ew / tan(t))))), cos(t), (sin(atan((eh / (ew * (-1.0 / tan(t)))))) * (sin(t) * (0.0 - eh)))));
}
function code(eh, ew, t) return abs(fma(Float64(ew / hypot(1.0, Float64(eh / Float64(ew / tan(t))))), cos(t), Float64(sin(atan(Float64(eh / Float64(ew * Float64(-1.0 / tan(t)))))) * Float64(sin(t) * Float64(0.0 - eh))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(eh / N[(ew * N[(-1.0 / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * N[(0.0 - eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{\frac{ew}{\tan t}}\right)}, \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \frac{-1}{\tan t}}\right) \cdot \left(\sin t \cdot \left(0 - eh\right)\right)\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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ (* ew (cos t)) (hypot 1.0 (/ eh (/ ew (tan t))))) (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- 0.0 ew))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) / hypot(1.0, (eh / (ew / tan(t))))) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0 - ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.cos(t)) / Math.hypot(1.0, (eh / (ew / Math.tan(t))))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / (0.0 - ew)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) / math.hypot(1.0, (eh / (ew / math.tan(t))))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / (0.0 - ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(eh / Float64(ew / tan(t))))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * tan(t)) / Float64(0.0 - ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) / hypot(1.0, (eh / (ew / tan(t))))) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0 - ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{eh}{\frac{ew}{\tan t}}\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
/-rgt-identityN/A
/-rgt-identityN/A
metadata-evalN/A
sqr-negN/A
div-invN/A
clear-numN/A
distribute-lft-neg-outN/A
associate-/l*N/A
div-invN/A
clear-numN/A
distribute-lft-neg-outN/A
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (/ eh (/ ew (tan t)))) (cos t))) (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- 0.0 ew))))))))
double code(double eh, double ew, double t) {
return fabs(((ew / (hypot(1.0, (eh / (ew / tan(t)))) / cos(t))) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0 - ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew / (Math.hypot(1.0, (eh / (ew / Math.tan(t)))) / Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / (0.0 - ew)))))));
}
def code(eh, ew, t): return math.fabs(((ew / (math.hypot(1.0, (eh / (ew / math.tan(t)))) / math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / (0.0 - ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(eh / Float64(ew / tan(t)))) / cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * tan(t)) / Float64(0.0 - ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew / (hypot(1.0, (eh / (ew / tan(t)))) / cos(t))) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0 - ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[(N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{\frac{ew}{\tan t}}\right)}{\cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
Applied egg-rr99.7%
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.6%
Applied egg-rr99.6%
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
cos-lowering-cos.f6499.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (eh ew t)
:precision binary64
(fabs
(-
(* (* ew (cos t)) (/ 1.0 (hypot 1.0 (/ eh (/ ew (tan t))))))
(*
(* eh (sin t))
(sin
(atan
(/
(*
t
(-
(*
(* t t)
(* eh (+ -0.3333333333333333 (* (* t t) -0.13333333333333333))))
eh))
ew)))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * (1.0 / hypot(1.0, (eh / (ew / tan(t)))))) - ((eh * sin(t)) * sin(atan(((t * (((t * t) * (eh * (-0.3333333333333333 + ((t * t) * -0.13333333333333333)))) - 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, (eh / (ew / Math.tan(t)))))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((t * (((t * t) * (eh * (-0.3333333333333333 + ((t * t) * -0.13333333333333333)))) - eh)) / ew))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) * (1.0 / math.hypot(1.0, (eh / (ew / math.tan(t)))))) - ((eh * math.sin(t)) * math.sin(math.atan(((t * (((t * t) * (eh * (-0.3333333333333333 + ((t * t) * -0.13333333333333333)))) - eh)) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) * Float64(1.0 / hypot(1.0, Float64(eh / Float64(ew / tan(t)))))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(t * Float64(Float64(Float64(t * t) * Float64(eh * Float64(-0.3333333333333333 + Float64(Float64(t * t) * -0.13333333333333333)))) - eh)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) * (1.0 / hypot(1.0, (eh / (ew / tan(t)))))) - ((eh * sin(t)) * sin(atan(((t * (((t * t) * (eh * (-0.3333333333333333 + ((t * t) * -0.13333333333333333)))) - 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[(eh / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(t * N[(N[(N[(t * t), $MachinePrecision] * N[(eh * N[(-0.3333333333333333 + N[(N[(t * t), $MachinePrecision] * -0.13333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eh), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{eh}{\frac{ew}{\tan t}}\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(\left(t \cdot t\right) \cdot \left(eh \cdot \left(-0.3333333333333333 + \left(t \cdot t\right) \cdot -0.13333333333333333\right)\right) - eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
*-lowering-*.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.0%
Simplified99.0%
cos-atanN/A
/-lowering-/.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
clear-numN/A
div-invN/A
associate-/l*N/A
distribute-lft-neg-outN/A
clear-numN/A
div-invN/A
sqr-negN/A
hypot-1-defN/A
Applied egg-rr99.0%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- 0.0 ew))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (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(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0d0 - ew)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / (0.0 - ew)))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / (0.0 - ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * tan(t)) / Float64(0.0 - ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0 - ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6498.5%
Simplified98.5%
Final simplification98.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* ew (cos t)))))
(if (<= ew -420000.0)
t_1
(if (<= ew 210.0)
(fabs
(- ew (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- 0.0 ew)))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (ew <= -420000.0) {
tmp = t_1;
} else if (ew <= 210.0) {
tmp = fabs((ew - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (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 <= (-420000.0d0)) then
tmp = t_1
else if (ew <= 210.0d0) then
tmp = abs((ew - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (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 <= -420000.0) {
tmp = t_1;
} else if (ew <= 210.0) {
tmp = Math.abs((ew - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / (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 <= -420000.0: tmp = t_1 elif ew <= 210.0: tmp = math.fabs((ew - ((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / (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 <= -420000.0) tmp = t_1; elseif (ew <= 210.0) tmp = abs(Float64(ew - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * tan(t)) / 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 <= -420000.0) tmp = t_1; elseif (ew <= 210.0) tmp = abs((ew - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (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, -420000.0], t$95$1, If[LessEqual[ew, 210.0], N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $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 -420000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 210:\\
\;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -4.2e5 or 210 < 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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6489.6%
Simplified89.6%
if -4.2e5 < ew < 210Initial 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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified91.3%
Final simplification90.4%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (cos t))))) (if (<= ew -9.5e-52) t_1 (if (<= ew 2.1e-55) (fabs (* eh (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (ew <= -9.5e-52) {
tmp = t_1;
} else if (ew <= 2.1e-55) {
tmp = fabs((eh * sin(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((ew * cos(t)))
if (ew <= (-9.5d-52)) then
tmp = t_1
else if (ew <= 2.1d-55) then
tmp = abs((eh * sin(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((ew * Math.cos(t)));
double tmp;
if (ew <= -9.5e-52) {
tmp = t_1;
} else if (ew <= 2.1e-55) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.cos(t))) tmp = 0 if ew <= -9.5e-52: tmp = t_1 elif ew <= 2.1e-55: tmp = math.fabs((eh * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * cos(t))) tmp = 0.0 if (ew <= -9.5e-52) tmp = t_1; elseif (ew <= 2.1e-55) tmp = abs(Float64(eh * sin(t))); 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 <= -9.5e-52) tmp = t_1; elseif (ew <= 2.1e-55) tmp = abs((eh * sin(t))); 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, -9.5e-52], t$95$1, If[LessEqual[ew, 2.1e-55], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -9.5 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 2.1 \cdot 10^{-55}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -9.50000000000000007e-52 or 2.1000000000000002e-55 < 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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6486.5%
Simplified86.5%
if -9.50000000000000007e-52 < ew < 2.1000000000000002e-55Initial program 99.7%
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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in ew around 0
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6474.7%
Simplified74.7%
Applied egg-rr47.7%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6474.8%
Simplified74.8%
(FPCore (eh ew t) :precision binary64 (if (<= ew -7.2e-15) (fabs ew) (if (<= ew 4.1e-56) (fabs (* eh (sin t))) (fabs ew))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -7.2e-15) {
tmp = fabs(ew);
} else if (ew <= 4.1e-56) {
tmp = fabs((eh * sin(t)));
} else {
tmp = fabs(ew);
}
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 (ew <= (-7.2d-15)) then
tmp = abs(ew)
else if (ew <= 4.1d-56) then
tmp = abs((eh * sin(t)))
else
tmp = abs(ew)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -7.2e-15) {
tmp = Math.abs(ew);
} else if (ew <= 4.1e-56) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = Math.abs(ew);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -7.2e-15: tmp = math.fabs(ew) elif ew <= 4.1e-56: tmp = math.fabs((eh * math.sin(t))) else: tmp = math.fabs(ew) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -7.2e-15) tmp = abs(ew); elseif (ew <= 4.1e-56) tmp = abs(Float64(eh * sin(t))); else tmp = abs(ew); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -7.2e-15) tmp = abs(ew); elseif (ew <= 4.1e-56) tmp = abs((eh * sin(t))); else tmp = abs(ew); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -7.2e-15], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 4.1e-56], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[ew], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -7.2 \cdot 10^{-15}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{elif}\;ew \leq 4.1 \cdot 10^{-56}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew\right|\\
\end{array}
\end{array}
if ew < -7.2000000000000002e-15 or 4.1000000000000001e-56 < 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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified52.7%
if -7.2000000000000002e-15 < ew < 4.1000000000000001e-56Initial 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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in ew around 0
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6472.8%
Simplified72.8%
Applied egg-rr45.0%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6473.0%
Simplified73.0%
(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
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified40.8%
herbie shell --seed 2024159
(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)))))))