
(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 11 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(Float64(ew * 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[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $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|\frac{ew \cdot \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%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
(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.8%
Taylor expanded in t around 0 99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (/ 1.0 (/ 1.0 (* ew (sin t)))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (1.0 / (1.0 / (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))))) + (1.0d0 / (1.0d0 / (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))))) + (1.0 / (1.0 / (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))))) + (1.0 / (1.0 / (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(1.0 / Float64(1.0 / Float64(ew * sin(t)))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (1.0 / (1.0 / (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[(1.0 / N[(1.0 / N[(ew * N[Sin[t], $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) + \frac{1}{\frac{1}{ew \cdot \sin t}}\right|
\end{array}
Initial program 99.8%
add-cbrt-cube71.0%
pow371.1%
associate-*l*71.1%
cos-atan72.5%
un-div-inv72.5%
hypot-1-def72.5%
Applied egg-rr72.5%
rem-cbrt-cube99.8%
associate-*r/99.8%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in eh around 0 98.5%
Final simplification98.5%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(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(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * 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 * 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 * 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 * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $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 \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 98.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (/ eh (* ew (tan t)))))))
(if (or (<= eh -5e+151) (not (<= eh 2.8e-12)))
(fabs (* eh (* (cos t) t_1)))
(fabs (+ (* ew (sin t)) (* eh t_1))))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan((eh / (ew * tan(t)))));
double tmp;
if ((eh <= -5e+151) || !(eh <= 2.8e-12)) {
tmp = fabs((eh * (cos(t) * t_1)));
} else {
tmp = fabs(((ew * sin(t)) + (eh * 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(atan((eh / (ew * tan(t)))))
if ((eh <= (-5d+151)) .or. (.not. (eh <= 2.8d-12))) then
tmp = abs((eh * (cos(t) * t_1)))
else
tmp = abs(((ew * sin(t)) + (eh * t_1)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.sin(Math.atan((eh / (ew * Math.tan(t)))));
double tmp;
if ((eh <= -5e+151) || !(eh <= 2.8e-12)) {
tmp = Math.abs((eh * (Math.cos(t) * t_1)));
} else {
tmp = Math.abs(((ew * Math.sin(t)) + (eh * t_1)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(math.atan((eh / (ew * math.tan(t))))) tmp = 0 if (eh <= -5e+151) or not (eh <= 2.8e-12): tmp = math.fabs((eh * (math.cos(t) * t_1))) else: tmp = math.fabs(((ew * math.sin(t)) + (eh * t_1))) return tmp
function code(eh, ew, t) t_1 = sin(atan(Float64(eh / Float64(ew * tan(t))))) tmp = 0.0 if ((eh <= -5e+151) || !(eh <= 2.8e-12)) tmp = abs(Float64(eh * Float64(cos(t) * t_1))); else tmp = abs(Float64(Float64(ew * sin(t)) + Float64(eh * t_1))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(atan((eh / (ew * tan(t))))); tmp = 0.0; if ((eh <= -5e+151) || ~((eh <= 2.8e-12))) tmp = abs((eh * (cos(t) * t_1))); else tmp = abs(((ew * sin(t)) + (eh * t_1))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[eh, -5e+151], N[Not[LessEqual[eh, 2.8e-12]], $MachinePrecision]], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\mathbf{if}\;eh \leq -5 \cdot 10^{+151} \lor \neg \left(eh \leq 2.8 \cdot 10^{-12}\right):\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot t\_1\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t + eh \cdot t\_1\right|\\
\end{array}
\end{array}
if eh < -5.0000000000000002e151 or 2.8000000000000002e-12 < eh Initial program 99.9%
add-cbrt-cube83.2%
pow383.2%
associate-*l*83.2%
cos-atan87.2%
un-div-inv87.2%
hypot-1-def87.2%
Applied egg-rr87.2%
Taylor expanded in ew around 0 91.6%
if -5.0000000000000002e151 < eh < 2.8000000000000002e-12Initial program 99.8%
Taylor expanded in t around 0 91.1%
add-cube-cbrt89.6%
pow389.7%
associate-*l*89.7%
cos-atan89.7%
un-div-inv89.7%
hypot-1-def89.7%
Applied egg-rr89.7%
Taylor expanded in eh around 0 90.3%
Final simplification90.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.6e-17) (not (<= eh 6.5e-71))) (fabs (* eh (* (cos t) (sin (atan (/ eh (* ew (tan t)))))))) (fabs (* ew (sin t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.6e-17) || !(eh <= 6.5e-71)) {
tmp = fabs((eh * (cos(t) * sin(atan((eh / (ew * tan(t))))))));
} else {
tmp = fabs((ew * sin(t)));
}
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 <= (-1.6d-17)) .or. (.not. (eh <= 6.5d-71))) then
tmp = abs((eh * (cos(t) * sin(atan((eh / (ew * tan(t))))))))
else
tmp = abs((ew * sin(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.6e-17) || !(eh <= 6.5e-71)) {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
} else {
tmp = Math.abs((ew * Math.sin(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.6e-17) or not (eh <= 6.5e-71): tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan((eh / (ew * math.tan(t)))))))) else: tmp = math.fabs((ew * math.sin(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.6e-17) || !(eh <= 6.5e-71)) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))); else tmp = abs(Float64(ew * sin(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.6e-17) || ~((eh <= 6.5e-71))) tmp = abs((eh * (cos(t) * sin(atan((eh / (ew * tan(t)))))))); else tmp = abs((ew * sin(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.6e-17], N[Not[LessEqual[eh, 6.5e-71]], $MachinePrecision]], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.6 \cdot 10^{-17} \lor \neg \left(eh \leq 6.5 \cdot 10^{-71}\right):\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if eh < -1.6000000000000001e-17 or 6.50000000000000005e-71 < eh Initial program 99.9%
add-cbrt-cube80.3%
pow380.3%
associate-*l*80.3%
cos-atan83.1%
un-div-inv83.1%
hypot-1-def83.1%
Applied egg-rr83.1%
Taylor expanded in ew around 0 83.4%
if -1.6000000000000001e-17 < eh < 6.50000000000000005e-71Initial program 99.8%
add-cbrt-cube60.9%
pow360.9%
associate-*l*60.9%
cos-atan60.9%
un-div-inv60.9%
hypot-1-def60.9%
Applied egg-rr60.9%
add-sqr-sqrt60.6%
pow260.6%
Applied egg-rr50.3%
Taylor expanded in ew around inf 39.3%
unpow239.3%
sqrt-unprod48.2%
pow248.2%
*-commutative48.2%
Applied egg-rr48.2%
unpow248.2%
rem-sqrt-square76.8%
*-commutative76.8%
Simplified76.8%
Final simplification80.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -6.8e-69) (not (<= t 1.8e-32))) (fabs (* ew (sin t))) (fabs (* eh (sin (atan (* eh (/ 1.0 (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -6.8e-69) || !(t <= 1.8e-32)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((eh * sin(atan((eh * (1.0 / (ew * tan(t))))))));
}
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 ((t <= (-6.8d-69)) .or. (.not. (t <= 1.8d-32))) then
tmp = abs((ew * sin(t)))
else
tmp = abs((eh * sin(atan((eh * (1.0d0 / (ew * tan(t))))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -6.8e-69) || !(t <= 1.8e-32)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((eh * Math.sin(Math.atan((eh * (1.0 / (ew * Math.tan(t))))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -6.8e-69) or not (t <= 1.8e-32): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((eh * math.sin(math.atan((eh * (1.0 / (ew * math.tan(t)))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -6.8e-69) || !(t <= 1.8e-32)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(eh * sin(atan(Float64(eh * Float64(1.0 / Float64(ew * tan(t)))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -6.8e-69) || ~((t <= 1.8e-32))) tmp = abs((ew * sin(t))); else tmp = abs((eh * sin(atan((eh * (1.0 / (ew * tan(t)))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -6.8e-69], N[Not[LessEqual[t, 1.8e-32]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh * N[(1.0 / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{-69} \lor \neg \left(t \leq 1.8 \cdot 10^{-32}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(eh \cdot \frac{1}{ew \cdot \tan t}\right)\right|\\
\end{array}
\end{array}
if t < -6.80000000000000016e-69 or 1.79999999999999996e-32 < t Initial program 99.7%
add-cbrt-cube59.2%
pow359.2%
associate-*l*59.2%
cos-atan61.0%
un-div-inv61.0%
hypot-1-def61.0%
Applied egg-rr61.0%
add-sqr-sqrt60.7%
pow260.7%
Applied egg-rr50.2%
Taylor expanded in ew around inf 31.3%
unpow231.3%
sqrt-unprod31.7%
pow231.7%
*-commutative31.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square59.5%
*-commutative59.5%
Simplified59.5%
if -6.80000000000000016e-69 < t < 1.79999999999999996e-32Initial program 100.0%
add-cbrt-cube90.8%
pow390.8%
associate-*l*90.8%
cos-atan91.8%
un-div-inv91.8%
hypot-1-def91.8%
Applied egg-rr91.8%
Taylor expanded in t around 0 77.7%
div-inv77.7%
Applied egg-rr77.7%
Final simplification66.3%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -3.9e-69) (not (<= t 4.1e-33))) (fabs (* ew (sin t))) (fabs (* eh (sin (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -3.9e-69) || !(t <= 4.1e-33)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((eh * sin(atan((eh / (ew * t))))));
}
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 ((t <= (-3.9d-69)) .or. (.not. (t <= 4.1d-33))) then
tmp = abs((ew * sin(t)))
else
tmp = abs((eh * sin(atan((eh / (ew * t))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -3.9e-69) || !(t <= 4.1e-33)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((eh * Math.sin(Math.atan((eh / (ew * t))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -3.9e-69) or not (t <= 4.1e-33): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((eh * math.sin(math.atan((eh / (ew * t)))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -3.9e-69) || !(t <= 4.1e-33)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(eh * sin(atan(Float64(eh / Float64(ew * t)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -3.9e-69) || ~((t <= 4.1e-33))) tmp = abs((ew * sin(t))); else tmp = abs((eh * sin(atan((eh / (ew * t)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -3.9e-69], N[Not[LessEqual[t, 4.1e-33]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{-69} \lor \neg \left(t \leq 4.1 \cdot 10^{-33}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\end{array}
\end{array}
if t < -3.89999999999999981e-69 or 4.1e-33 < t Initial program 99.7%
add-cbrt-cube59.2%
pow359.2%
associate-*l*59.2%
cos-atan61.0%
un-div-inv61.0%
hypot-1-def61.0%
Applied egg-rr61.0%
add-sqr-sqrt60.7%
pow260.7%
Applied egg-rr50.2%
Taylor expanded in ew around inf 31.3%
unpow231.3%
sqrt-unprod31.7%
pow231.7%
*-commutative31.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square59.5%
*-commutative59.5%
Simplified59.5%
if -3.89999999999999981e-69 < t < 4.1e-33Initial program 100.0%
add-cbrt-cube90.8%
pow390.8%
associate-*l*90.8%
cos-atan91.8%
un-div-inv91.8%
hypot-1-def91.8%
Applied egg-rr91.8%
Taylor expanded in t around 0 77.7%
Taylor expanded in t around 0 77.7%
*-commutative77.7%
Simplified77.7%
Final simplification66.3%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (sin t))))
double code(double eh, double ew, double t) {
return fabs((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((ew * sin(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.sin(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.sin(t)))
function code(eh, ew, t) return abs(Float64(ew * sin(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * sin(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t\right|
\end{array}
Initial program 99.8%
add-cbrt-cube71.0%
pow371.1%
associate-*l*71.1%
cos-atan72.5%
un-div-inv72.5%
hypot-1-def72.5%
Applied egg-rr72.5%
add-sqr-sqrt72.1%
pow272.1%
Applied egg-rr50.3%
Taylor expanded in ew around inf 24.7%
unpow224.7%
sqrt-unprod28.8%
pow228.8%
*-commutative28.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square47.0%
*-commutative47.0%
Simplified47.0%
(FPCore (eh ew t) :precision binary64 (* ew (sin t)))
double code(double eh, double ew, double t) {
return 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 = ew * sin(t)
end function
public static double code(double eh, double ew, double t) {
return ew * Math.sin(t);
}
def code(eh, ew, t): return ew * math.sin(t)
function code(eh, ew, t) return Float64(ew * sin(t)) end
function tmp = code(eh, ew, t) tmp = ew * sin(t); end
code[eh_, ew_, t_] := N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot \sin t
\end{array}
Initial program 99.8%
add-cbrt-cube71.0%
pow371.1%
associate-*l*71.1%
cos-atan72.5%
un-div-inv72.5%
hypot-1-def72.5%
Applied egg-rr72.5%
add-sqr-sqrt72.1%
pow272.1%
Applied egg-rr50.3%
Taylor expanded in ew around inf 24.7%
unpow224.7%
add-sqr-sqrt25.5%
*-commutative25.5%
Applied egg-rr25.5%
Final simplification25.5%
(FPCore (eh ew t) :precision binary64 (* ew t))
double code(double eh, double ew, double t) {
return 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 = ew * t
end function
public static double code(double eh, double ew, double t) {
return ew * t;
}
def code(eh, ew, t): return ew * t
function code(eh, ew, t) return Float64(ew * t) end
function tmp = code(eh, ew, t) tmp = ew * t; end
code[eh_, ew_, t_] := N[(ew * t), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot t
\end{array}
Initial program 99.8%
add-cbrt-cube71.0%
pow371.1%
associate-*l*71.1%
cos-atan72.5%
un-div-inv72.5%
hypot-1-def72.5%
Applied egg-rr72.5%
add-sqr-sqrt72.1%
pow272.1%
Applied egg-rr50.3%
Taylor expanded in ew around inf 24.7%
Taylor expanded in t around 0 11.0%
herbie shell --seed 2024133
(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))))))))