
(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 10 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
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* ew (/ (sin t) (hypot 1.0 t_1)))
(* (* eh (cos t)) (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs(((ew * (sin(t) / hypot(1.0, t_1))) + ((eh * cos(t)) * sin(atan(t_1)))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs(((ew * (Math.sin(t) / Math.hypot(1.0, t_1))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(t_1)))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs(((ew * (math.sin(t) / math.hypot(1.0, t_1))) + ((eh * math.cos(t)) * math.sin(math.atan(t_1)))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(ew * Float64(sin(t) / hypot(1.0, t_1))) + Float64(Float64(eh * cos(t)) * sin(atan(t_1))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs(((ew * (sin(t) / hypot(1.0, t_1))) + ((eh * cos(t)) * sin(atan(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[(ew * N[(N[Sin[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|ew \cdot \frac{\sin t}{\mathsf{hypot}\left(1, t\_1\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (cos (atan (/ eh (* t ew)))) (* (sin t) ew)))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (cos(atan((eh / (t * ew)))) * (sin(t) * ew))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (cos(atan((eh / (t * ew)))) * (sin(t) * ew))))
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))))) + (Math.cos(Math.atan((eh / (t * ew)))) * (Math.sin(t) * ew))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (math.cos(math.atan((eh / (t * ew)))) * (math.sin(t) * ew))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(cos(atan(Float64(eh / Float64(t * ew)))) * Float64(sin(t) * ew)))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (cos(atan((eh / (t * ew)))) * (sin(t) * ew)))); 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[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * ew), $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) + \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) \cdot \left(\sin t \cdot ew\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.0%
Simplified99.0%
Final simplification99.0%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (sin t) ew))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * ew)));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * ew)))
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))))) + (Math.sin(t) * ew)));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (math.sin(t) * ew)))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(sin(t) * ew))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * ew))); 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[Sin[t], $MachinePrecision] * ew), $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) + \sin t \cdot ew\right|
\end{array}
Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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 eh around 0
sin-lowering-sin.f6497.8%
Simplified97.8%
Final simplification97.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t)))))))))
(if (<= eh -5.1e+158)
t_1
(if (<= eh 8.5e+76)
(fabs (+ (* (sin t) ew) (* eh (sin (atan (/ (/ eh ew) (tan 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 <= -5.1e+158) {
tmp = t_1;
} else if (eh <= 8.5e+76) {
tmp = fabs(((sin(t) * ew) + (eh * sin(atan(((eh / ew) / tan(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 <= (-5.1d+158)) then
tmp = t_1
else if (eh <= 8.5d+76) then
tmp = abs(((sin(t) * ew) + (eh * sin(atan(((eh / ew) / tan(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 <= -5.1e+158) {
tmp = t_1;
} else if (eh <= 8.5e+76) {
tmp = Math.abs(((Math.sin(t) * ew) + (eh * Math.sin(Math.atan(((eh / ew) / Math.tan(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 <= -5.1e+158: tmp = t_1 elif eh <= 8.5e+76: tmp = math.fabs(((math.sin(t) * ew) + (eh * math.sin(math.atan(((eh / ew) / math.tan(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 <= -5.1e+158) tmp = t_1; elseif (eh <= 8.5e+76) tmp = abs(Float64(Float64(sin(t) * ew) + Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(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 <= -5.1e+158) tmp = t_1; elseif (eh <= 8.5e+76) tmp = abs(((sin(t) * ew) + (eh * sin(atan(((eh / ew) / tan(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, -5.1e+158], t$95$1, If[LessEqual[eh, 8.5e+76], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $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 -5.1 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 8.5 \cdot 10^{+76}:\\
\;\;\;\;\left|\sin t \cdot ew + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -5.09999999999999987e158 or 8.49999999999999992e76 < 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.f6492.9%
Simplified92.9%
if -5.09999999999999987e158 < eh < 8.49999999999999992e76Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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.9%
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified90.7%
Taylor expanded in eh around 0
sin-lowering-sin.f6489.3%
Simplified89.3%
Final simplification90.5%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t))))))))) (if (<= eh -2.5e-59) t_1 (if (<= eh 9e-61) (fabs (* (sin t) ew)) 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 <= -2.5e-59) {
tmp = t_1;
} else if (eh <= 9e-61) {
tmp = fabs((sin(t) * 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 * cos(t)) * sin(atan((eh / (ew * tan(t)))))))
if (eh <= (-2.5d-59)) then
tmp = t_1
else if (eh <= 9d-61) then
tmp = abs((sin(t) * 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.cos(t)) * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
double tmp;
if (eh <= -2.5e-59) {
tmp = t_1;
} else if (eh <= 9e-61) {
tmp = Math.abs((Math.sin(t) * ew));
} 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 <= -2.5e-59: tmp = t_1 elif eh <= 9e-61: tmp = math.fabs((math.sin(t) * ew)) 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 <= -2.5e-59) tmp = t_1; elseif (eh <= 9e-61) tmp = abs(Float64(sin(t) * ew)); 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 <= -2.5e-59) tmp = t_1; elseif (eh <= 9e-61) tmp = abs((sin(t) * ew)); 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, -2.5e-59], t$95$1, If[LessEqual[eh, 9e-61], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $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 -2.5 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 9 \cdot 10^{-61}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -2.5000000000000001e-59 or 9e-61 < 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.f6482.0%
Simplified82.0%
if -2.5000000000000001e-59 < eh < 9e-61Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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.9%
Applied egg-rr99.9%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6471.4%
Simplified71.4%
Final simplification77.9%
(FPCore (eh ew t)
:precision binary64
(if (<= eh -2e-59)
(fabs eh)
(if (<= eh 8.2e-60)
(fabs (* (sin t) ew))
(*
(cos t)
(* eh (- 0.5 (* 0.5 (cos (* (atan (/ eh (* ew (tan t)))) 2.0)))))))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2e-59) {
tmp = fabs(eh);
} else if (eh <= 8.2e-60) {
tmp = fabs((sin(t) * ew));
} else {
tmp = cos(t) * (eh * (0.5 - (0.5 * cos((atan((eh / (ew * tan(t)))) * 2.0)))));
}
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 <= (-2d-59)) then
tmp = abs(eh)
else if (eh <= 8.2d-60) then
tmp = abs((sin(t) * ew))
else
tmp = cos(t) * (eh * (0.5d0 - (0.5d0 * cos((atan((eh / (ew * tan(t)))) * 2.0d0)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2e-59) {
tmp = Math.abs(eh);
} else if (eh <= 8.2e-60) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.cos(t) * (eh * (0.5 - (0.5 * Math.cos((Math.atan((eh / (ew * Math.tan(t)))) * 2.0)))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -2e-59: tmp = math.fabs(eh) elif eh <= 8.2e-60: tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.cos(t) * (eh * (0.5 - (0.5 * math.cos((math.atan((eh / (ew * math.tan(t)))) * 2.0))))) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -2e-59) tmp = abs(eh); elseif (eh <= 8.2e-60) tmp = abs(Float64(sin(t) * ew)); else tmp = Float64(cos(t) * Float64(eh * Float64(0.5 - Float64(0.5 * cos(Float64(atan(Float64(eh / Float64(ew * tan(t)))) * 2.0)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -2e-59) tmp = abs(eh); elseif (eh <= 8.2e-60) tmp = abs((sin(t) * ew)); else tmp = cos(t) * (eh * (0.5 - (0.5 * cos((atan((eh / (ew * tan(t)))) * 2.0))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -2e-59], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 8.2e-60], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[(N[Cos[t], $MachinePrecision] * N[(eh * N[(0.5 - N[(0.5 * N[Cos[N[(N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -2 \cdot 10^{-59}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{elif}\;eh \leq 8.2 \cdot 10^{-60}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\cos t \cdot \left(eh \cdot \left(0.5 - 0.5 \cdot \cos \left(\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if eh < -2.0000000000000001e-59Initial 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.f6449.4%
Simplified49.4%
associate-/r*N/A
sin-atanN/A
associate-/r*N/A
metadata-evalN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr30.9%
Taylor expanded in eh around inf
Simplified49.7%
if -2.0000000000000001e-59 < eh < 8.20000000000000025e-60Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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.9%
Applied egg-rr99.9%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6471.4%
Simplified71.4%
if 8.20000000000000025e-60 < eh Initial program 99.8%
Applied egg-rr30.6%
Taylor expanded in eh around inf
/-lowering-/.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
pow-lowering-pow.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6480.8%
Simplified80.8%
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
remove-double-divN/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
Applied egg-rr68.4%
Final simplification64.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) ew)))
(if (<= t -4.1e-41)
(fabs t_1)
(if (<= t 1.75e-7) (fabs eh) (fabs (/ 1.0 (/ 1.0 t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * ew;
double tmp;
if (t <= -4.1e-41) {
tmp = fabs(t_1);
} else if (t <= 1.75e-7) {
tmp = fabs(eh);
} else {
tmp = fabs((1.0 / (1.0 / 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 = sin(t) * ew
if (t <= (-4.1d-41)) then
tmp = abs(t_1)
else if (t <= 1.75d-7) then
tmp = abs(eh)
else
tmp = abs((1.0d0 / (1.0d0 / t_1)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.sin(t) * ew;
double tmp;
if (t <= -4.1e-41) {
tmp = Math.abs(t_1);
} else if (t <= 1.75e-7) {
tmp = Math.abs(eh);
} else {
tmp = Math.abs((1.0 / (1.0 / t_1)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(t) * ew tmp = 0 if t <= -4.1e-41: tmp = math.fabs(t_1) elif t <= 1.75e-7: tmp = math.fabs(eh) else: tmp = math.fabs((1.0 / (1.0 / t_1))) return tmp
function code(eh, ew, t) t_1 = Float64(sin(t) * ew) tmp = 0.0 if (t <= -4.1e-41) tmp = abs(t_1); elseif (t <= 1.75e-7) tmp = abs(eh); else tmp = abs(Float64(1.0 / Float64(1.0 / t_1))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(t) * ew; tmp = 0.0; if (t <= -4.1e-41) tmp = abs(t_1); elseif (t <= 1.75e-7) tmp = abs(eh); else tmp = abs((1.0 / (1.0 / t_1))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[t, -4.1e-41], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[t, 1.75e-7], N[Abs[eh], $MachinePrecision], N[Abs[N[(1.0 / N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot ew\\
\mathbf{if}\;t \leq -4.1 \cdot 10^{-41}:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-7}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\frac{1}{t\_1}}\right|\\
\end{array}
\end{array}
if t < -4.10000000000000014e-41Initial program 99.7%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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 eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6451.9%
Simplified51.9%
if -4.10000000000000014e-41 < t < 1.74999999999999992e-7Initial program 100.0%
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.f6474.5%
Simplified74.5%
associate-/r*N/A
sin-atanN/A
associate-/r*N/A
metadata-evalN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr42.8%
Taylor expanded in eh around inf
Simplified74.9%
if 1.74999999999999992e-7 < t Initial program 99.6%
Applied egg-rr38.9%
Taylor expanded in eh around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6450.9%
Simplified50.9%
Final simplification62.7%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin t) ew)))) (if (<= t -1.35e-41) t_1 (if (<= t 2.3e-7) (fabs eh) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (t <= -1.35e-41) {
tmp = t_1;
} else if (t <= 2.3e-7) {
tmp = fabs(eh);
} 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((sin(t) * ew))
if (t <= (-1.35d-41)) then
tmp = t_1
else if (t <= 2.3d-7) then
tmp = abs(eh)
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((Math.sin(t) * ew));
double tmp;
if (t <= -1.35e-41) {
tmp = t_1;
} else if (t <= 2.3e-7) {
tmp = Math.abs(eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(t) * ew)) tmp = 0 if t <= -1.35e-41: tmp = t_1 elif t <= 2.3e-7: tmp = math.fabs(eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (t <= -1.35e-41) tmp = t_1; elseif (t <= 2.3e-7) tmp = abs(eh); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((sin(t) * ew)); tmp = 0.0; if (t <= -1.35e-41) tmp = t_1; elseif (t <= 2.3e-7) tmp = abs(eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.35e-41], t$95$1, If[LessEqual[t, 2.3e-7], N[Abs[eh], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -1.35 \cdot 10^{-41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-7}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.35e-41 or 2.29999999999999995e-7 < t Initial program 99.7%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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
sin-lowering-sin.f6451.5%
Simplified51.5%
if -1.35e-41 < t < 2.29999999999999995e-7Initial program 100.0%
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.f6474.5%
Simplified74.5%
associate-/r*N/A
sin-atanN/A
associate-/r*N/A
metadata-evalN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr42.8%
Taylor expanded in eh around inf
Simplified74.9%
Final simplification62.7%
(FPCore (eh ew t) :precision binary64 (if (<= ew 2.5e+99) (fabs eh) (fabs (* t ew))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= 2.5e+99) {
tmp = fabs(eh);
} else {
tmp = fabs((t * 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 <= 2.5d+99) then
tmp = abs(eh)
else
tmp = abs((t * ew))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= 2.5e+99) {
tmp = Math.abs(eh);
} else {
tmp = Math.abs((t * ew));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= 2.5e+99: tmp = math.fabs(eh) else: tmp = math.fabs((t * ew)) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= 2.5e+99) tmp = abs(eh); else tmp = abs(Float64(t * ew)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= 2.5e+99) tmp = abs(eh); else tmp = abs((t * ew)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, 2.5e+99], N[Abs[eh], $MachinePrecision], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq 2.5 \cdot 10^{+99}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t \cdot ew\right|\\
\end{array}
\end{array}
if ew < 2.50000000000000004e99Initial 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.f6448.4%
Simplified48.4%
associate-/r*N/A
sin-atanN/A
associate-/r*N/A
metadata-evalN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr28.1%
Taylor expanded in eh around inf
Simplified48.8%
if 2.50000000000000004e99 < ew Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/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 eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6481.5%
Simplified81.5%
Taylor expanded in t around 0
*-commutativeN/A
*-lowering-*.f6439.7%
Simplified39.7%
(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.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.f6443.5%
Simplified43.5%
associate-/r*N/A
sin-atanN/A
associate-/r*N/A
metadata-evalN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr26.4%
Taylor expanded in eh around inf
Simplified43.9%
herbie shell --seed 2024158
(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))))))))