
(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 12 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) (/ ew (tan t)))))) (fabs (- (* eh (* (sin t) (sin t_1))) (* ew (* (cos t) (cos t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((-eh / (ew / tan(t))));
return fabs(((eh * (sin(t) * sin(t_1))) - (ew * (cos(t) * cos(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(((eh * (sin(t) * sin(t_1))) - (ew * (cos(t) * cos(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(((eh * (Math.sin(t) * Math.sin(t_1))) - (ew * (Math.cos(t) * Math.cos(t_1)))));
}
def code(eh, ew, t): t_1 = math.atan((-eh / (ew / math.tan(t)))) return math.fabs(((eh * (math.sin(t) * math.sin(t_1))) - (ew * (math.cos(t) * math.cos(t_1)))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(-eh) / Float64(ew / tan(t)))) return abs(Float64(Float64(eh * Float64(sin(t) * sin(t_1))) - Float64(ew * Float64(cos(t) * cos(t_1))))) end
function tmp = code(eh, ew, t) t_1 = atan((-eh / (ew / tan(t)))); tmp = abs(((eh * (sin(t) * sin(t_1))) - (ew * (cos(t) * cos(t_1))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(ew * N[(N[Cos[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\\
\left|eh \cdot \left(\sin t \cdot \sin t_1\right) - ew \cdot \left(\cos t \cdot \cos t_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t))) (* eh (* (sin t) (sin (atan (/ (- eh) (/ ew (tan t))))))))))
double code(double eh, double ew, double t) {
return fabs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t)))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew / (Math.hypot(1.0, (Math.tan(t) * (eh / ew))) / Math.cos(t))) - (eh * (Math.sin(t) * Math.sin(Math.atan((-eh / (ew / Math.tan(t)))))))));
}
def code(eh, ew, t): return math.fabs(((ew / (math.hypot(1.0, (math.tan(t) * (eh / ew))) / math.cos(t))) - (eh * (math.sin(t) * math.sin(math.atan((-eh / (ew / math.tan(t)))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t))))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u73.6%
expm1-udef53.0%
Applied egg-rr53.8%
expm1-def74.4%
expm1-log1p99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* eh (* (sin t) (sin (atan (/ (- eh) (/ ew (tan t))))))) (/ (* 2.0 (cos (+ t (atan (/ (* t eh) ew))))) (/ 2.0 ew)))))
double code(double eh, double ew, double t) {
return fabs(((eh * (sin(t) * sin(atan((-eh / (ew / tan(t))))))) - ((2.0 * cos((t + atan(((t * eh) / ew))))) / (2.0 / 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 * (sin(t) * sin(atan((-eh / (ew / tan(t))))))) - ((2.0d0 * cos((t + atan(((t * eh) / ew))))) / (2.0d0 / ew))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((eh * (Math.sin(t) * Math.sin(Math.atan((-eh / (ew / Math.tan(t))))))) - ((2.0 * Math.cos((t + Math.atan(((t * eh) / ew))))) / (2.0 / ew))));
}
def code(eh, ew, t): return math.fabs(((eh * (math.sin(t) * math.sin(math.atan((-eh / (ew / math.tan(t))))))) - ((2.0 * math.cos((t + math.atan(((t * eh) / ew))))) / (2.0 / ew))))
function code(eh, ew, t) return abs(Float64(Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t))))))) - Float64(Float64(2.0 * cos(Float64(t + atan(Float64(Float64(t * eh) / ew))))) / Float64(2.0 / ew)))) end
function tmp = code(eh, ew, t) tmp = abs(((eh * (sin(t) * sin(atan((-eh / (ew / tan(t))))))) - ((2.0 * cos((t + atan(((t * eh) / ew))))) / (2.0 / ew)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(2.0 * N[Cos[N[(t + N[ArcTan[N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right) - \frac{2 \cdot \cos \left(t + \tan^{-1} \left(\frac{t \cdot eh}{ew}\right)\right)}{\frac{2}{ew}}\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
cos-mult99.1%
associate-*r/99.1%
Applied egg-rr99.1%
*-commutative99.1%
associate-/l*98.9%
count-298.9%
*-commutative98.9%
associate-*l/98.9%
associate-*r/98.9%
Simplified98.9%
Taylor expanded in t around 0 98.9%
Final simplification98.9%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (* (cos t) (cos (atan (/ (- eh) (/ ew (tan t))))))) (* eh (sin t)))))
double code(double eh, double ew, double t) {
return fabs(((ew * (cos(t) * cos(atan((-eh / (ew / tan(t))))))) - (eh * 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 * (cos(t) * cos(atan((-eh / (ew / tan(t))))))) - (eh * sin(t))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * (Math.cos(t) * Math.cos(Math.atan((-eh / (ew / Math.tan(t))))))) - (eh * Math.sin(t))));
}
def code(eh, ew, t): return math.fabs(((ew * (math.cos(t) * math.cos(math.atan((-eh / (ew / math.tan(t))))))) - (eh * math.sin(t))))
function code(eh, ew, t) return abs(Float64(Float64(ew * Float64(cos(t) * cos(atan(Float64(Float64(-eh) / Float64(ew / tan(t))))))) - Float64(eh * sin(t)))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * (cos(t) * cos(atan((-eh / (ew / tan(t))))))) - (eh * sin(t)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[(N[Cos[t], $MachinePrecision] * N[Cos[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right) - eh \cdot \sin t\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan80.6%
associate-*r/78.7%
div-inv78.6%
add-sqr-sqrt44.1%
sqrt-unprod67.3%
sqr-neg67.3%
sqrt-unprod33.9%
add-sqr-sqrt77.9%
clear-num77.9%
hypot-1-def83.9%
div-inv83.9%
Applied egg-rr84.0%
Taylor expanded in eh around inf 98.3%
Final simplification98.3%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* eh (* (sin t) (sin (atan (/ (- eh) (/ ew (tan t))))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - (eh * (sin(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 * cos(t)) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t)))))))))
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 / (ew / Math.tan(t)))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - (eh * (math.sin(t) * math.sin(math.atan((-eh / (ew / math.tan(t)))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t))))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u73.6%
expm1-udef53.0%
Applied egg-rr53.8%
expm1-def74.4%
expm1-log1p99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in ew around inf 98.6%
Final simplification98.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t))))
(if (or (<= ew -2.7e-34) (not (<= ew 1.06e-72)))
(fabs (+ t_1 (* t_1 (* eh (/ (tan t) ew)))))
(fabs (- ew (* eh (* (sin t) (sin (atan (/ (- eh) (/ ew (tan t))))))))))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double tmp;
if ((ew <= -2.7e-34) || !(ew <= 1.06e-72)) {
tmp = fabs((t_1 + (t_1 * (eh * (tan(t) / ew)))));
} else {
tmp = fabs((ew - (eh * (sin(t) * sin(atan((-eh / (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) :: t_1
real(8) :: tmp
t_1 = ew * cos(t)
if ((ew <= (-2.7d-34)) .or. (.not. (ew <= 1.06d-72))) then
tmp = abs((t_1 + (t_1 * (eh * (tan(t) / ew)))))
else
tmp = abs((ew - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t)))))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.cos(t);
double tmp;
if ((ew <= -2.7e-34) || !(ew <= 1.06e-72)) {
tmp = Math.abs((t_1 + (t_1 * (eh * (Math.tan(t) / ew)))));
} else {
tmp = Math.abs((ew - (eh * (Math.sin(t) * Math.sin(Math.atan((-eh / (ew / Math.tan(t)))))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) tmp = 0 if (ew <= -2.7e-34) or not (ew <= 1.06e-72): tmp = math.fabs((t_1 + (t_1 * (eh * (math.tan(t) / ew))))) else: tmp = math.fabs((ew - (eh * (math.sin(t) * math.sin(math.atan((-eh / (ew / math.tan(t))))))))) return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) tmp = 0.0 if ((ew <= -2.7e-34) || !(ew <= 1.06e-72)) tmp = abs(Float64(t_1 + Float64(t_1 * Float64(eh * Float64(tan(t) / ew))))); else tmp = abs(Float64(ew - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t))))))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); tmp = 0.0; if ((ew <= -2.7e-34) || ~((ew <= 1.06e-72))) tmp = abs((t_1 + (t_1 * (eh * (tan(t) / ew))))); else tmp = abs((ew - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t))))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -2.7e-34], N[Not[LessEqual[ew, 1.06e-72]], $MachinePrecision]], N[Abs[N[(t$95$1 + N[(t$95$1 * N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
\mathbf{if}\;ew \leq -2.7 \cdot 10^{-34} \lor \neg \left(ew \leq 1.06 \cdot 10^{-72}\right):\\
\;\;\;\;\left|t_1 + t_1 \cdot \left(eh \cdot \frac{\tan t}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|\\
\end{array}
\end{array}
if ew < -2.70000000000000017e-34 or 1.05999999999999994e-72 < ew Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u54.4%
expm1-udef46.3%
Applied egg-rr47.6%
expm1-def55.8%
expm1-log1p99.8%
associate-/l*99.7%
*-commutative99.7%
associate-*l/99.7%
associate-*r/99.7%
Simplified99.7%
associate-*r*99.7%
sin-atan93.2%
associate-*r/90.0%
div-inv89.9%
add-sqr-sqrt53.3%
sqrt-unprod76.4%
sqr-neg76.4%
sqrt-unprod35.5%
add-sqr-sqrt88.6%
clear-num88.6%
hypot-1-def89.1%
div-inv89.1%
Applied egg-rr89.1%
associate-/l*98.4%
associate-/r/98.4%
Simplified98.4%
Taylor expanded in eh around -inf 97.7%
mul-1-neg97.7%
distribute-rgt-neg-in97.7%
Simplified97.7%
Taylor expanded in ew around inf 97.2%
if -2.70000000000000017e-34 < ew < 1.05999999999999994e-72Initial program 99.9%
fabs-neg99.9%
sub0-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--r+99.9%
Simplified99.9%
expm1-log1p-u99.9%
expm1-udef62.3%
Applied egg-rr62.3%
expm1-def99.9%
expm1-log1p99.9%
associate-/l*99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 95.4%
Final simplification96.4%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t))) (* eh (sin t)))))
double code(double eh, double ew, double t) {
return fabs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * sin(t))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew / (Math.hypot(1.0, (Math.tan(t) * (eh / ew))) / Math.cos(t))) - (eh * Math.sin(t))));
}
def code(eh, ew, t): return math.fabs(((ew / (math.hypot(1.0, (math.tan(t) * (eh / ew))) / math.cos(t))) - (eh * math.sin(t))))
function code(eh, ew, t) return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t))) - Float64(eh * sin(t)))) end
function tmp = code(eh, ew, t) tmp = abs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * sin(t)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}} - eh \cdot \sin t\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u73.6%
expm1-udef53.0%
Applied egg-rr53.8%
expm1-def74.4%
expm1-log1p99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan80.6%
associate-*r/78.7%
div-inv78.6%
add-sqr-sqrt44.1%
sqrt-unprod67.3%
sqr-neg67.3%
sqrt-unprod33.9%
add-sqr-sqrt77.9%
clear-num77.9%
hypot-1-def83.9%
div-inv83.9%
Applied egg-rr83.9%
associate-/l*91.2%
associate-/r/91.2%
Simplified91.2%
Taylor expanded in eh around inf 98.2%
Final simplification98.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t)))
(t_2
(- 0.0 (* (fabs t_1) (- 0.0 (fabs (pow 1.0 0.3333333333333333)))))))
(if (<= ew -1.18e+28)
t_2
(if (<= ew 8.5e+81) (fabs (+ ew (* t_1 (* eh (/ (tan t) ew))))) t_2))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = 0.0 - (fabs(t_1) * (0.0 - fabs(pow(1.0, 0.3333333333333333))));
double tmp;
if (ew <= -1.18e+28) {
tmp = t_2;
} else if (ew <= 8.5e+81) {
tmp = fabs((ew + (t_1 * (eh * (tan(t) / ew)))));
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = ew * cos(t)
t_2 = 0.0d0 - (abs(t_1) * (0.0d0 - abs((1.0d0 ** 0.3333333333333333d0))))
if (ew <= (-1.18d+28)) then
tmp = t_2
else if (ew <= 8.5d+81) then
tmp = abs((ew + (t_1 * (eh * (tan(t) / ew)))))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.cos(t);
double t_2 = 0.0 - (Math.abs(t_1) * (0.0 - Math.abs(Math.pow(1.0, 0.3333333333333333))));
double tmp;
if (ew <= -1.18e+28) {
tmp = t_2;
} else if (ew <= 8.5e+81) {
tmp = Math.abs((ew + (t_1 * (eh * (Math.tan(t) / ew)))));
} else {
tmp = t_2;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) t_2 = 0.0 - (math.fabs(t_1) * (0.0 - math.fabs(math.pow(1.0, 0.3333333333333333)))) tmp = 0 if ew <= -1.18e+28: tmp = t_2 elif ew <= 8.5e+81: tmp = math.fabs((ew + (t_1 * (eh * (math.tan(t) / ew))))) else: tmp = t_2 return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = Float64(0.0 - Float64(abs(t_1) * Float64(0.0 - abs((1.0 ^ 0.3333333333333333))))) tmp = 0.0 if (ew <= -1.18e+28) tmp = t_2; elseif (ew <= 8.5e+81) tmp = abs(Float64(ew + Float64(t_1 * Float64(eh * Float64(tan(t) / ew))))); else tmp = t_2; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); t_2 = 0.0 - (abs(t_1) * (0.0 - abs((1.0 ^ 0.3333333333333333)))); tmp = 0.0; if (ew <= -1.18e+28) tmp = t_2; elseif (ew <= 8.5e+81) tmp = abs((ew + (t_1 * (eh * (tan(t) / ew))))); else tmp = t_2; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.0 - N[(N[Abs[t$95$1], $MachinePrecision] * N[(0.0 - N[Abs[N[Power[1.0, 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -1.18e+28], t$95$2, If[LessEqual[ew, 8.5e+81], N[Abs[N[(ew + N[(t$95$1 * N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := 0 - \left|t_1\right| \cdot \left(0 - \left|{1}^{0.3333333333333333}\right|\right)\\
\mathbf{if}\;ew \leq -1.18 \cdot 10^{+28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;ew \leq 8.5 \cdot 10^{+81}:\\
\;\;\;\;\left|ew + t_1 \cdot \left(eh \cdot \frac{\tan t}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if ew < -1.18000000000000009e28 or 8.49999999999999986e81 < ew Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
sin-mult88.6%
associate-*r/88.6%
Applied egg-rr87.7%
+-inverses87.7%
*-commutative87.7%
associate-/l*87.7%
div087.7%
Simplified87.7%
add-cube-cbrt86.0%
pow386.0%
Applied egg-rr85.9%
Taylor expanded in eh around 0 87.8%
if -1.18000000000000009e28 < ew < 8.49999999999999986e81Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u96.3%
expm1-udef61.2%
Applied egg-rr61.2%
expm1-def96.3%
expm1-log1p99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan69.1%
associate-*r/68.9%
div-inv68.8%
add-sqr-sqrt34.7%
sqrt-unprod57.3%
sqr-neg57.3%
sqrt-unprod33.2%
add-sqr-sqrt67.9%
clear-num67.9%
hypot-1-def77.9%
div-inv77.9%
Applied egg-rr78.0%
associate-/l*85.6%
associate-/r/85.6%
Simplified85.6%
Taylor expanded in eh around -inf 85.3%
mul-1-neg85.3%
distribute-rgt-neg-in85.3%
Simplified85.3%
Taylor expanded in t around 0 77.9%
Final simplification82.0%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* ew (cos t)))) (fabs (+ t_1 (* t_1 (* eh (/ (tan t) ew)))))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
return fabs((t_1 + (t_1 * (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
real(8) :: t_1
t_1 = ew * cos(t)
code = abs((t_1 + (t_1 * (eh * (tan(t) / ew)))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.cos(t);
return Math.abs((t_1 + (t_1 * (eh * (Math.tan(t) / ew)))));
}
def code(eh, ew, t): t_1 = ew * math.cos(t) return math.fabs((t_1 + (t_1 * (eh * (math.tan(t) / ew)))))
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) return abs(Float64(t_1 + Float64(t_1 * Float64(eh * Float64(tan(t) / ew))))) end
function tmp = code(eh, ew, t) t_1 = ew * cos(t); tmp = abs((t_1 + (t_1 * (eh * (tan(t) / ew))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(t$95$1 + N[(t$95$1 * N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
\left|t_1 + t_1 \cdot \left(eh \cdot \frac{\tan t}{ew}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u73.6%
expm1-udef53.0%
Applied egg-rr53.8%
expm1-def74.4%
expm1-log1p99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan80.6%
associate-*r/78.7%
div-inv78.6%
add-sqr-sqrt44.1%
sqrt-unprod67.3%
sqr-neg67.3%
sqrt-unprod33.9%
add-sqr-sqrt77.9%
clear-num77.9%
hypot-1-def83.9%
div-inv83.9%
Applied egg-rr83.9%
associate-/l*91.2%
associate-/r/91.2%
Simplified91.2%
Taylor expanded in eh around -inf 90.7%
mul-1-neg90.7%
distribute-rgt-neg-in90.7%
Simplified90.7%
Taylor expanded in ew around inf 90.3%
Final simplification90.3%
(FPCore (eh ew t) :precision binary64 (- 0.0 (* (fabs (* ew (cos t))) (- 0.0 (fabs (pow 1.0 0.3333333333333333))))))
double code(double eh, double ew, double t) {
return 0.0 - (fabs((ew * cos(t))) * (0.0 - fabs(pow(1.0, 0.3333333333333333))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = 0.0d0 - (abs((ew * cos(t))) * (0.0d0 - abs((1.0d0 ** 0.3333333333333333d0))))
end function
public static double code(double eh, double ew, double t) {
return 0.0 - (Math.abs((ew * Math.cos(t))) * (0.0 - Math.abs(Math.pow(1.0, 0.3333333333333333))));
}
def code(eh, ew, t): return 0.0 - (math.fabs((ew * math.cos(t))) * (0.0 - math.fabs(math.pow(1.0, 0.3333333333333333))))
function code(eh, ew, t) return Float64(0.0 - Float64(abs(Float64(ew * cos(t))) * Float64(0.0 - abs((1.0 ^ 0.3333333333333333))))) end
function tmp = code(eh, ew, t) tmp = 0.0 - (abs((ew * cos(t))) * (0.0 - abs((1.0 ^ 0.3333333333333333)))); end
code[eh_, ew_, t_] := N[(0.0 - N[(N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Abs[N[Power[1.0, 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0 - \left|ew \cdot \cos t\right| \cdot \left(0 - \left|{1}^{0.3333333333333333}\right|\right)
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
sin-mult66.2%
associate-*r/66.2%
Applied egg-rr64.7%
+-inverses64.7%
*-commutative64.7%
associate-/l*64.7%
div064.7%
Simplified64.7%
add-cube-cbrt63.5%
pow363.5%
Applied egg-rr63.2%
Taylor expanded in eh around 0 64.9%
Final simplification64.9%
(FPCore (eh ew t) :precision binary64 (* (fabs ew) (fabs (pow 1.0 0.3333333333333333))))
double code(double eh, double ew, double t) {
return fabs(ew) * fabs(pow(1.0, 0.3333333333333333));
}
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) * abs((1.0d0 ** 0.3333333333333333d0))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(ew) * Math.abs(Math.pow(1.0, 0.3333333333333333));
}
def code(eh, ew, t): return math.fabs(ew) * math.fabs(math.pow(1.0, 0.3333333333333333))
function code(eh, ew, t) return Float64(abs(ew) * abs((1.0 ^ 0.3333333333333333))) end
function tmp = code(eh, ew, t) tmp = abs(ew) * abs((1.0 ^ 0.3333333333333333)); end
code[eh_, ew_, t_] := N[(N[Abs[ew], $MachinePrecision] * N[Abs[N[Power[1.0, 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|ew\right| \cdot \left|{1}^{0.3333333333333333}\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
sin-mult66.2%
associate-*r/66.2%
Applied egg-rr64.7%
+-inverses64.7%
*-commutative64.7%
associate-/l*64.7%
div064.7%
Simplified64.7%
add-cube-cbrt63.5%
pow363.5%
Applied egg-rr63.2%
Taylor expanded in t around 0 44.6%
Final simplification44.6%
(FPCore (eh ew t) :precision binary64 (fabs (/ (* (cos t) 2.0) (/ 2.0 ew))))
double code(double eh, double ew, double t) {
return fabs(((cos(t) * 2.0) / (2.0 / 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(t) * 2.0d0) / (2.0d0 / ew)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.cos(t) * 2.0) / (2.0 / ew)));
}
def code(eh, ew, t): return math.fabs(((math.cos(t) * 2.0) / (2.0 / ew)))
function code(eh, ew, t) return abs(Float64(Float64(cos(t) * 2.0) / Float64(2.0 / ew))) end
function tmp = code(eh, ew, t) tmp = abs(((cos(t) * 2.0) / (2.0 / ew))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * 2.0), $MachinePrecision] / N[(2.0 / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\cos t \cdot 2}{\frac{2}{ew}}\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
cos-mult99.1%
associate-*r/99.1%
Applied egg-rr99.1%
*-commutative99.1%
associate-/l*98.9%
count-298.9%
*-commutative98.9%
associate-*l/98.9%
associate-*r/98.9%
Simplified98.9%
sin-mult66.2%
associate-*r/66.2%
Applied egg-rr64.7%
+-inverses64.7%
*-commutative64.7%
associate-/l*64.7%
div064.7%
Simplified64.7%
Taylor expanded in t around inf 64.8%
Final simplification64.8%
herbie shell --seed 2023238
(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)))))))