
(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 13 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 (fabs (- (* ew (* (cos t) (/ 1.0 (hypot 1.0 (* (tan t) (/ eh ew)))))) (* (sin t) (* eh (sin (atan (* (tan t) (/ eh (- ew))))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * (cos(t) * (1.0 / hypot(1.0, (tan(t) * (eh / ew)))))) - (sin(t) * (eh * sin(atan((tan(t) * (eh / -ew))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * (Math.cos(t) * (1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew)))))) - (Math.sin(t) * (eh * Math.sin(Math.atan((Math.tan(t) * (eh / -ew))))))));
}
def code(eh, ew, t): return math.fabs(((ew * (math.cos(t) * (1.0 / math.hypot(1.0, (math.tan(t) * (eh / ew)))))) - (math.sin(t) * (eh * math.sin(math.atan((math.tan(t) * (eh / -ew))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * Float64(cos(t) * Float64(1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew)))))) - Float64(sin(t) * Float64(eh * sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * (cos(t) * (1.0 / hypot(1.0, (tan(t) * (eh / ew)))))) - (sin(t) * (eh * sin(atan((tan(t) * (eh / -ew)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[(N[Cos[t], $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \left(\cos t \cdot \frac{1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right) - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
Simplified99.8%
cos-atan99.8%
hypot-1-def99.8%
add-sqr-sqrt45.6%
sqrt-unprod92.8%
sqr-neg92.8%
sqrt-unprod54.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (sin t) (* eh (sin (atan (/ (- eh) (/ ew t)))))) (* ew (* (cos t) (cos (atan (* (tan t) (/ eh (- ew))))))))))
double code(double eh, double ew, double t) {
return fabs(((sin(t) * (eh * sin(atan((-eh / (ew / t)))))) - (ew * (cos(t) * cos(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(((sin(t) * (eh * sin(atan((-eh / (ew / t)))))) - (ew * (cos(t) * cos(atan((tan(t) * (eh / -ew))))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(t) * (eh * Math.sin(Math.atan((-eh / (ew / t)))))) - (ew * (Math.cos(t) * Math.cos(Math.atan((Math.tan(t) * (eh / -ew))))))));
}
def code(eh, ew, t): return math.fabs(((math.sin(t) * (eh * math.sin(math.atan((-eh / (ew / t)))))) - (ew * (math.cos(t) * math.cos(math.atan((math.tan(t) * (eh / -ew))))))))
function code(eh, ew, t) return abs(Float64(Float64(sin(t) * Float64(eh * sin(atan(Float64(Float64(-eh) / Float64(ew / t)))))) - Float64(ew * Float64(cos(t) * cos(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * (eh * sin(atan((-eh / (ew / t)))))) - (ew * (cos(t) * cos(atan((tan(t) * (eh / -ew)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[((-eh) / N[(ew / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(ew * N[(N[Cos[t], $MachinePrecision] * N[Cos[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{t}}\right)\right) - ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 98.8%
mul-1-neg77.6%
associate-/l*77.6%
distribute-neg-frac77.6%
Simplified98.8%
Final simplification98.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t))) (* (sin (atan (* (tan t) (/ eh (- ew))))) (* eh (sin t))))))
double code(double eh, double ew, double t) {
return fabs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (sin(atan((tan(t) * (eh / -ew)))) * (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))) - (Math.sin(Math.atan((Math.tan(t) * (eh / -ew)))) * (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))) - (math.sin(math.atan((math.tan(t) * (eh / -ew)))) * (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(sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))) * Float64(eh * sin(t))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (sin(atan((tan(t) * (eh / -ew)))) * (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[(N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(eh * N[Sin[t], $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}} - \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right) \cdot \left(eh \cdot \sin t\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
Simplified99.8%
expm1-log1p-u75.8%
expm1-udef56.5%
Applied egg-rr58.0%
expm1-def77.4%
expm1-log1p99.8%
associate-/l*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t))) (* (* eh (sin t)) (sin (atan (/ (- eh) (/ ew 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 / 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 / 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 / t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(-eh) / Float64(ew / 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 / 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[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / t), $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}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{t}}\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
Simplified99.8%
expm1-log1p-u75.8%
expm1-udef56.5%
Applied egg-rr58.0%
expm1-def77.4%
expm1-log1p99.8%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in t around 0 98.7%
mul-1-neg77.6%
associate-/l*77.6%
distribute-neg-frac77.6%
Simplified98.7%
Final simplification98.7%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (sin t) (* eh (sin (atan (* (tan t) (/ eh (- ew))))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - (sin(t) * (eh * 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)) - (sin(t) * (eh * 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)) - (Math.sin(t) * (eh * Math.sin(Math.atan((Math.tan(t) * (eh / -ew))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - (math.sin(t) * (eh * math.sin(math.atan((math.tan(t) * (eh / -ew))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(sin(t) * Float64(eh * sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - (sin(t) * (eh * sin(atan((tan(t) * (eh / -ew)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
Simplified99.8%
cos-atan99.8%
hypot-1-def99.8%
add-sqr-sqrt45.6%
sqrt-unprod92.8%
sqr-neg92.8%
sqrt-unprod54.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 98.1%
Taylor expanded in ew around 0 98.1%
Final simplification98.1%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (sin t) (* eh (sin (atan (/ (- eh) (/ ew t)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - (sin(t) * (eh * sin(atan((-eh / (ew / t))))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((ew * cos(t)) - (sin(t) * (eh * sin(atan((-eh / (ew / t))))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) - (Math.sin(t) * (eh * Math.sin(Math.atan((-eh / (ew / t))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - (math.sin(t) * (eh * math.sin(math.atan((-eh / (ew / t))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(sin(t) * Float64(eh * sin(atan(Float64(Float64(-eh) / Float64(ew / t)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - (sin(t) * (eh * sin(atan((-eh / (ew / t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[((-eh) / N[(ew / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{t}}\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
Simplified99.8%
cos-atan99.8%
hypot-1-def99.8%
add-sqr-sqrt45.6%
sqrt-unprod92.8%
sqr-neg92.8%
sqrt-unprod54.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 98.1%
Taylor expanded in t around 0 97.7%
mul-1-neg77.6%
associate-/l*77.6%
distribute-neg-frac77.6%
Simplified97.7%
Final simplification97.7%
(FPCore (eh ew t) :precision binary64 (fabs (- ew (* (sin (atan (* (tan t) (/ eh (- ew))))) (* eh (sin t))))))
double code(double eh, double ew, double t) {
return fabs((ew - (sin(atan((tan(t) * (eh / -ew)))) * (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 - (sin(atan((tan(t) * (eh / -ew)))) * (eh * sin(t)))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew - (Math.sin(Math.atan((Math.tan(t) * (eh / -ew)))) * (eh * Math.sin(t)))));
}
def code(eh, ew, t): return math.fabs((ew - (math.sin(math.atan((math.tan(t) * (eh / -ew)))) * (eh * math.sin(t)))))
function code(eh, ew, t) return abs(Float64(ew - Float64(sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))) * Float64(eh * sin(t))))) end
function tmp = code(eh, ew, t) tmp = abs((ew - (sin(atan((tan(t) * (eh / -ew)))) * (eh * sin(t))))); end
code[eh_, ew_, t_] := N[Abs[N[(ew - N[(N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew - \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right) \cdot \left(eh \cdot \sin t\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
Simplified99.8%
add-cube-cbrt98.6%
pow398.6%
Applied egg-rr98.6%
Taylor expanded in t around 0 77.6%
pow-base-177.6%
*-lft-identity77.6%
Simplified77.6%
Final simplification77.6%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* eh (sin t)) (sin (atan (/ (- eh) (/ ew t))))) ew)))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan((-eh / (ew / 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((((eh * sin(t)) * sin(atan((-eh / (ew / t))))) - 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 / t))))) - ew));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan((-eh / (ew / t))))) - ew))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(-eh) / Float64(ew / t))))) - ew)) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan((-eh / (ew / t))))) - ew)); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{t}}\right) - ew\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
Simplified99.8%
add-cube-cbrt98.6%
pow398.6%
Applied egg-rr98.6%
Taylor expanded in t around 0 77.6%
pow-base-177.6%
*-lft-identity77.6%
Simplified77.6%
Taylor expanded in t around 0 77.6%
mul-1-neg77.6%
associate-/l*77.6%
distribute-neg-frac77.6%
Simplified77.6%
Final simplification77.6%
(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(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[(eh * N[(t / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{t}{ew}\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
Simplified99.8%
add-cube-cbrt98.6%
pow398.6%
Applied egg-rr98.6%
Taylor expanded in t around 0 77.6%
pow-base-177.6%
*-lft-identity77.6%
Simplified77.6%
Taylor expanded in t around 0 77.6%
mul-1-neg77.6%
associate-/l*77.6%
distribute-neg-frac77.6%
Simplified77.6%
clear-num77.6%
associate-/r/77.6%
clear-num77.6%
add-sqr-sqrt38.1%
sqrt-unprod73.1%
sqr-neg73.1%
sqrt-unprod39.4%
add-sqr-sqrt77.5%
Applied egg-rr77.5%
Final simplification77.5%
(FPCore (eh ew t)
:precision binary64
(if (or (<= t -5.5e-6) (not (<= t 0.0033)))
(fabs
(-
ew
(* (* eh (sin t)) (* t (/ (/ eh (hypot 1.0 (* t (/ eh ew)))) (- ew))))))
(fabs (- ew (* (sin (atan (/ (- eh) (/ ew t)))) (* t eh))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -5.5e-6) || !(t <= 0.0033)) {
tmp = fabs((ew - ((eh * sin(t)) * (t * ((eh / hypot(1.0, (t * (eh / ew)))) / -ew)))));
} else {
tmp = fabs((ew - (sin(atan((-eh / (ew / t)))) * (t * eh))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -5.5e-6) || !(t <= 0.0033)) {
tmp = Math.abs((ew - ((eh * Math.sin(t)) * (t * ((eh / Math.hypot(1.0, (t * (eh / ew)))) / -ew)))));
} else {
tmp = Math.abs((ew - (Math.sin(Math.atan((-eh / (ew / t)))) * (t * eh))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -5.5e-6) or not (t <= 0.0033): tmp = math.fabs((ew - ((eh * math.sin(t)) * (t * ((eh / math.hypot(1.0, (t * (eh / ew)))) / -ew))))) else: tmp = math.fabs((ew - (math.sin(math.atan((-eh / (ew / t)))) * (t * eh)))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -5.5e-6) || !(t <= 0.0033)) tmp = abs(Float64(ew - Float64(Float64(eh * sin(t)) * Float64(t * Float64(Float64(eh / hypot(1.0, Float64(t * Float64(eh / ew)))) / Float64(-ew)))))); else tmp = abs(Float64(ew - Float64(sin(atan(Float64(Float64(-eh) / Float64(ew / t)))) * Float64(t * eh)))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -5.5e-6) || ~((t <= 0.0033))) tmp = abs((ew - ((eh * sin(t)) * (t * ((eh / hypot(1.0, (t * (eh / ew)))) / -ew))))); else tmp = abs((ew - (sin(atan((-eh / (ew / t)))) * (t * eh)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -5.5e-6], N[Not[LessEqual[t, 0.0033]], $MachinePrecision]], N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(t * N[(N[(eh / N[Sqrt[1.0 ^ 2 + N[(t * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(N[Sin[N[ArcTan[N[((-eh) / N[(ew / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(t * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-6} \lor \neg \left(t \leq 0.0033\right):\\
\;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot \left(t \cdot \frac{\frac{eh}{\mathsf{hypot}\left(1, t \cdot \frac{eh}{ew}\right)}}{-ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{t}}\right) \cdot \left(t \cdot eh\right)\right|\\
\end{array}
\end{array}
if t < -5.4999999999999999e-6 or 0.0033 < t Initial program 99.6%
sub-neg99.6%
distribute-rgt-neg-in99.6%
cancel-sign-sub99.6%
Simplified99.7%
add-cube-cbrt98.6%
pow398.6%
Applied egg-rr98.6%
Taylor expanded in t around 0 59.3%
pow-base-159.3%
*-lft-identity59.3%
Simplified59.3%
Taylor expanded in t around 0 59.3%
mul-1-neg59.3%
associate-/l*59.3%
distribute-neg-frac59.3%
Simplified59.3%
sin-atan14.5%
frac-2neg14.5%
remove-double-neg14.5%
associate-/l/15.0%
hypot-1-def24.4%
div-inv23.5%
add-sqr-sqrt10.0%
sqrt-unprod19.6%
sqr-neg19.6%
sqrt-unprod13.5%
add-sqr-sqrt23.5%
clear-num23.4%
distribute-neg-frac23.4%
Applied egg-rr23.4%
associate-/r*23.4%
associate-/r/25.4%
*-commutative25.4%
associate-*l/23.6%
associate-*r/26.0%
Simplified26.0%
if -5.4999999999999999e-6 < t < 0.0033Initial program 100.0%
sub-neg100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub100.0%
Simplified100.0%
add-cube-cbrt98.5%
pow398.5%
Applied egg-rr98.5%
Taylor expanded in t around 0 98.2%
pow-base-198.2%
*-lft-identity98.2%
Simplified98.2%
Taylor expanded in t around 0 98.2%
mul-1-neg98.2%
associate-/l*98.2%
distribute-neg-frac98.2%
Simplified98.2%
Taylor expanded in t around 0 97.8%
Final simplification59.6%
(FPCore (eh ew t)
:precision binary64
(if (or (<= t -7.5e-6) (not (<= t 0.0033)))
(fabs
(- ew (* (* eh (sin t)) (/ (/ eh ew) (/ (hypot 1.0 (* eh (/ t ew))) t)))))
(fabs (- ew (* (sin (atan (/ (- eh) (/ ew t)))) (* t eh))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -7.5e-6) || !(t <= 0.0033)) {
tmp = fabs((ew - ((eh * sin(t)) * ((eh / ew) / (hypot(1.0, (eh * (t / ew))) / t)))));
} else {
tmp = fabs((ew - (sin(atan((-eh / (ew / t)))) * (t * eh))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -7.5e-6) || !(t <= 0.0033)) {
tmp = Math.abs((ew - ((eh * Math.sin(t)) * ((eh / ew) / (Math.hypot(1.0, (eh * (t / ew))) / t)))));
} else {
tmp = Math.abs((ew - (Math.sin(Math.atan((-eh / (ew / t)))) * (t * eh))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -7.5e-6) or not (t <= 0.0033): tmp = math.fabs((ew - ((eh * math.sin(t)) * ((eh / ew) / (math.hypot(1.0, (eh * (t / ew))) / t))))) else: tmp = math.fabs((ew - (math.sin(math.atan((-eh / (ew / t)))) * (t * eh)))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -7.5e-6) || !(t <= 0.0033)) tmp = abs(Float64(ew - Float64(Float64(eh * sin(t)) * Float64(Float64(eh / ew) / Float64(hypot(1.0, Float64(eh * Float64(t / ew))) / t))))); else tmp = abs(Float64(ew - Float64(sin(atan(Float64(Float64(-eh) / Float64(ew / t)))) * Float64(t * eh)))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -7.5e-6) || ~((t <= 0.0033))) tmp = abs((ew - ((eh * sin(t)) * ((eh / ew) / (hypot(1.0, (eh * (t / ew))) / t))))); else tmp = abs((ew - (sin(atan((-eh / (ew / t)))) * (t * eh)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -7.5e-6], N[Not[LessEqual[t, 0.0033]], $MachinePrecision]], N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(N[(eh / ew), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + N[(eh * N[(t / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(N[Sin[N[ArcTan[N[((-eh) / N[(ew / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(t * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-6} \lor \neg \left(t \leq 0.0033\right):\\
\;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot \frac{\frac{eh}{ew}}{\frac{\mathsf{hypot}\left(1, eh \cdot \frac{t}{ew}\right)}{t}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{t}}\right) \cdot \left(t \cdot eh\right)\right|\\
\end{array}
\end{array}
if t < -7.50000000000000019e-6 or 0.0033 < t Initial program 99.6%
sub-neg99.6%
distribute-rgt-neg-in99.6%
cancel-sign-sub99.6%
Simplified99.7%
add-cube-cbrt98.6%
pow398.6%
Applied egg-rr98.6%
Taylor expanded in t around 0 59.3%
pow-base-159.3%
*-lft-identity59.3%
Simplified59.3%
Taylor expanded in t around 0 59.3%
mul-1-neg59.3%
associate-/l*59.3%
distribute-neg-frac59.3%
Simplified59.3%
sin-atan14.5%
associate-/r/15.9%
associate-/l*16.6%
add-sqr-sqrt7.4%
sqrt-unprod15.2%
sqr-neg15.2%
sqrt-unprod9.2%
add-sqr-sqrt16.6%
hypot-1-def25.7%
div-inv25.1%
add-sqr-sqrt10.8%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod14.2%
add-sqr-sqrt25.1%
clear-num25.0%
Applied egg-rr25.0%
if -7.50000000000000019e-6 < t < 0.0033Initial program 100.0%
sub-neg100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub100.0%
Simplified100.0%
add-cube-cbrt98.5%
pow398.5%
Applied egg-rr98.5%
Taylor expanded in t around 0 98.2%
pow-base-198.2%
*-lft-identity98.2%
Simplified98.2%
Taylor expanded in t around 0 98.2%
mul-1-neg98.2%
associate-/l*98.2%
distribute-neg-frac98.2%
Simplified98.2%
Taylor expanded in t around 0 97.8%
Final simplification59.1%
(FPCore (eh ew t) :precision binary64 (fabs (- ew (* (* eh (sin t)) (/ eh (/ (hypot 1.0 (* eh (/ t ew))) (/ t ew)))))))
double code(double eh, double ew, double t) {
return fabs((ew - ((eh * sin(t)) * (eh / (hypot(1.0, (eh * (t / ew))) / (t / ew))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((ew - ((eh * Math.sin(t)) * (eh / (Math.hypot(1.0, (eh * (t / ew))) / (t / ew))))));
}
def code(eh, ew, t): return math.fabs((ew - ((eh * math.sin(t)) * (eh / (math.hypot(1.0, (eh * (t / ew))) / (t / ew))))))
function code(eh, ew, t) return abs(Float64(ew - Float64(Float64(eh * sin(t)) * Float64(eh / Float64(hypot(1.0, Float64(eh * Float64(t / ew))) / Float64(t / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((ew - ((eh * sin(t)) * (eh / (hypot(1.0, (eh * (t / ew))) / (t / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(eh / N[(N[Sqrt[1.0 ^ 2 + N[(eh * N[(t / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[(t / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew - \left(eh \cdot \sin t\right) \cdot \frac{eh}{\frac{\mathsf{hypot}\left(1, eh \cdot \frac{t}{ew}\right)}{\frac{t}{ew}}}\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
Simplified99.8%
add-cube-cbrt98.6%
pow398.6%
Applied egg-rr98.6%
Taylor expanded in t around 0 77.6%
pow-base-177.6%
*-lft-identity77.6%
Simplified77.6%
Taylor expanded in t around 0 77.6%
mul-1-neg77.6%
associate-/l*77.6%
distribute-neg-frac77.6%
Simplified77.6%
sin-atan48.0%
div-inv47.8%
clear-num47.8%
associate-/l*48.1%
add-sqr-sqrt23.1%
sqrt-unprod40.7%
sqr-neg40.7%
sqrt-unprod24.9%
add-sqr-sqrt48.1%
hypot-1-def56.0%
div-inv56.0%
add-sqr-sqrt28.3%
sqrt-unprod46.2%
sqr-neg46.2%
sqrt-unprod27.6%
add-sqr-sqrt56.0%
clear-num56.0%
Applied egg-rr56.0%
Final simplification56.0%
(FPCore (eh ew t) :precision binary64 (fabs (- ew (* (sin (atan (/ (- eh) (/ ew t)))) (* t eh)))))
double code(double eh, double ew, double t) {
return fabs((ew - (sin(atan((-eh / (ew / t)))) * (t * eh))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((ew - (sin(atan((-eh / (ew / t)))) * (t * eh))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew - (Math.sin(Math.atan((-eh / (ew / t)))) * (t * eh))));
}
def code(eh, ew, t): return math.fabs((ew - (math.sin(math.atan((-eh / (ew / t)))) * (t * eh))))
function code(eh, ew, t) return abs(Float64(ew - Float64(sin(atan(Float64(Float64(-eh) / Float64(ew / t)))) * Float64(t * eh)))) end
function tmp = code(eh, ew, t) tmp = abs((ew - (sin(atan((-eh / (ew / t)))) * (t * eh)))); end
code[eh_, ew_, t_] := N[Abs[N[(ew - N[(N[Sin[N[ArcTan[N[((-eh) / N[(ew / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(t * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew - \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{t}}\right) \cdot \left(t \cdot eh\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
Simplified99.8%
add-cube-cbrt98.6%
pow398.6%
Applied egg-rr98.6%
Taylor expanded in t around 0 77.6%
pow-base-177.6%
*-lft-identity77.6%
Simplified77.6%
Taylor expanded in t around 0 77.6%
mul-1-neg77.6%
associate-/l*77.6%
distribute-neg-frac77.6%
Simplified77.6%
Taylor expanded in t around 0 51.4%
Final simplification51.4%
herbie shell --seed 2024019
(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)))))))