
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (/ (cos t) (hypot 1.0 (* (tan t) (/ eh ew))))) (* (* eh (sin t)) (sin (atan (/ (- eh) (/ ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * (cos(t) / hypot(1.0, (tan(t) * (eh / ew))))) - ((eh * sin(t)) * sin(atan((-eh / (ew / tan(t))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * (Math.cos(t) / Math.hypot(1.0, (Math.tan(t) * (eh / ew))))) - ((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) / math.hypot(1.0, (math.tan(t) * (eh / ew))))) - ((eh * math.sin(t)) * math.sin(math.atan((-eh / (ew / math.tan(t))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * Float64(cos(t) / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * (cos(t) / hypot(1.0, (tan(t) * (eh / ew))))) - ((eh * sin(t)) * sin(atan((-eh / (ew / tan(t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[(N[Cos[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
add-cbrt-cube59.3%
pow359.3%
Applied egg-rr59.6%
rem-cbrt-cube99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* eh (sin t)) (sin (atan (/ (- eh) (/ ew (tan t)))))) (/ ew (/ 1.0 (cos (+ t (atan (/ (* t eh) ew)))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan((-eh / (ew / tan(t)))))) - (ew / (1.0 / cos((t + atan(((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((((eh * sin(t)) * sin(atan((-eh / (ew / tan(t)))))) - (ew / (1.0d0 / cos((t + atan(((t * eh) / 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)))))) - (ew / (1.0 / Math.cos((t + Math.atan(((t * eh) / ew))))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan((-eh / (ew / math.tan(t)))))) - (ew / (1.0 / math.cos((t + math.atan(((t * eh) / ew))))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t)))))) - Float64(ew / Float64(1.0 / cos(Float64(t + atan(Float64(Float64(t * eh) / ew)))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * sin(atan((-eh / (ew / tan(t)))))) - (ew / (1.0 / cos((t + atan(((t * eh) / 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 / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(ew / N[(1.0 / N[Cos[N[(t + N[ArcTan[N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right) - \frac{ew}{\frac{1}{\cos \left(t + \tan^{-1} \left(\frac{t \cdot eh}{ew}\right)\right)}}\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Applied egg-rr98.1%
associate-/l*98.4%
count-298.4%
associate-/r*98.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in t around 0 98.4%
Final simplification98.4%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (cos t) ew) (* (* eh (sin t)) (sin (atan (/ (- eh) (/ ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs(((cos(t) * ew) - ((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(((cos(t) * ew) - ((eh * sin(t)) * sin(atan((-eh / (ew / tan(t))))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.cos(t) * ew) - ((eh * Math.sin(t)) * Math.sin(Math.atan((-eh / (ew / Math.tan(t))))))));
}
def code(eh, ew, t): return math.fabs(((math.cos(t) * ew) - ((eh * math.sin(t)) * math.sin(math.atan((-eh / (ew / math.tan(t))))))))
function code(eh, ew, t) return abs(Float64(Float64(cos(t) * ew) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((cos(t) * ew) - ((eh * sin(t)) * sin(atan((-eh / (ew / tan(t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\cos t \cdot ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
add-cbrt-cube59.3%
pow359.3%
Applied egg-rr59.6%
Taylor expanded in ew around inf 98.2%
Final simplification98.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))))
(if (<= eh -2.65e-17)
(fabs (- ew (* t_1 (sin (atan (/ (* t (- eh)) ew))))))
(if (<= eh 6.6e-111)
(fabs
(-
(/ ew (/ 1.0 (cos (+ t (atan (/ (* t eh) ew))))))
(* (* t eh) (sin (atan (* t (/ (- eh) ew)))))))
(fabs (- ew (* t_1 (sin (atan (* eh (/ (tan t) ew)))))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double tmp;
if (eh <= -2.65e-17) {
tmp = fabs((ew - (t_1 * sin(atan(((t * -eh) / ew))))));
} else if (eh <= 6.6e-111) {
tmp = fabs(((ew / (1.0 / cos((t + atan(((t * eh) / ew)))))) - ((t * eh) * sin(atan((t * (-eh / ew)))))));
} else {
tmp = fabs((ew - (t_1 * sin(atan((eh * (tan(t) / ew)))))));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = eh * sin(t)
if (eh <= (-2.65d-17)) then
tmp = abs((ew - (t_1 * sin(atan(((t * -eh) / ew))))))
else if (eh <= 6.6d-111) then
tmp = abs(((ew / (1.0d0 / cos((t + atan(((t * eh) / ew)))))) - ((t * eh) * sin(atan((t * (-eh / ew)))))))
else
tmp = abs((ew - (t_1 * sin(atan((eh * (tan(t) / ew)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.sin(t);
double tmp;
if (eh <= -2.65e-17) {
tmp = Math.abs((ew - (t_1 * Math.sin(Math.atan(((t * -eh) / ew))))));
} else if (eh <= 6.6e-111) {
tmp = Math.abs(((ew / (1.0 / Math.cos((t + Math.atan(((t * eh) / ew)))))) - ((t * eh) * Math.sin(Math.atan((t * (-eh / ew)))))));
} else {
tmp = Math.abs((ew - (t_1 * Math.sin(Math.atan((eh * (Math.tan(t) / ew)))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.sin(t) tmp = 0 if eh <= -2.65e-17: tmp = math.fabs((ew - (t_1 * math.sin(math.atan(((t * -eh) / ew)))))) elif eh <= 6.6e-111: tmp = math.fabs(((ew / (1.0 / math.cos((t + math.atan(((t * eh) / ew)))))) - ((t * eh) * math.sin(math.atan((t * (-eh / ew))))))) else: tmp = math.fabs((ew - (t_1 * math.sin(math.atan((eh * (math.tan(t) / ew))))))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) tmp = 0.0 if (eh <= -2.65e-17) tmp = abs(Float64(ew - Float64(t_1 * sin(atan(Float64(Float64(t * Float64(-eh)) / ew)))))); elseif (eh <= 6.6e-111) tmp = abs(Float64(Float64(ew / Float64(1.0 / cos(Float64(t + atan(Float64(Float64(t * eh) / ew)))))) - Float64(Float64(t * eh) * sin(atan(Float64(t * Float64(Float64(-eh) / ew))))))); else tmp = abs(Float64(ew - Float64(t_1 * sin(atan(Float64(eh * Float64(tan(t) / ew))))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * sin(t); tmp = 0.0; if (eh <= -2.65e-17) tmp = abs((ew - (t_1 * sin(atan(((t * -eh) / ew)))))); elseif (eh <= 6.6e-111) tmp = abs(((ew / (1.0 / cos((t + atan(((t * eh) / ew)))))) - ((t * eh) * sin(atan((t * (-eh / ew))))))); else tmp = abs((ew - (t_1 * sin(atan((eh * (tan(t) / ew))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -2.65e-17], N[Abs[N[(ew - N[(t$95$1 * N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 6.6e-111], N[Abs[N[(N[(ew / N[(1.0 / N[Cos[N[(t + N[ArcTan[N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(t * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(t$95$1 * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
\mathbf{if}\;eh \leq -2.65 \cdot 10^{-17}:\\
\;\;\;\;\left|ew - t\_1 \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right)\right|\\
\mathbf{elif}\;eh \leq 6.6 \cdot 10^{-111}:\\
\;\;\;\;\left|\frac{ew}{\frac{1}{\cos \left(t + \tan^{-1} \left(\frac{t \cdot eh}{ew}\right)\right)}} - \left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(t \cdot \frac{-eh}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - t\_1 \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\right|\\
\end{array}
\end{array}
if eh < -2.6499999999999999e-17Initial program 99.9%
sub-neg99.9%
distribute-rgt-neg-in99.9%
cancel-sign-sub99.9%
associate-*l*99.9%
associate-/l*99.9%
distribute-lft-neg-in99.9%
Simplified99.9%
add-cbrt-cube70.4%
pow370.4%
Applied egg-rr70.4%
Taylor expanded in t around 0 90.6%
Taylor expanded in t around 0 90.6%
associate-*r/90.6%
mul-1-neg90.6%
Simplified90.6%
if -2.6499999999999999e-17 < eh < 6.6e-111Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
Applied egg-rr98.7%
associate-/l*98.7%
count-298.7%
associate-/r*98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in t around 0 98.7%
Taylor expanded in t around 0 98.0%
associate-*r/59.8%
mul-1-neg59.8%
Simplified98.0%
Taylor expanded in t around 0 85.1%
associate-*r*53.8%
*-commutative53.8%
mul-1-neg53.8%
associate-*l/53.8%
distribute-rgt-neg-in53.8%
Simplified85.1%
if 6.6e-111 < eh Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.9%
associate-/l*99.9%
distribute-lft-neg-in99.9%
Simplified99.9%
add-cbrt-cube67.1%
pow367.0%
Applied egg-rr68.1%
Taylor expanded in t around 0 84.4%
expm1-log1p-u65.9%
expm1-udef57.6%
associate-/r/57.6%
add-sqr-sqrt0.0%
sqrt-unprod47.1%
sqr-neg47.1%
sqrt-unprod48.2%
add-sqr-sqrt48.2%
*-commutative48.2%
Applied egg-rr48.2%
expm1-def56.6%
expm1-log1p84.4%
associate-*r/84.4%
associate-*l/84.4%
Simplified84.4%
Final simplification86.3%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (* t (/ (- eh) ew))))))
(if (or (<= t -0.058) (not (<= t 1.5e+64)))
(fabs (* (* eh (sin t)) t_1))
(fabs (- ew (* (* t eh) t_1))))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan((t * (-eh / ew))));
double tmp;
if ((t <= -0.058) || !(t <= 1.5e+64)) {
tmp = fabs(((eh * sin(t)) * t_1));
} else {
tmp = fabs((ew - ((t * eh) * 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((t * (-eh / ew))))
if ((t <= (-0.058d0)) .or. (.not. (t <= 1.5d+64))) then
tmp = abs(((eh * sin(t)) * t_1))
else
tmp = abs((ew - ((t * eh) * 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((t * (-eh / ew))));
double tmp;
if ((t <= -0.058) || !(t <= 1.5e+64)) {
tmp = Math.abs(((eh * Math.sin(t)) * t_1));
} else {
tmp = Math.abs((ew - ((t * eh) * t_1)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(math.atan((t * (-eh / ew)))) tmp = 0 if (t <= -0.058) or not (t <= 1.5e+64): tmp = math.fabs(((eh * math.sin(t)) * t_1)) else: tmp = math.fabs((ew - ((t * eh) * t_1))) return tmp
function code(eh, ew, t) t_1 = sin(atan(Float64(t * Float64(Float64(-eh) / ew)))) tmp = 0.0 if ((t <= -0.058) || !(t <= 1.5e+64)) tmp = abs(Float64(Float64(eh * sin(t)) * t_1)); else tmp = abs(Float64(ew - Float64(Float64(t * eh) * t_1))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(atan((t * (-eh / ew)))); tmp = 0.0; if ((t <= -0.058) || ~((t <= 1.5e+64))) tmp = abs(((eh * sin(t)) * t_1)); else tmp = abs((ew - ((t * eh) * t_1))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(t * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t, -0.058], N[Not[LessEqual[t, 1.5e+64]], $MachinePrecision]], N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(N[(t * eh), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(t \cdot \frac{-eh}{ew}\right)\\
\mathbf{if}\;t \leq -0.058 \lor \neg \left(t \leq 1.5 \cdot 10^{+64}\right):\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - \left(t \cdot eh\right) \cdot t\_1\right|\\
\end{array}
\end{array}
if t < -0.0580000000000000029 or 1.5000000000000001e64 < t Initial program 99.6%
sub-neg99.6%
distribute-rgt-neg-in99.6%
cancel-sign-sub99.6%
associate-*l*99.7%
associate-/l*99.7%
distribute-lft-neg-in99.7%
Simplified99.7%
add-cbrt-cube66.5%
pow366.5%
Applied egg-rr67.3%
Taylor expanded in t around 0 57.3%
Taylor expanded in t around 0 57.3%
associate-*r/57.3%
mul-1-neg57.3%
Simplified57.3%
Taylor expanded in ew around 0 49.5%
mul-1-neg49.5%
associate-*r*49.5%
distribute-rgt-neg-in49.5%
mul-1-neg49.5%
associate-*l/49.5%
*-commutative49.5%
distribute-rgt-neg-in49.5%
distribute-neg-frac49.5%
Simplified49.5%
if -0.0580000000000000029 < t < 1.5000000000000001e64Initial program 100.0%
sub-neg100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub100.0%
associate-*l*100.0%
associate-/l*100.0%
distribute-lft-neg-in100.0%
Simplified100.0%
add-cbrt-cube52.9%
pow352.9%
Applied egg-rr52.9%
Taylor expanded in t around 0 92.7%
Taylor expanded in t around 0 92.7%
associate-*r/92.7%
mul-1-neg92.7%
Simplified92.7%
Taylor expanded in t around 0 91.7%
associate-*r*91.7%
*-commutative91.7%
mul-1-neg91.7%
associate-*l/91.7%
distribute-rgt-neg-in91.7%
Simplified91.7%
Final simplification72.1%
(FPCore (eh ew t) :precision binary64 (fabs (- ew (* (* eh (sin t)) (sin (atan (/ (* t (- eh)) ew)))))))
double code(double eh, double ew, double t) {
return fabs((ew - ((eh * sin(t)) * sin(atan(((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 - ((eh * sin(t)) * sin(atan(((t * -eh) / 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(((t * -eh) / ew))))));
}
def code(eh, ew, t): return math.fabs((ew - ((eh * math.sin(t)) * math.sin(math.atan(((t * -eh) / ew))))))
function code(eh, ew, t) return abs(Float64(ew - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(t * Float64(-eh)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((ew - ((eh * sin(t)) * sin(atan(((t * -eh) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(t * (-eh)), $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{t \cdot \left(-eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
add-cbrt-cube59.3%
pow359.3%
Applied egg-rr59.6%
Taylor expanded in t around 0 76.3%
Taylor expanded in t around 0 76.3%
associate-*r/76.3%
mul-1-neg76.3%
Simplified76.3%
Final simplification76.3%
(FPCore (eh ew t) :precision binary64 (fabs (- ew (* (* eh (sin t)) (sin (atan (* t (/ eh ew))))))))
double code(double eh, double ew, double t) {
return fabs((ew - ((eh * sin(t)) * sin(atan((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 - ((eh * sin(t)) * sin(atan((t * (eh / 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((t * (eh / ew)))))));
}
def code(eh, ew, t): return math.fabs((ew - ((eh * math.sin(t)) * math.sin(math.atan((t * (eh / ew)))))))
function code(eh, ew, t) return abs(Float64(ew - Float64(Float64(eh * sin(t)) * sin(atan(Float64(t * Float64(eh / ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((ew - ((eh * sin(t)) * sin(atan((t * (eh / ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(t * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(t \cdot \frac{eh}{ew}\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
add-cbrt-cube59.3%
pow359.3%
Applied egg-rr59.6%
Taylor expanded in t around 0 76.3%
Taylor expanded in t around 0 76.3%
associate-*r/76.3%
mul-1-neg76.3%
Simplified76.3%
add-sqr-sqrt47.9%
sqrt-unprod74.8%
sqr-neg74.8%
sqrt-unprod39.7%
add-sqr-sqrt76.3%
associate-/l*76.3%
associate-/r/76.3%
Applied egg-rr76.3%
Final simplification76.3%
(FPCore (eh ew t) :precision binary64 (fabs (- ew (* (* t eh) (sin (atan (* t (/ (- eh) ew))))))))
double code(double eh, double ew, double t) {
return fabs((ew - ((t * eh) * sin(atan((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 - ((t * eh) * sin(atan((t * (-eh / ew)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew - ((t * eh) * Math.sin(Math.atan((t * (-eh / ew)))))));
}
def code(eh, ew, t): return math.fabs((ew - ((t * eh) * math.sin(math.atan((t * (-eh / ew)))))))
function code(eh, ew, t) return abs(Float64(ew - Float64(Float64(t * eh) * sin(atan(Float64(t * Float64(Float64(-eh) / ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((ew - ((t * eh) * sin(atan((t * (-eh / ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(ew - N[(N[(t * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(t * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew - \left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(t \cdot \frac{-eh}{ew}\right)\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-*l*99.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
Simplified99.8%
add-cbrt-cube59.3%
pow359.3%
Applied egg-rr59.6%
Taylor expanded in t around 0 76.3%
Taylor expanded in t around 0 76.3%
associate-*r/76.3%
mul-1-neg76.3%
Simplified76.3%
Taylor expanded in t around 0 54.2%
associate-*r*54.2%
*-commutative54.2%
mul-1-neg54.2%
associate-*l/54.2%
distribute-rgt-neg-in54.2%
Simplified54.2%
Final simplification54.2%
herbie shell --seed 2024031
(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)))))))