
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
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 / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
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 / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (* (/ 1.0 (hypot 1.0 (/ eh (* ew (tan t))))) (sin t))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * ((1.0 / hypot(1.0, (eh / (ew * tan(t))))) * sin(t))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * ((1.0 / Math.hypot(1.0, (eh / (ew * Math.tan(t))))) * Math.sin(t))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((ew * ((1.0 / math.hypot(1.0, (eh / (ew * math.tan(t))))) * math.sin(t))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * Float64(Float64(1.0 / hypot(1.0, Float64(eh / Float64(ew * tan(t))))) * sin(t))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * ((1.0 / hypot(1.0, (eh / (ew * tan(t))))) * sin(t))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \left(\frac{1}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} \cdot \sin t\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.7%
cos-atanN/A
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (* eh (cos t)) (sin (atan t_1)))
(/ (* ew (sin t)) (hypot 1.0 t_1))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((eh * cos(t)) * sin(atan(t_1))) + ((ew * sin(t)) / hypot(1.0, t_1))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(t_1))) + ((ew * Math.sin(t)) / Math.hypot(1.0, t_1))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(t_1))) + ((ew * math.sin(t)) / math.hypot(1.0, t_1))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(t_1))) + Float64(Float64(ew * sin(t)) / hypot(1.0, t_1)))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((eh * cos(t)) * sin(atan(t_1))) + ((ew * sin(t)) / hypot(1.0, t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1 + \frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)}\right|
\end{array}
\end{array}
Initial program 99.7%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (* eh (cos t)) (sin (atan t_1)))
(/ ew (/ (hypot 1.0 t_1) (sin t)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((eh * cos(t)) * sin(atan(t_1))) + (ew / (hypot(1.0, t_1) / sin(t)))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(t_1))) + (ew / (Math.hypot(1.0, t_1) / Math.sin(t)))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(t_1))) + (ew / (math.hypot(1.0, t_1) / math.sin(t)))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(t_1))) + Float64(ew / Float64(hypot(1.0, t_1) / sin(t))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((eh * cos(t)) * sin(atan(t_1))) + (ew / (hypot(1.0, t_1) / sin(t))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(ew / N[(N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision] / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1 + \frac{ew}{\frac{\mathsf{hypot}\left(1, t\_1\right)}{\sin t}}\right|
\end{array}
\end{array}
Initial program 99.7%
cos-atanN/A
un-div-invN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
Applied egg-rr99.7%
*-commutativeN/A
metadata-evalN/A
hypot-1-defN/A
associate-/r*N/A
hypot-undefineN/A
associate-/r/N/A
un-div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * 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((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + ((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + ((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.7%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.2%
Simplified99.2%
Final simplification99.2%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* ew (sin t)))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (ew * sin(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((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (ew * sin(t))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (ew * Math.sin(t))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (ew * math.sin(t))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(ew * sin(t)))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (ew * sin(t)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + ew \cdot \sin t\right|
\end{array}
Initial program 99.7%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.7%
Applied egg-rr99.7%
Taylor expanded in eh around 0
+-lowering-+.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6498.5%
Simplified98.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t)))))))))
(if (<= eh -6200000000.0)
t_1
(if (<= eh 500000.0) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))));
double tmp;
if (eh <= -6200000000.0) {
tmp = t_1;
} else if (eh <= 500000.0) {
tmp = fabs((ew * 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(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))))
if (eh <= (-6200000000.0d0)) then
tmp = t_1
else if (eh <= 500000.0d0) then
tmp = abs((ew * 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(((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
double tmp;
if (eh <= -6200000000.0) {
tmp = t_1;
} else if (eh <= 500000.0) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * math.tan(t))))))) tmp = 0 if eh <= -6200000000.0: tmp = t_1 elif eh <= 500000.0: tmp = math.fabs((ew * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t))))))) tmp = 0.0 if (eh <= -6200000000.0) tmp = t_1; elseif (eh <= 500000.0) tmp = abs(Float64(ew * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))); tmp = 0.0; if (eh <= -6200000000.0) tmp = t_1; elseif (eh <= 500000.0) tmp = abs((ew * sin(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -6200000000.0], t$95$1, If[LessEqual[eh, 500000.0], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{if}\;eh \leq -6200000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 500000:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -6.2e9 or 5e5 < eh Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6485.2%
Simplified85.2%
if -6.2e9 < eh < 5e5Initial program 99.7%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.7%
Applied egg-rr99.7%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6471.5%
Simplified71.5%
Final simplification78.3%
(FPCore (eh ew t) :precision binary64 (if (<= eh -7.5e+76) (fabs eh) (if (<= eh 170000000.0) (fabs (* ew (sin t))) (fabs eh))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -7.5e+76) {
tmp = fabs(eh);
} else if (eh <= 170000000.0) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs(eh);
}
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 <= (-7.5d+76)) then
tmp = abs(eh)
else if (eh <= 170000000.0d0) then
tmp = abs((ew * sin(t)))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -7.5e+76) {
tmp = Math.abs(eh);
} else if (eh <= 170000000.0) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -7.5e+76: tmp = math.fabs(eh) elif eh <= 170000000.0: tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -7.5e+76) tmp = abs(eh); elseif (eh <= 170000000.0) tmp = abs(Float64(ew * sin(t))); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -7.5e+76) tmp = abs(eh); elseif (eh <= 170000000.0) tmp = abs((ew * sin(t))); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -7.5e+76], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 170000000.0], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -7.5 \cdot 10^{+76}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{elif}\;eh \leq 170000000:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if eh < -7.4999999999999995e76 or 1.7e8 < eh Initial program 99.8%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6455.2%
Simplified55.2%
associate-/r*N/A
sin-atanN/A
div-invN/A
metadata-evalN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6425.0%
Applied egg-rr25.0%
Taylor expanded in eh around inf
Simplified55.3%
if -7.4999999999999995e76 < eh < 1.7e8Initial program 99.7%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.7%
Applied egg-rr99.7%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6469.6%
Simplified69.6%
(FPCore (eh ew t) :precision binary64 (if (<= eh -2.05e-29) (fabs eh) (if (<= eh 2.5e-70) (fabs (* ew t)) (fabs eh))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2.05e-29) {
tmp = fabs(eh);
} else if (eh <= 2.5e-70) {
tmp = fabs((ew * t));
} else {
tmp = fabs(eh);
}
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 <= (-2.05d-29)) then
tmp = abs(eh)
else if (eh <= 2.5d-70) then
tmp = abs((ew * t))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2.05e-29) {
tmp = Math.abs(eh);
} else if (eh <= 2.5e-70) {
tmp = Math.abs((ew * t));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -2.05e-29: tmp = math.fabs(eh) elif eh <= 2.5e-70: tmp = math.fabs((ew * t)) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -2.05e-29) tmp = abs(eh); elseif (eh <= 2.5e-70) tmp = abs(Float64(ew * t)); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -2.05e-29) tmp = abs(eh); elseif (eh <= 2.5e-70) tmp = abs((ew * t)); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -2.05e-29], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 2.5e-70], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -2.05 \cdot 10^{-29}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{elif}\;eh \leq 2.5 \cdot 10^{-70}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if eh < -2.0499999999999999e-29 or 2.4999999999999999e-70 < eh Initial program 99.7%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6448.8%
Simplified48.8%
associate-/r*N/A
sin-atanN/A
div-invN/A
metadata-evalN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6424.5%
Applied egg-rr24.5%
Taylor expanded in eh around inf
Simplified49.2%
if -2.0499999999999999e-29 < eh < 2.4999999999999999e-70Initial program 99.8%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6473.2%
Simplified73.2%
Taylor expanded in t around 0
*-commutativeN/A
*-lowering-*.f6437.9%
Simplified37.9%
Final simplification44.4%
(FPCore (eh ew t) :precision binary64 (fabs eh))
double code(double eh, double ew, double t) {
return fabs(eh);
}
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)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(eh);
}
def code(eh, ew, t): return math.fabs(eh)
function code(eh, ew, t) return abs(eh) end
function tmp = code(eh, ew, t) tmp = abs(eh); end
code[eh_, ew_, t_] := N[Abs[eh], $MachinePrecision]
\begin{array}{l}
\\
\left|eh\right|
\end{array}
Initial program 99.7%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6437.0%
Simplified37.0%
associate-/r*N/A
sin-atanN/A
div-invN/A
metadata-evalN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6421.9%
Applied egg-rr21.9%
Taylor expanded in eh around inf
Simplified37.5%
herbie shell --seed 2024155
(FPCore (eh ew t)
:name "Example from Robby"
:precision binary64
(fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))