
(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 11 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 (atan (/ (* eh (- (tan t))) ew)))) (fabs (- (* (* eh (sin t)) (sin t_1)) (* (cos t_1) (* ew (cos t)))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh * -tan(t)) / ew));
return fabs((((eh * sin(t)) * sin(t_1)) - (cos(t_1) * (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
real(8) :: t_1
t_1 = atan(((eh * -tan(t)) / ew))
code = abs((((eh * sin(t)) * sin(t_1)) - (cos(t_1) * (ew * cos(t)))))
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((((eh * Math.sin(t)) * Math.sin(t_1)) - (Math.cos(t_1) * (ew * Math.cos(t)))));
}
def code(eh, ew, t): t_1 = math.atan(((eh * -math.tan(t)) / ew)) return math.fabs((((eh * math.sin(t)) * math.sin(t_1)) - (math.cos(t_1) * (ew * math.cos(t)))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh * Float64(-tan(t))) / ew)) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(t_1)) - Float64(cos(t_1) * Float64(ew * cos(t))))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh * -tan(t)) / ew)); tmp = abs((((eh * sin(t)) * sin(t_1)) - (cos(t_1) * (ew * cos(t))))); 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[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[t$95$1], $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\\
\left|\left(eh \cdot \sin t\right) \cdot \sin t\_1 - \cos t\_1 \cdot \left(ew \cdot \cos t\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (/ 1.0 (hypot 1.0 (* (tan t) (/ eh ew)))) (* ew (cos t))) (* (* eh (sin t)) (sin (atan (/ (* eh (- (tan t))) ew)))))))
double code(double eh, double ew, double t) {
return fabs((((1.0 / hypot(1.0, (tan(t) * (eh / ew)))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew)))) * (ew * Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -Math.tan(t)) / ew))))));
}
def code(eh, ew, t): return math.fabs((((1.0 / math.hypot(1.0, (math.tan(t) * (eh / ew)))) * (ew * math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -math.tan(t)) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew)))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-tan(t))) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((1.0 / hypot(1.0, (tan(t) * (eh / ew)))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-N[Tan[t], $MachinePrecision])), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
associate-*r/99.1%
cos-atan99.1%
hypot-1-def99.1%
associate-*r/99.1%
*-commutative99.1%
associate-/l*99.1%
add-sqr-sqrt41.6%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod57.5%
add-sqr-sqrt99.1%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (cos (atan (/ (* eh (- (tan t))) ew))) (* ew (cos t))) (* (* eh (sin t)) (sin (atan (/ (* eh (- t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((cos(atan(((eh * -tan(t)) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -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(((cos(atan(((eh * -tan(t)) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.cos(Math.atan(((eh * -Math.tan(t)) / ew))) * (ew * Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -t) / ew))))));
}
def code(eh, ew, t): return math.fabs(((math.cos(math.atan(((eh * -math.tan(t)) / ew))) * (ew * math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -t) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(cos(atan(Float64(Float64(eh * Float64(-tan(t))) / ew))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((cos(atan(((eh * -tan(t)) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[N[ArcTan[N[(N[(eh * (-N[Tan[t], $MachinePrecision])), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-t)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\cos \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right) \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 99.1%
mul-1-neg99.1%
distribute-rgt-neg-in99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (/ 1.0 (hypot 1.0 (* (tan t) (/ eh ew)))) (* ew (cos t))) (* (* eh (sin t)) (sin (atan (/ (* eh (- t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs((((1.0 / hypot(1.0, (tan(t) * (eh / ew)))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew)))) * (ew * Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -t) / ew))))));
}
def code(eh, ew, t): return math.fabs((((1.0 / math.hypot(1.0, (math.tan(t) * (eh / ew)))) * (ew * math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -t) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew)))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((1.0 / hypot(1.0, (tan(t) * (eh / ew)))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-t)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 99.1%
mul-1-neg99.1%
distribute-rgt-neg-in99.1%
Simplified99.1%
associate-*r/99.1%
cos-atan99.1%
hypot-1-def99.1%
associate-*r/99.1%
*-commutative99.1%
associate-/l*99.1%
add-sqr-sqrt41.6%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod57.5%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* eh (- (tan t))) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -tan(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(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -Math.tan(t)) / ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -math.tan(t)) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-tan(t))) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-N[Tan[t], $MachinePrecision])), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
associate-*r/99.1%
cos-atan99.1%
hypot-1-def99.1%
associate-*r/99.1%
*-commutative99.1%
associate-/l*99.1%
add-sqr-sqrt41.6%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod57.5%
add-sqr-sqrt99.1%
Applied egg-rr99.8%
Taylor expanded in t around 0 97.7%
Final simplification97.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (/ t ew))) (t_2 (* eh (sin t))))
(if (or (<= ew -9.2e-61) (not (<= ew 6.1e-83)))
(fabs (- (* t_2 (/ t_1 (hypot 1.0 t_1))) (* ew (cos t))))
(fabs (- (* t_2 (sin (atan (/ (* eh (- (tan t))) ew)))) ew)))))
double code(double eh, double ew, double t) {
double t_1 = eh * (t / ew);
double t_2 = eh * sin(t);
double tmp;
if ((ew <= -9.2e-61) || !(ew <= 6.1e-83)) {
tmp = fabs(((t_2 * (t_1 / hypot(1.0, t_1))) - (ew * cos(t))));
} else {
tmp = fabs(((t_2 * sin(atan(((eh * -tan(t)) / ew)))) - ew));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = eh * (t / ew);
double t_2 = eh * Math.sin(t);
double tmp;
if ((ew <= -9.2e-61) || !(ew <= 6.1e-83)) {
tmp = Math.abs(((t_2 * (t_1 / Math.hypot(1.0, t_1))) - (ew * Math.cos(t))));
} else {
tmp = Math.abs(((t_2 * Math.sin(Math.atan(((eh * -Math.tan(t)) / ew)))) - ew));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * (t / ew) t_2 = eh * math.sin(t) tmp = 0 if (ew <= -9.2e-61) or not (ew <= 6.1e-83): tmp = math.fabs(((t_2 * (t_1 / math.hypot(1.0, t_1))) - (ew * math.cos(t)))) else: tmp = math.fabs(((t_2 * math.sin(math.atan(((eh * -math.tan(t)) / ew)))) - ew)) return tmp
function code(eh, ew, t) t_1 = Float64(eh * Float64(t / ew)) t_2 = Float64(eh * sin(t)) tmp = 0.0 if ((ew <= -9.2e-61) || !(ew <= 6.1e-83)) tmp = abs(Float64(Float64(t_2 * Float64(t_1 / hypot(1.0, t_1))) - Float64(ew * cos(t)))); else tmp = abs(Float64(Float64(t_2 * sin(atan(Float64(Float64(eh * Float64(-tan(t))) / ew)))) - ew)); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * (t / ew); t_2 = eh * sin(t); tmp = 0.0; if ((ew <= -9.2e-61) || ~((ew <= 6.1e-83))) tmp = abs(((t_2 * (t_1 / hypot(1.0, t_1))) - (ew * cos(t)))); else tmp = abs(((t_2 * sin(atan(((eh * -tan(t)) / ew)))) - ew)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[(t / ew), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -9.2e-61], N[Not[LessEqual[ew, 6.1e-83]], $MachinePrecision]], N[Abs[N[(N[(t$95$2 * N[(t$95$1 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t$95$2 * N[Sin[N[ArcTan[N[(N[(eh * (-N[Tan[t], $MachinePrecision])), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - ew), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \frac{t}{ew}\\
t_2 := eh \cdot \sin t\\
\mathbf{if}\;ew \leq -9.2 \cdot 10^{-61} \lor \neg \left(ew \leq 6.1 \cdot 10^{-83}\right):\\
\;\;\;\;\left|t\_2 \cdot \frac{t\_1}{\mathsf{hypot}\left(1, t\_1\right)} - ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_2 \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right) - ew\right|\\
\end{array}
\end{array}
if ew < -9.19999999999999967e-61 or 6.10000000000000003e-83 < ew Initial program 99.8%
Taylor expanded in t around 0 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
associate-*r/99.7%
cos-atan99.7%
hypot-1-def99.7%
associate-*r/99.7%
*-commutative99.7%
associate-/l*99.7%
add-sqr-sqrt36.6%
sqrt-unprod91.2%
sqr-neg91.2%
sqrt-unprod63.0%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 98.5%
sin-atan87.6%
associate-*r/85.9%
distribute-rgt-neg-out85.9%
distribute-lft-neg-in85.9%
associate-*r/86.4%
clear-num86.4%
add-sqr-sqrt31.4%
sqrt-unprod74.4%
sqr-neg74.4%
sqrt-unprod55.0%
add-sqr-sqrt86.4%
un-div-inv86.4%
hypot-1-def87.0%
distribute-rgt-neg-out87.0%
distribute-lft-neg-in87.0%
associate-*r/87.2%
clear-num87.2%
Applied egg-rr87.2%
associate-/l*93.1%
associate-/r/92.5%
associate-*l/90.5%
associate-/l*93.0%
associate-/r/92.5%
associate-*l/91.1%
associate-/l*93.1%
Simplified93.1%
if -9.19999999999999967e-61 < ew < 6.10000000000000003e-83Initial program 99.8%
associate-*r/98.0%
cos-atan98.0%
hypot-1-def98.0%
associate-*r/98.0%
*-commutative98.0%
associate-/l*98.0%
add-sqr-sqrt51.3%
sqrt-unprod97.8%
sqr-neg97.8%
sqrt-unprod46.7%
add-sqr-sqrt98.0%
Applied egg-rr99.8%
Taylor expanded in t around 0 93.8%
Taylor expanded in t around 0 91.8%
Final simplification92.7%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* eh (- t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -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(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -t) / ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -t) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-t)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 99.1%
mul-1-neg99.1%
distribute-rgt-neg-in99.1%
Simplified99.1%
associate-*r/99.1%
cos-atan99.1%
hypot-1-def99.1%
associate-*r/99.1%
*-commutative99.1%
associate-/l*99.1%
add-sqr-sqrt41.6%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod57.5%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
Taylor expanded in t around 0 97.7%
Final simplification97.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (/ t ew))) (t_2 (* eh (sin t))))
(if (or (<= ew -1.62e-59) (not (<= ew 1.06e-85)))
(fabs (- (* t_2 (/ t_1 (hypot 1.0 t_1))) (* ew (cos t))))
(fabs (- ew (* t_2 (sin (atan (/ (* eh (- t)) ew)))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * (t / ew);
double t_2 = eh * sin(t);
double tmp;
if ((ew <= -1.62e-59) || !(ew <= 1.06e-85)) {
tmp = fabs(((t_2 * (t_1 / hypot(1.0, t_1))) - (ew * cos(t))));
} else {
tmp = fabs((ew - (t_2 * sin(atan(((eh * -t) / ew))))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = eh * (t / ew);
double t_2 = eh * Math.sin(t);
double tmp;
if ((ew <= -1.62e-59) || !(ew <= 1.06e-85)) {
tmp = Math.abs(((t_2 * (t_1 / Math.hypot(1.0, t_1))) - (ew * Math.cos(t))));
} else {
tmp = Math.abs((ew - (t_2 * Math.sin(Math.atan(((eh * -t) / ew))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * (t / ew) t_2 = eh * math.sin(t) tmp = 0 if (ew <= -1.62e-59) or not (ew <= 1.06e-85): tmp = math.fabs(((t_2 * (t_1 / math.hypot(1.0, t_1))) - (ew * math.cos(t)))) else: tmp = math.fabs((ew - (t_2 * math.sin(math.atan(((eh * -t) / ew)))))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * Float64(t / ew)) t_2 = Float64(eh * sin(t)) tmp = 0.0 if ((ew <= -1.62e-59) || !(ew <= 1.06e-85)) tmp = abs(Float64(Float64(t_2 * Float64(t_1 / hypot(1.0, t_1))) - Float64(ew * cos(t)))); else tmp = abs(Float64(ew - Float64(t_2 * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * (t / ew); t_2 = eh * sin(t); tmp = 0.0; if ((ew <= -1.62e-59) || ~((ew <= 1.06e-85))) tmp = abs(((t_2 * (t_1 / hypot(1.0, t_1))) - (ew * cos(t)))); else tmp = abs((ew - (t_2 * sin(atan(((eh * -t) / ew)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[(t / ew), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -1.62e-59], N[Not[LessEqual[ew, 1.06e-85]], $MachinePrecision]], N[Abs[N[(N[(t$95$2 * N[(t$95$1 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(t$95$2 * N[Sin[N[ArcTan[N[(N[(eh * (-t)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \frac{t}{ew}\\
t_2 := eh \cdot \sin t\\
\mathbf{if}\;ew \leq -1.62 \cdot 10^{-59} \lor \neg \left(ew \leq 1.06 \cdot 10^{-85}\right):\\
\;\;\;\;\left|t\_2 \cdot \frac{t\_1}{\mathsf{hypot}\left(1, t\_1\right)} - ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - t\_2 \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right|\\
\end{array}
\end{array}
if ew < -1.61999999999999989e-59 or 1.0599999999999999e-85 < ew Initial program 99.8%
Taylor expanded in t around 0 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
associate-*r/99.7%
cos-atan99.7%
hypot-1-def99.7%
associate-*r/99.7%
*-commutative99.7%
associate-/l*99.7%
add-sqr-sqrt36.6%
sqrt-unprod91.2%
sqr-neg91.2%
sqrt-unprod63.0%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 98.5%
sin-atan87.6%
associate-*r/85.9%
distribute-rgt-neg-out85.9%
distribute-lft-neg-in85.9%
associate-*r/86.4%
clear-num86.4%
add-sqr-sqrt31.4%
sqrt-unprod74.4%
sqr-neg74.4%
sqrt-unprod55.0%
add-sqr-sqrt86.4%
un-div-inv86.4%
hypot-1-def87.0%
distribute-rgt-neg-out87.0%
distribute-lft-neg-in87.0%
associate-*r/87.2%
clear-num87.2%
Applied egg-rr87.2%
associate-/l*93.1%
associate-/r/92.5%
associate-*l/90.5%
associate-/l*93.0%
associate-/r/92.5%
associate-*l/91.1%
associate-/l*93.1%
Simplified93.1%
if -1.61999999999999989e-59 < ew < 1.0599999999999999e-85Initial program 99.8%
Taylor expanded in t around 0 98.0%
mul-1-neg98.0%
distribute-rgt-neg-in98.0%
Simplified98.0%
associate-*r/98.0%
cos-atan98.0%
hypot-1-def98.0%
associate-*r/98.0%
*-commutative98.0%
associate-/l*98.0%
add-sqr-sqrt51.3%
sqrt-unprod97.8%
sqr-neg97.8%
sqrt-unprod46.7%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
Taylor expanded in t around 0 96.1%
Taylor expanded in t around 0 91.8%
Final simplification92.7%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -6.8e-15) (not (<= eh 2.85e-11))) (fabs (- ew (* (* eh (sin t)) (sin (atan (/ (* eh (- t)) ew)))))) (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -6.8e-15) || !(eh <= 2.85e-11)) {
tmp = fabs((ew - ((eh * sin(t)) * sin(atan(((eh * -t) / ew))))));
} 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 <= (-6.8d-15)) .or. (.not. (eh <= 2.85d-11))) then
tmp = abs((ew - ((eh * sin(t)) * sin(atan(((eh * -t) / ew))))))
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 <= -6.8e-15) || !(eh <= 2.85e-11)) {
tmp = Math.abs((ew - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -t) / ew))))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -6.8e-15) or not (eh <= 2.85e-11): tmp = math.fabs((ew - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -t) / ew)))))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -6.8e-15) || !(eh <= 2.85e-11)) tmp = abs(Float64(ew - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))); else tmp = abs(Float64(ew * cos(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -6.8e-15) || ~((eh <= 2.85e-11))) tmp = abs((ew - ((eh * sin(t)) * sin(atan(((eh * -t) / ew)))))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -6.8e-15], N[Not[LessEqual[eh, 2.85e-11]], $MachinePrecision]], N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-t)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -6.8 \cdot 10^{-15} \lor \neg \left(eh \leq 2.85 \cdot 10^{-11}\right):\\
\;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -6.8000000000000001e-15 or 2.8499999999999999e-11 < eh Initial program 99.8%
Taylor expanded in t around 0 99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
associate-*r/99.6%
cos-atan99.6%
hypot-1-def99.6%
associate-*r/99.6%
*-commutative99.6%
associate-/l*99.6%
add-sqr-sqrt43.7%
sqrt-unprod88.5%
sqr-neg88.5%
sqrt-unprod56.0%
add-sqr-sqrt99.6%
Applied egg-rr99.6%
Taylor expanded in t around 0 97.8%
Taylor expanded in t around 0 88.7%
if -6.8000000000000001e-15 < eh < 2.8499999999999999e-11Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
sin-mult89.9%
associate-*r/89.9%
Applied egg-rr89.9%
+-inverses89.9%
*-commutative89.9%
associate-/l*89.9%
mul0-lft89.9%
Simplified89.9%
fma-undefine89.9%
+-rgt-identity89.9%
add-sqr-sqrt36.8%
associate-*l*36.8%
*-commutative36.8%
cos-atan36.8%
un-div-inv36.8%
add-sqr-sqrt10.1%
sqrt-unprod36.8%
sqr-neg36.8%
sqrt-unprod26.7%
add-sqr-sqrt36.8%
hypot-1-def36.8%
Applied egg-rr36.8%
Taylor expanded in ew around inf 90.0%
Final simplification89.4%
(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%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
sin-mult65.6%
associate-*r/65.6%
Applied egg-rr64.2%
+-inverses64.2%
*-commutative64.2%
associate-/l*64.2%
mul0-lft64.2%
Simplified64.2%
fma-undefine64.2%
+-rgt-identity64.2%
add-sqr-sqrt27.8%
associate-*l*27.7%
*-commutative27.7%
cos-atan27.6%
un-div-inv27.6%
add-sqr-sqrt5.9%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod21.7%
add-sqr-sqrt27.6%
hypot-1-def27.6%
Applied egg-rr27.6%
Taylor expanded in ew around inf 64.4%
Final simplification64.4%
(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%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
sin-mult65.6%
associate-*r/65.6%
Applied egg-rr64.2%
+-inverses64.2%
*-commutative64.2%
associate-/l*64.2%
mul0-lft64.2%
Simplified64.2%
fma-undefine64.2%
+-rgt-identity64.2%
add-sqr-sqrt27.8%
associate-*l*27.7%
*-commutative27.7%
cos-atan27.6%
un-div-inv27.6%
add-sqr-sqrt5.9%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod21.7%
add-sqr-sqrt27.6%
hypot-1-def27.6%
Applied egg-rr27.6%
Taylor expanded in t around 0 43.7%
Final simplification43.7%
herbie shell --seed 2024044
(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)))))))