
(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 10 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 (* (tan t) (/ eh ew))) 1.0)))
(fabs
(-
(* (fma (cos t_1) (cos 1.0) (* (sin t_1) (sin 1.0))) (* ew (cos t)))
(* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) (- ew)))))))))
double code(double eh, double ew, double t) {
double t_1 = atan((tan(t) * (eh / ew))) + 1.0;
return fabs(((fma(cos(t_1), cos(1.0), (sin(t_1) * sin(1.0))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / -ew))))));
}
function code(eh, ew, t) t_1 = Float64(atan(Float64(tan(t) * Float64(eh / ew))) + 1.0) return abs(Float64(Float64(fma(cos(t_1), cos(1.0), Float64(sin(t_1) * sin(1.0))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(-ew))))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Cos[t$95$1], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[Sin[t$95$1], $MachinePrecision] * N[Sin[1.0], $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[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right) + 1\\
\left|\mathsf{fma}\left(\cos t\_1, \cos 1, \sin t\_1 \cdot \sin 1\right) \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{-ew}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
expm1-log1p-u80.0%
expm1-undefine80.0%
cos-diff79.9%
associate-/l*79.9%
add-sqr-sqrt41.7%
sqrt-unprod62.7%
sqr-neg62.7%
sqrt-unprod27.6%
add-sqr-sqrt57.1%
Applied egg-rr77.6%
fma-define77.6%
log1p-undefine77.6%
rem-exp-log77.6%
+-commutative77.6%
*-commutative77.6%
associate-*l/77.6%
associate-*r/77.6%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (cos (atan (/ (* (tan t) eh) ew))) (* ew (cos t))) (* (* eh (sin t)) (sin (atan (/ (* (tan t) (- eh)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((cos(atan(((tan(t) * eh) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / 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(((tan(t) * eh) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.cos(Math.atan(((Math.tan(t) * eh) / ew))) * (ew * Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * -eh) / ew))))));
}
def code(eh, ew, t): return math.fabs(((math.cos(math.atan(((math.tan(t) * eh) / ew))) * (ew * math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * -eh) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(cos(atan(Float64(Float64(tan(t) * eh) / ew))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((cos(atan(((tan(t) * eh) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $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[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\cos \tan^{-1} \left(\frac{\tan t \cdot eh}{ew}\right) \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
add-log-exp89.1%
*-un-lft-identity89.1%
log-prod89.1%
metadata-eval89.1%
add-log-exp99.8%
add-sqr-sqrt48.4%
sqrt-unprod93.1%
sqr-neg93.1%
sqrt-unprod51.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
+-lft-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (sin t)) (sin (atan (/ (* (tan t) (- eh)) ew)))) (* (* ew (cos t)) (/ -1.0 (hypot 1.0 (* (tan t) (/ eh ew))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew)))) + ((ew * cos(t)) * (-1.0 / hypot(1.0, (tan(t) * (eh / ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * -eh) / ew)))) + ((ew * Math.cos(t)) * (-1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew)))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * -eh) / ew)))) + ((ew * math.cos(t)) * (-1.0 / math.hypot(1.0, (math.tan(t) * (eh / ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew)))) + Float64(Float64(ew * cos(t)) * Float64(-1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew)))) + ((ew * cos(t)) * (-1.0 / hypot(1.0, (tan(t) * (eh / ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right) + \left(ew \cdot \cos t\right) \cdot \frac{-1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt48.4%
sqrt-unprod92.5%
sqr-neg92.5%
sqrt-unprod51.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (cos (atan (/ (* (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(((cos(atan(((tan(t) * eh) / -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(((tan(t) * eh) / -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(((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(((math.cos(math.atan(((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(cos(atan(Float64(Float64(tan(t) * eh) / Float64(-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(((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[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $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{\tan t \cdot 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.3%
associate-*r*99.3%
mul-1-neg99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) (- ew))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / -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(((tan(t) * eh) / -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(((Math.tan(t) * eh) / -ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / -ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(-ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / -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[(N[Tan[t], $MachinePrecision] * eh), $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{\tan t \cdot eh}{-ew}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt48.4%
sqrt-unprod92.5%
sqr-neg92.5%
sqrt-unprod51.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 98.8%
Final simplification98.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / 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(((tan(t) * eh) / 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(((Math.tan(t) * eh) / ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / 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[(N[Tan[t], $MachinePrecision] * eh), $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{\tan t \cdot eh}{ew}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt48.4%
sqrt-unprod92.5%
sqr-neg92.5%
sqrt-unprod51.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 98.8%
add-log-exp89.1%
*-un-lft-identity89.1%
log-prod89.1%
metadata-eval89.1%
add-log-exp99.8%
add-sqr-sqrt48.4%
sqrt-unprod93.1%
sqr-neg93.1%
sqrt-unprod51.5%
add-sqr-sqrt99.8%
Applied egg-rr98.8%
+-lft-identity99.8%
Simplified98.8%
Final simplification98.8%
(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(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[(eh * N[(t / ew), $MachinePrecision]), $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(eh \cdot \frac{t}{ew}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt48.4%
sqrt-unprod92.5%
sqr-neg92.5%
sqrt-unprod51.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 98.8%
Taylor expanded in t around 0 98.7%
associate-*r*99.3%
mul-1-neg99.3%
Simplified98.7%
pow198.7%
associate-/l*98.7%
add-sqr-sqrt47.8%
sqrt-unprod92.9%
sqr-neg92.9%
sqrt-unprod50.9%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
unpow198.7%
Simplified98.7%
Final simplification98.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))) (t_2 (* eh (/ t ew))))
(if (or (<= ew -2e-64) (not (<= ew 9.8e-88)))
(fabs (- (* ew (cos t)) (* t_1 (/ t_2 (hypot 1.0 t_2)))))
(fabs (- ew (* t_1 (sin (atan (/ (* eh (- t)) ew)))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double t_2 = eh * (t / ew);
double tmp;
if ((ew <= -2e-64) || !(ew <= 9.8e-88)) {
tmp = fabs(((ew * cos(t)) - (t_1 * (t_2 / hypot(1.0, t_2)))));
} else {
tmp = fabs((ew - (t_1 * sin(atan(((eh * -t) / ew))))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.sin(t);
double t_2 = eh * (t / ew);
double tmp;
if ((ew <= -2e-64) || !(ew <= 9.8e-88)) {
tmp = Math.abs(((ew * Math.cos(t)) - (t_1 * (t_2 / Math.hypot(1.0, t_2)))));
} else {
tmp = Math.abs((ew - (t_1 * Math.sin(Math.atan(((eh * -t) / ew))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.sin(t) t_2 = eh * (t / ew) tmp = 0 if (ew <= -2e-64) or not (ew <= 9.8e-88): tmp = math.fabs(((ew * math.cos(t)) - (t_1 * (t_2 / math.hypot(1.0, t_2))))) else: tmp = math.fabs((ew - (t_1 * math.sin(math.atan(((eh * -t) / ew)))))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) t_2 = Float64(eh * Float64(t / ew)) tmp = 0.0 if ((ew <= -2e-64) || !(ew <= 9.8e-88)) tmp = abs(Float64(Float64(ew * cos(t)) - Float64(t_1 * Float64(t_2 / hypot(1.0, t_2))))); else tmp = abs(Float64(ew - Float64(t_1 * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * sin(t); t_2 = eh * (t / ew); tmp = 0.0; if ((ew <= -2e-64) || ~((ew <= 9.8e-88))) tmp = abs(((ew * cos(t)) - (t_1 * (t_2 / hypot(1.0, t_2))))); else tmp = abs((ew - (t_1 * sin(atan(((eh * -t) / ew)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[(t / ew), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -2e-64], N[Not[LessEqual[ew, 9.8e-88]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[(t$95$2 / N[Sqrt[1.0 ^ 2 + t$95$2 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(t$95$1 * 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 \sin t\\
t_2 := eh \cdot \frac{t}{ew}\\
\mathbf{if}\;ew \leq -2 \cdot 10^{-64} \lor \neg \left(ew \leq 9.8 \cdot 10^{-88}\right):\\
\;\;\;\;\left|ew \cdot \cos t - t\_1 \cdot \frac{t\_2}{\mathsf{hypot}\left(1, t\_2\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - t\_1 \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right|\\
\end{array}
\end{array}
if ew < -1.99999999999999993e-64 or 9.80000000000000055e-88 < ew Initial program 99.9%
cos-atan99.9%
hypot-1-def99.9%
associate-/l*99.9%
add-sqr-sqrt52.4%
sqrt-unprod88.4%
sqr-neg88.4%
sqrt-unprod47.5%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
*-commutative99.9%
associate-*l/99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in t around 0 98.6%
Taylor expanded in t around 0 98.4%
associate-*r*99.0%
mul-1-neg99.0%
Simplified98.4%
sin-atan87.8%
associate-*r/86.6%
associate-/l*87.2%
add-sqr-sqrt44.7%
sqrt-unprod71.6%
sqr-neg71.6%
sqrt-unprod42.4%
add-sqr-sqrt87.2%
hypot-1-def90.1%
associate-/l*90.4%
add-sqr-sqrt46.1%
sqrt-unprod78.7%
sqr-neg78.7%
sqrt-unprod44.2%
add-sqr-sqrt90.4%
Applied egg-rr90.4%
associate-/l*94.5%
Simplified94.5%
if -1.99999999999999993e-64 < ew < 9.80000000000000055e-88Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt41.4%
sqrt-unprod99.6%
sqr-neg99.6%
sqrt-unprod58.4%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 99.2%
Taylor expanded in t around 0 99.2%
associate-*r*99.8%
mul-1-neg99.8%
Simplified99.2%
Taylor expanded in t around 0 93.4%
Final simplification94.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (/ (* eh (- t)) ew)))))
(if (<= ew -5.5e+101)
(fabs (- (* ew (cos t)) (* t_1 (* t eh))))
(fabs (- ew (* (* eh (sin t)) t_1))))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan(((eh * -t) / ew)));
double tmp;
if (ew <= -5.5e+101) {
tmp = fabs(((ew * cos(t)) - (t_1 * (t * eh))));
} else {
tmp = fabs((ew - ((eh * sin(t)) * 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 * -t) / ew)))
if (ew <= (-5.5d+101)) then
tmp = abs(((ew * cos(t)) - (t_1 * (t * eh))))
else
tmp = abs((ew - ((eh * sin(t)) * 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 * -t) / ew)));
double tmp;
if (ew <= -5.5e+101) {
tmp = Math.abs(((ew * Math.cos(t)) - (t_1 * (t * eh))));
} else {
tmp = Math.abs((ew - ((eh * Math.sin(t)) * t_1)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(math.atan(((eh * -t) / ew))) tmp = 0 if ew <= -5.5e+101: tmp = math.fabs(((ew * math.cos(t)) - (t_1 * (t * eh)))) else: tmp = math.fabs((ew - ((eh * math.sin(t)) * t_1))) return tmp
function code(eh, ew, t) t_1 = sin(atan(Float64(Float64(eh * Float64(-t)) / ew))) tmp = 0.0 if (ew <= -5.5e+101) tmp = abs(Float64(Float64(ew * cos(t)) - Float64(t_1 * Float64(t * eh)))); else tmp = abs(Float64(ew - Float64(Float64(eh * sin(t)) * t_1))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(atan(((eh * -t) / ew))); tmp = 0.0; if (ew <= -5.5e+101) tmp = abs(((ew * cos(t)) - (t_1 * (t * eh)))); else tmp = abs((ew - ((eh * sin(t)) * t_1))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(N[(eh * (-t)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -5.5e+101], N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[(t * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\\
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+101}:\\
\;\;\;\;\left|ew \cdot \cos t - t\_1 \cdot \left(t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot t\_1\right|\\
\end{array}
\end{array}
if ew < -5.50000000000000018e101Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt45.3%
sqrt-unprod77.7%
sqr-neg77.7%
sqrt-unprod54.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 99.8%
Taylor expanded in t around 0 99.8%
associate-*r*99.8%
mul-1-neg99.8%
Simplified99.8%
Taylor expanded in t around 0 87.4%
if -5.50000000000000018e101 < ew Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt49.0%
sqrt-unprod95.6%
sqr-neg95.6%
sqrt-unprod50.8%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 98.6%
Taylor expanded in t around 0 98.5%
associate-*r*99.2%
mul-1-neg99.2%
Simplified98.5%
Taylor expanded in t around 0 87.9%
Final simplification87.8%
(FPCore (eh ew t) :precision binary64 (fabs (- ew (* (* eh (sin t)) (sin (atan (/ (* eh (- t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs((ew - ((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 - ((eh * sin(t)) * sin(atan(((eh * -t) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -t) / ew))))));
}
def code(eh, ew, t): return math.fabs((ew - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -t) / ew))))))
function code(eh, ew, t) return abs(Float64(ew - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((ew - ((eh * sin(t)) * sin(atan(((eh * -t) / ew)))))); end
code[eh_, ew_, t_] := 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]
\begin{array}{l}
\\
\left|ew - \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%
cos-atan99.8%
hypot-1-def99.8%
associate-/l*99.8%
add-sqr-sqrt48.4%
sqrt-unprod92.5%
sqr-neg92.5%
sqrt-unprod51.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 98.8%
Taylor expanded in t around 0 98.7%
associate-*r*99.3%
mul-1-neg99.3%
Simplified98.7%
Taylor expanded in t around 0 84.1%
Final simplification84.1%
herbie shell --seed 2024093
(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)))))))