
(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 8 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
(let* ((t_1 (* (tan t) (/ eh ew))))
(fabs
(+
(/ (* ew (cos t)) (hypot 1.0 t_1))
(* eh (* (sin t) (sin (atan t_1))))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) * (eh / ew);
return fabs((((ew * cos(t)) / hypot(1.0, t_1)) + (eh * (sin(t) * sin(atan(t_1))))));
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) * (eh / ew);
return Math.abs((((ew * Math.cos(t)) / Math.hypot(1.0, t_1)) + (eh * (Math.sin(t) * Math.sin(Math.atan(t_1))))));
}
def code(eh, ew, t): t_1 = math.tan(t) * (eh / ew) return math.fabs((((ew * math.cos(t)) / math.hypot(1.0, t_1)) + (eh * (math.sin(t) * math.sin(math.atan(t_1))))))
function code(eh, ew, t) t_1 = Float64(tan(t) * Float64(eh / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, t_1)) + Float64(eh * Float64(sin(t) * sin(atan(t_1)))))) end
function tmp = code(eh, ew, t) t_1 = tan(t) * (eh / ew); tmp = abs((((ew * cos(t)) / hypot(1.0, t_1)) + (eh * (sin(t) * sin(atan(t_1)))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan t \cdot \frac{eh}{ew}\\
\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, t\_1\right)} + eh \cdot \left(\sin t \cdot \sin \tan^{-1} t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
sub-neg99.8%
Applied egg-rr99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (tan t) (/ eh ew))))
(if (or (<= ew -5.2e-5) (not (<= ew 1.4e-132)))
(fabs
(*
ew
(+
(cos t)
(* eh (/ (* (sin t) (sin (atan (* eh (/ (tan t) ew))))) ew)))))
(fabs (+ (* eh (* (sin t) (sin (atan t_1)))) (/ ew (hypot 1.0 t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) * (eh / ew);
double tmp;
if ((ew <= -5.2e-5) || !(ew <= 1.4e-132)) {
tmp = fabs((ew * (cos(t) + (eh * ((sin(t) * sin(atan((eh * (tan(t) / ew))))) / ew)))));
} else {
tmp = fabs(((eh * (sin(t) * sin(atan(t_1)))) + (ew / hypot(1.0, t_1))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) * (eh / ew);
double tmp;
if ((ew <= -5.2e-5) || !(ew <= 1.4e-132)) {
tmp = Math.abs((ew * (Math.cos(t) + (eh * ((Math.sin(t) * Math.sin(Math.atan((eh * (Math.tan(t) / ew))))) / ew)))));
} else {
tmp = Math.abs(((eh * (Math.sin(t) * Math.sin(Math.atan(t_1)))) + (ew / Math.hypot(1.0, t_1))));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.tan(t) * (eh / ew) tmp = 0 if (ew <= -5.2e-5) or not (ew <= 1.4e-132): tmp = math.fabs((ew * (math.cos(t) + (eh * ((math.sin(t) * math.sin(math.atan((eh * (math.tan(t) / ew))))) / ew))))) else: tmp = math.fabs(((eh * (math.sin(t) * math.sin(math.atan(t_1)))) + (ew / math.hypot(1.0, t_1)))) return tmp
function code(eh, ew, t) t_1 = Float64(tan(t) * Float64(eh / ew)) tmp = 0.0 if ((ew <= -5.2e-5) || !(ew <= 1.4e-132)) tmp = abs(Float64(ew * Float64(cos(t) + Float64(eh * Float64(Float64(sin(t) * sin(atan(Float64(eh * Float64(tan(t) / ew))))) / ew))))); else tmp = abs(Float64(Float64(eh * Float64(sin(t) * sin(atan(t_1)))) + Float64(ew / hypot(1.0, t_1)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = tan(t) * (eh / ew); tmp = 0.0; if ((ew <= -5.2e-5) || ~((ew <= 1.4e-132))) tmp = abs((ew * (cos(t) + (eh * ((sin(t) * sin(atan((eh * (tan(t) / ew))))) / ew))))); else tmp = abs(((eh * (sin(t) * sin(atan(t_1)))) + (ew / hypot(1.0, t_1)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -5.2e-5], N[Not[LessEqual[ew, 1.4e-132]], $MachinePrecision]], N[Abs[N[(ew * N[(N[Cos[t], $MachinePrecision] + N[(eh * N[(N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ew / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan t \cdot \frac{eh}{ew}\\
\mathbf{if}\;ew \leq -5.2 \cdot 10^{-5} \lor \neg \left(ew \leq 1.4 \cdot 10^{-132}\right):\\
\;\;\;\;\left|ew \cdot \left(\cos t + eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} t\_1\right) + \frac{ew}{\mathsf{hypot}\left(1, t\_1\right)}\right|\\
\end{array}
\end{array}
if ew < -5.19999999999999968e-5 or 1.40000000000000001e-132 < ew Initial program 99.8%
add-cube-cbrt97.9%
pow397.9%
Applied egg-rr97.9%
Taylor expanded in ew around inf 99.0%
associate-/l*99.0%
associate-/l*99.0%
Simplified99.0%
if -5.19999999999999968e-5 < ew < 1.40000000000000001e-132Initial program 99.8%
sub-neg99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 93.8%
Final simplification96.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (* eh (/ (tan t) ew))))))
(if (<= eh -7.4e+202)
(fabs (* t_1 (* eh (sin t))))
(fabs (* ew (+ (cos t) (* eh (/ (* (sin t) t_1) ew))))))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan((eh * (tan(t) / ew))));
double tmp;
if (eh <= -7.4e+202) {
tmp = fabs((t_1 * (eh * sin(t))));
} else {
tmp = fabs((ew * (cos(t) + (eh * ((sin(t) * t_1) / 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) :: t_1
real(8) :: tmp
t_1 = sin(atan((eh * (tan(t) / ew))))
if (eh <= (-7.4d+202)) then
tmp = abs((t_1 * (eh * sin(t))))
else
tmp = abs((ew * (cos(t) + (eh * ((sin(t) * t_1) / ew)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.sin(Math.atan((eh * (Math.tan(t) / ew))));
double tmp;
if (eh <= -7.4e+202) {
tmp = Math.abs((t_1 * (eh * Math.sin(t))));
} else {
tmp = Math.abs((ew * (Math.cos(t) + (eh * ((Math.sin(t) * t_1) / ew)))));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(math.atan((eh * (math.tan(t) / ew)))) tmp = 0 if eh <= -7.4e+202: tmp = math.fabs((t_1 * (eh * math.sin(t)))) else: tmp = math.fabs((ew * (math.cos(t) + (eh * ((math.sin(t) * t_1) / ew))))) return tmp
function code(eh, ew, t) t_1 = sin(atan(Float64(eh * Float64(tan(t) / ew)))) tmp = 0.0 if (eh <= -7.4e+202) tmp = abs(Float64(t_1 * Float64(eh * sin(t)))); else tmp = abs(Float64(ew * Float64(cos(t) + Float64(eh * Float64(Float64(sin(t) * t_1) / ew))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(atan((eh * (tan(t) / ew)))); tmp = 0.0; if (eh <= -7.4e+202) tmp = abs((t_1 * (eh * sin(t)))); else tmp = abs((ew * (cos(t) + (eh * ((sin(t) * t_1) / ew))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -7.4e+202], N[Abs[N[(t$95$1 * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[(N[Cos[t], $MachinePrecision] + N[(eh * N[(N[(N[Sin[t], $MachinePrecision] * t$95$1), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\\
\mathbf{if}\;eh \leq -7.4 \cdot 10^{+202}:\\
\;\;\;\;\left|t\_1 \cdot \left(eh \cdot \sin t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(\cos t + eh \cdot \frac{\sin t \cdot t\_1}{ew}\right)\right|\\
\end{array}
\end{array}
if eh < -7.3999999999999997e202Initial program 99.8%
add-cube-cbrt98.2%
pow398.1%
Applied egg-rr98.1%
Taylor expanded in ew around 0 84.2%
associate-*r*84.2%
associate-/l*84.1%
Simplified84.1%
if -7.3999999999999997e202 < eh Initial program 99.8%
add-cube-cbrt97.9%
pow397.9%
Applied egg-rr97.9%
Taylor expanded in ew around inf 93.2%
associate-/l*93.1%
associate-/l*93.1%
Simplified93.1%
Final simplification92.3%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.06e+101) (not (<= eh 1.35e+51))) (fabs (* (sin (atan (* eh (/ (tan t) ew)))) (* eh (sin t)))) (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.06e+101) || !(eh <= 1.35e+51)) {
tmp = fabs((sin(atan((eh * (tan(t) / ew)))) * (eh * sin(t))));
} else {
tmp = fabs((ew * cos(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.06d+101)) .or. (.not. (eh <= 1.35d+51))) then
tmp = abs((sin(atan((eh * (tan(t) / ew)))) * (eh * sin(t))))
else
tmp = abs((ew * cos(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.06e+101) || !(eh <= 1.35e+51)) {
tmp = Math.abs((Math.sin(Math.atan((eh * (Math.tan(t) / ew)))) * (eh * Math.sin(t))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.06e+101) or not (eh <= 1.35e+51): tmp = math.fabs((math.sin(math.atan((eh * (math.tan(t) / ew)))) * (eh * math.sin(t)))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.06e+101) || !(eh <= 1.35e+51)) tmp = abs(Float64(sin(atan(Float64(eh * Float64(tan(t) / ew)))) * Float64(eh * sin(t)))); else tmp = abs(Float64(ew * cos(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.06e+101) || ~((eh <= 1.35e+51))) tmp = abs((sin(atan((eh * (tan(t) / ew)))) * (eh * sin(t)))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.06e+101], N[Not[LessEqual[eh, 1.35e+51]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.06 \cdot 10^{+101} \lor \neg \left(eh \leq 1.35 \cdot 10^{+51}\right):\\
\;\;\;\;\left|\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -1.06e101 or 1.34999999999999996e51 < eh Initial program 99.8%
add-cube-cbrt98.1%
pow398.0%
Applied egg-rr98.0%
Taylor expanded in ew around 0 75.1%
associate-*r*75.2%
associate-/l*75.1%
Simplified75.1%
if -1.06e101 < eh < 1.34999999999999996e51Initial program 99.8%
sub-neg99.8%
Applied egg-rr99.8%
expm1-log1p-u99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 82.8%
Final simplification79.6%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -8.6e+47) (not (<= t 0.00095))) (fabs (* ew (cos t))) (fabs (+ ew (* eh (* t (sin (atan (/ (* (tan t) eh) ew)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -8.6e+47) || !(t <= 0.00095)) {
tmp = fabs((ew * cos(t)));
} else {
tmp = fabs((ew + (eh * (t * sin(atan(((tan(t) * eh) / 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 ((t <= (-8.6d+47)) .or. (.not. (t <= 0.00095d0))) then
tmp = abs((ew * cos(t)))
else
tmp = abs((ew + (eh * (t * sin(atan(((tan(t) * eh) / ew)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -8.6e+47) || !(t <= 0.00095)) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = Math.abs((ew + (eh * (t * Math.sin(Math.atan(((Math.tan(t) * eh) / ew)))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -8.6e+47) or not (t <= 0.00095): tmp = math.fabs((ew * math.cos(t))) else: tmp = math.fabs((ew + (eh * (t * math.sin(math.atan(((math.tan(t) * eh) / ew))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -8.6e+47) || !(t <= 0.00095)) tmp = abs(Float64(ew * cos(t))); else tmp = abs(Float64(ew + Float64(eh * Float64(t * sin(atan(Float64(Float64(tan(t) * eh) / ew))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -8.6e+47) || ~((t <= 0.00095))) tmp = abs((ew * cos(t))); else tmp = abs((ew + (eh * (t * sin(atan(((tan(t) * eh) / ew))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -8.6e+47], N[Not[LessEqual[t, 0.00095]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew + N[(eh * N[(t * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.6 \cdot 10^{+47} \lor \neg \left(t \leq 0.00095\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew + eh \cdot \left(t \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{ew}\right)\right)\right|\\
\end{array}
\end{array}
if t < -8.59999999999999989e47 or 9.49999999999999998e-4 < t Initial program 99.7%
sub-neg99.7%
Applied egg-rr99.7%
expm1-log1p-u99.6%
Applied egg-rr99.6%
Taylor expanded in ew around inf 52.3%
if -8.59999999999999989e47 < t < 9.49999999999999998e-4Initial program 100.0%
add-cube-cbrt97.9%
pow397.9%
Applied egg-rr97.9%
Taylor expanded in t around 0 93.7%
Final simplification73.5%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (cos t))))
double code(double eh, double ew, double t) {
return fabs((ew * cos(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 * cos(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.cos(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.cos(t)))
function code(eh, ew, t) return abs(Float64(ew * cos(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * cos(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
Applied egg-rr99.8%
expm1-log1p-u99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 60.1%
(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%
sub-neg99.8%
Applied egg-rr99.8%
expm1-log1p-u99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 41.0%
(FPCore (eh ew t) :precision binary64 ew)
double code(double eh, double ew, double t) {
return ew;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = ew
end function
public static double code(double eh, double ew, double t) {
return ew;
}
def code(eh, ew, t): return ew
function code(eh, ew, t) return ew end
function tmp = code(eh, ew, t) tmp = ew; end
code[eh_, ew_, t_] := ew
\begin{array}{l}
\\
ew
\end{array}
Initial program 99.8%
sub-neg99.8%
Applied egg-rr99.8%
expm1-log1p-u99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 41.0%
add-sqr-sqrt15.4%
fabs-sqr15.4%
add-sqr-sqrt16.4%
*-un-lft-identity16.4%
Applied egg-rr16.4%
Final simplification16.4%
herbie shell --seed 2024181
(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)))))))