
(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 (* (tan t) (/ eh ew))))
(fabs
(+
(/ (* ew (cos t)) (hypot 1.0 t_1))
(* (* eh (sin t)) (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) * (eh / ew);
return fabs((((ew * cos(t)) / hypot(1.0, t_1)) + ((eh * sin(t)) * sin(atan(t_1)))));
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) * (eh / ew);
return Math.abs((((ew * Math.cos(t)) / Math.hypot(1.0, t_1)) + ((eh * Math.sin(t)) * Math.sin(Math.atan(t_1)))));
}
def code(eh, ew, t): t_1 = math.tan(t) * (eh / ew) return math.fabs((((ew * math.cos(t)) / math.hypot(1.0, t_1)) + ((eh * math.sin(t)) * math.sin(math.atan(t_1)))))
function code(eh, ew, t) t_1 = Float64(tan(t) * Float64(eh / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, t_1)) + Float64(Float64(eh * sin(t)) * sin(atan(t_1))))) end
function tmp = code(eh, ew, t) t_1 = tan(t) * (eh / ew); tmp = abs((((ew * cos(t)) / hypot(1.0, t_1)) + ((eh * sin(t)) * sin(atan(t_1))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan t \cdot \frac{eh}{ew}\\
\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, t\_1\right)} + \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
sub-neg99.8%
Applied egg-rr99.8%
Taylor expanded in t around inf 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (tan t) (/ eh ew))))
(fabs
(+
(/ (* ew (cos t)) (hypot 1.0 t_1))
(* (sin t) (* eh (sin (atan t_1))))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) * (eh / ew);
return fabs((((ew * cos(t)) / hypot(1.0, t_1)) + (sin(t) * (eh * sin(atan(t_1))))));
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) * (eh / ew);
return Math.abs((((ew * Math.cos(t)) / Math.hypot(1.0, t_1)) + (Math.sin(t) * (eh * Math.sin(Math.atan(t_1))))));
}
def code(eh, ew, t): t_1 = math.tan(t) * (eh / ew) return math.fabs((((ew * math.cos(t)) / math.hypot(1.0, t_1)) + (math.sin(t) * (eh * math.sin(math.atan(t_1))))))
function code(eh, ew, t) t_1 = Float64(tan(t) * Float64(eh / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, t_1)) + Float64(sin(t) * Float64(eh * sin(atan(t_1)))))) end
function tmp = code(eh, ew, t) t_1 = tan(t) * (eh / ew); tmp = abs((((ew * cos(t)) / hypot(1.0, t_1)) + (sin(t) * (eh * sin(atan(t_1)))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan t \cdot \frac{eh}{ew}\\
\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, t\_1\right)} + \sin t \cdot \left(eh \cdot \sin \tan^{-1} t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
sub-neg99.8%
Applied egg-rr99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ (* ew (cos t)) (hypot 1.0 (* (tan t) (/ eh ew)))) (* (* eh (sin t)) (sin (atan (/ (* t eh) (- ew))))))))
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(((t * eh) / -ew))))));
}
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(((t * eh) / -ew))))));
}
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(((t * eh) / -ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(tan(t) * Float64(eh / ew)))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(t * eh) / Float64(-ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew)))) - ((eh * sin(t)) * sin(atan(((t * eh) / -ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] - 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|\frac{ew \cdot \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{t \cdot eh}{-ew}\right)\right|
\end{array}
Initial program 99.8%
associate-*r/99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
associate-*r/99.8%
*-commutative99.8%
associate-/l*99.8%
add-sqr-sqrt46.4%
sqrt-unprod94.0%
sqr-neg94.0%
sqrt-unprod53.4%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 98.4%
mul-1-neg98.4%
distribute-rgt-neg-in98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* eh (- (tan t))) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -Math.tan(t)) / ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -math.tan(t)) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-tan(t))) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-N[Tan[t], $MachinePrecision])), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
add-cbrt-cube54.3%
pow354.3%
Applied egg-rr54.3%
Taylor expanded in ew around inf 96.8%
Final simplification96.8%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -1.12e-79) (not (<= eh 1.25e-30)))
(fabs
(*
eh
(- (* ew (/ 1.0 eh)) (* (sin t) (sin (atan (* (tan t) (/ eh (- ew)))))))))
(fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.12e-79) || !(eh <= 1.25e-30)) {
tmp = fabs((eh * ((ew * (1.0 / eh)) - (sin(t) * sin(atan((tan(t) * (eh / -ew))))))));
} else {
tmp = fabs((ew * cos(t)));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((eh <= (-1.12d-79)) .or. (.not. (eh <= 1.25d-30))) then
tmp = abs((eh * ((ew * (1.0d0 / eh)) - (sin(t) * sin(atan((tan(t) * (eh / -ew))))))))
else
tmp = abs((ew * cos(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.12e-79) || !(eh <= 1.25e-30)) {
tmp = Math.abs((eh * ((ew * (1.0 / eh)) - (Math.sin(t) * Math.sin(Math.atan((Math.tan(t) * (eh / -ew))))))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.12e-79) or not (eh <= 1.25e-30): tmp = math.fabs((eh * ((ew * (1.0 / eh)) - (math.sin(t) * math.sin(math.atan((math.tan(t) * (eh / -ew)))))))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.12e-79) || !(eh <= 1.25e-30)) tmp = abs(Float64(eh * Float64(Float64(ew * Float64(1.0 / eh)) - Float64(sin(t) * sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))))))); else tmp = abs(Float64(ew * cos(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.12e-79) || ~((eh <= 1.25e-30))) tmp = abs((eh * ((ew * (1.0 / eh)) - (sin(t) * sin(atan((tan(t) * (eh / -ew)))))))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.12e-79], N[Not[LessEqual[eh, 1.25e-30]], $MachinePrecision]], N[Abs[N[(eh * N[(N[(ew * N[(1.0 / eh), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.12 \cdot 10^{-79} \lor \neg \left(eh \leq 1.25 \cdot 10^{-30}\right):\\
\;\;\;\;\left|eh \cdot \left(ew \cdot \frac{1}{eh} - \sin t \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -1.11999999999999996e-79 or 1.24999999999999993e-30 < eh Initial program 99.7%
add-cbrt-cube65.8%
pow365.8%
Applied egg-rr65.8%
Taylor expanded in ew around inf 63.4%
cube-prod63.4%
Simplified63.4%
Taylor expanded in eh around inf 96.9%
associate-/l*96.9%
mul-1-neg96.9%
distribute-frac-neg96.9%
*-commutative96.9%
distribute-rgt-neg-out96.9%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in t around 0 84.7%
if -1.11999999999999996e-79 < eh < 1.24999999999999993e-30Initial program 99.9%
add-cbrt-cube38.1%
pow338.2%
Applied egg-rr38.2%
Taylor expanded in ew around inf 38.1%
cube-prod38.2%
Simplified38.2%
Taylor expanded in eh around inf 69.9%
associate-/l*69.8%
mul-1-neg69.8%
distribute-frac-neg69.8%
*-commutative69.8%
distribute-rgt-neg-out69.8%
associate-/l*69.8%
Simplified69.8%
Taylor expanded in eh around 0 90.6%
Final simplification87.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (* eh (sin t)) (sin (atan (* eh (/ (- t) ew))))))))
(if (<= t -9e+213)
t_1
(if (<= t -0.01)
(fabs (* ew (cos t)))
(if (<= t 0.0136)
(fabs
(+
ew
(*
t
(-
(* t (* ew -0.5))
(* eh (sin (atan (* (tan t) (/ eh (- ew))))))))))
t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((eh * sin(t)) * sin(atan((eh * (-t / ew))))));
double tmp;
if (t <= -9e+213) {
tmp = t_1;
} else if (t <= -0.01) {
tmp = fabs((ew * cos(t)));
} else if (t <= 0.0136) {
tmp = fabs((ew + (t * ((t * (ew * -0.5)) - (eh * sin(atan((tan(t) * (eh / -ew)))))))));
} else {
tmp = 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 = abs(((eh * sin(t)) * sin(atan((eh * (-t / ew))))))
if (t <= (-9d+213)) then
tmp = t_1
else if (t <= (-0.01d0)) then
tmp = abs((ew * cos(t)))
else if (t <= 0.0136d0) then
tmp = abs((ew + (t * ((t * (ew * (-0.5d0))) - (eh * sin(atan((tan(t) * (eh / -ew)))))))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs(((eh * Math.sin(t)) * Math.sin(Math.atan((eh * (-t / ew))))));
double tmp;
if (t <= -9e+213) {
tmp = t_1;
} else if (t <= -0.01) {
tmp = Math.abs((ew * Math.cos(t)));
} else if (t <= 0.0136) {
tmp = Math.abs((ew + (t * ((t * (ew * -0.5)) - (eh * Math.sin(Math.atan((Math.tan(t) * (eh / -ew)))))))));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((eh * math.sin(t)) * math.sin(math.atan((eh * (-t / ew)))))) tmp = 0 if t <= -9e+213: tmp = t_1 elif t <= -0.01: tmp = math.fabs((ew * math.cos(t))) elif t <= 0.0136: tmp = math.fabs((ew + (t * ((t * (ew * -0.5)) - (eh * math.sin(math.atan((math.tan(t) * (eh / -ew))))))))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(eh * sin(t)) * sin(atan(Float64(eh * Float64(Float64(-t) / ew)))))) tmp = 0.0 if (t <= -9e+213) tmp = t_1; elseif (t <= -0.01) tmp = abs(Float64(ew * cos(t))); elseif (t <= 0.0136) tmp = abs(Float64(ew + Float64(t * Float64(Float64(t * Float64(ew * -0.5)) - Float64(eh * sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew)))))))))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((eh * sin(t)) * sin(atan((eh * (-t / ew)))))); tmp = 0.0; if (t <= -9e+213) tmp = t_1; elseif (t <= -0.01) tmp = abs((ew * cos(t))); elseif (t <= 0.0136) tmp = abs((ew + (t * ((t * (ew * -0.5)) - (eh * sin(atan((tan(t) * (eh / -ew))))))))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[((-t) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -9e+213], t$95$1, If[LessEqual[t, -0.01], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 0.0136], N[Abs[N[(ew + N[(t * N[(N[(t * N[(ew * -0.5), $MachinePrecision]), $MachinePrecision] - N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{-t}{ew}\right)\right|\\
\mathbf{if}\;t \leq -9 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -0.01:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{elif}\;t \leq 0.0136:\\
\;\;\;\;\left|ew + t \cdot \left(t \cdot \left(ew \cdot -0.5\right) - eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.0000000000000003e213 or 0.0135999999999999992 < t Initial program 99.7%
Taylor expanded in t around 0 65.2%
Taylor expanded in ew around 0 58.8%
mul-1-neg58.8%
associate-*r*58.8%
distribute-lft-neg-in58.8%
mul-1-neg58.8%
associate-/l*58.8%
distribute-lft-neg-out58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in t around 0 59.2%
mul-1-neg59.2%
associate-/l*59.2%
distribute-rgt-neg-in59.2%
mul-1-neg59.2%
associate-*r/59.2%
mul-1-neg59.2%
Simplified59.2%
if -9.0000000000000003e213 < t < -0.0100000000000000002Initial program 99.7%
add-cbrt-cube53.8%
pow353.8%
Applied egg-rr53.8%
Taylor expanded in ew around inf 53.6%
cube-prod53.7%
Simplified53.7%
Taylor expanded in eh around inf 89.1%
associate-/l*89.1%
mul-1-neg89.1%
distribute-frac-neg89.1%
*-commutative89.1%
distribute-rgt-neg-out89.1%
associate-/l*89.1%
Simplified89.1%
Taylor expanded in eh around 0 68.4%
if -0.0100000000000000002 < t < 0.0135999999999999992Initial program 100.0%
add-cbrt-cube47.1%
pow347.1%
Applied egg-rr47.1%
Taylor expanded in ew around inf 45.8%
cube-prod45.8%
Simplified45.8%
Taylor expanded in t around 0 95.6%
associate-*r*95.6%
*-commutative95.6%
mul-1-neg95.6%
*-commutative95.6%
associate-*r/95.6%
Simplified95.6%
Final simplification78.2%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -3.4e+114)
(and (not (<= eh -4.2e+44))
(or (<= eh -15500000000.0) (not (<= eh 7.5e+136)))))
(fabs (* (* eh (sin t)) (sin (atan (* eh (/ (- t) ew))))))
(fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -3.4e+114) || (!(eh <= -4.2e+44) && ((eh <= -15500000000.0) || !(eh <= 7.5e+136)))) {
tmp = fabs(((eh * sin(t)) * sin(atan((eh * (-t / ew))))));
} else {
tmp = fabs((ew * cos(t)));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((eh <= (-3.4d+114)) .or. (.not. (eh <= (-4.2d+44))) .and. (eh <= (-15500000000.0d0)) .or. (.not. (eh <= 7.5d+136))) then
tmp = abs(((eh * sin(t)) * sin(atan((eh * (-t / ew))))))
else
tmp = abs((ew * cos(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -3.4e+114) || (!(eh <= -4.2e+44) && ((eh <= -15500000000.0) || !(eh <= 7.5e+136)))) {
tmp = Math.abs(((eh * Math.sin(t)) * Math.sin(Math.atan((eh * (-t / ew))))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -3.4e+114) or (not (eh <= -4.2e+44) and ((eh <= -15500000000.0) or not (eh <= 7.5e+136))): tmp = math.fabs(((eh * math.sin(t)) * math.sin(math.atan((eh * (-t / ew)))))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -3.4e+114) || (!(eh <= -4.2e+44) && ((eh <= -15500000000.0) || !(eh <= 7.5e+136)))) tmp = abs(Float64(Float64(eh * sin(t)) * sin(atan(Float64(eh * Float64(Float64(-t) / ew)))))); else tmp = abs(Float64(ew * cos(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -3.4e+114) || (~((eh <= -4.2e+44)) && ((eh <= -15500000000.0) || ~((eh <= 7.5e+136))))) tmp = abs(((eh * sin(t)) * sin(atan((eh * (-t / ew)))))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -3.4e+114], And[N[Not[LessEqual[eh, -4.2e+44]], $MachinePrecision], Or[LessEqual[eh, -15500000000.0], N[Not[LessEqual[eh, 7.5e+136]], $MachinePrecision]]]], N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[((-t) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -3.4 \cdot 10^{+114} \lor \neg \left(eh \leq -4.2 \cdot 10^{+44}\right) \land \left(eh \leq -15500000000 \lor \neg \left(eh \leq 7.5 \cdot 10^{+136}\right)\right):\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{-t}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -3.4000000000000001e114 or -4.19999999999999974e44 < eh < -1.55e10 or 7.5000000000000002e136 < eh Initial program 99.7%
Taylor expanded in t around 0 92.6%
Taylor expanded in ew around 0 74.3%
mul-1-neg74.3%
associate-*r*74.4%
distribute-lft-neg-in74.4%
mul-1-neg74.4%
associate-/l*74.2%
distribute-lft-neg-out74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in t around 0 74.5%
mul-1-neg74.5%
associate-/l*74.4%
distribute-rgt-neg-in74.4%
mul-1-neg74.4%
associate-*r/74.4%
mul-1-neg74.4%
Simplified74.4%
if -3.4000000000000001e114 < eh < -4.19999999999999974e44 or -1.55e10 < eh < 7.5000000000000002e136Initial program 99.8%
add-cbrt-cube45.6%
pow345.6%
Applied egg-rr45.6%
Taylor expanded in ew around inf 45.2%
cube-prod45.3%
Simplified45.3%
Taylor expanded in eh around inf 81.1%
associate-/l*81.0%
mul-1-neg81.0%
distribute-frac-neg81.0%
*-commutative81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in eh around 0 79.9%
Final simplification78.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (* eh (sin t)) (sin (atan (* eh (/ (- t) ew))))))))
(if (<= t -6.8e+213)
t_1
(if (<= t -0.00185)
(fabs (* ew (cos t)))
(if (<= t 250000000000.0)
(fabs (- ew (* eh (* t (sin (atan (* eh (/ (tan t) (- ew)))))))))
t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((eh * sin(t)) * sin(atan((eh * (-t / ew))))));
double tmp;
if (t <= -6.8e+213) {
tmp = t_1;
} else if (t <= -0.00185) {
tmp = fabs((ew * cos(t)));
} else if (t <= 250000000000.0) {
tmp = fabs((ew - (eh * (t * sin(atan((eh * (tan(t) / -ew))))))));
} else {
tmp = 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 = abs(((eh * sin(t)) * sin(atan((eh * (-t / ew))))))
if (t <= (-6.8d+213)) then
tmp = t_1
else if (t <= (-0.00185d0)) then
tmp = abs((ew * cos(t)))
else if (t <= 250000000000.0d0) then
tmp = abs((ew - (eh * (t * sin(atan((eh * (tan(t) / -ew))))))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs(((eh * Math.sin(t)) * Math.sin(Math.atan((eh * (-t / ew))))));
double tmp;
if (t <= -6.8e+213) {
tmp = t_1;
} else if (t <= -0.00185) {
tmp = Math.abs((ew * Math.cos(t)));
} else if (t <= 250000000000.0) {
tmp = Math.abs((ew - (eh * (t * Math.sin(Math.atan((eh * (Math.tan(t) / -ew))))))));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((eh * math.sin(t)) * math.sin(math.atan((eh * (-t / ew)))))) tmp = 0 if t <= -6.8e+213: tmp = t_1 elif t <= -0.00185: tmp = math.fabs((ew * math.cos(t))) elif t <= 250000000000.0: tmp = math.fabs((ew - (eh * (t * math.sin(math.atan((eh * (math.tan(t) / -ew)))))))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(eh * sin(t)) * sin(atan(Float64(eh * Float64(Float64(-t) / ew)))))) tmp = 0.0 if (t <= -6.8e+213) tmp = t_1; elseif (t <= -0.00185) tmp = abs(Float64(ew * cos(t))); elseif (t <= 250000000000.0) tmp = abs(Float64(ew - Float64(eh * Float64(t * sin(atan(Float64(eh * Float64(tan(t) / Float64(-ew))))))))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((eh * sin(t)) * sin(atan((eh * (-t / ew)))))); tmp = 0.0; if (t <= -6.8e+213) tmp = t_1; elseif (t <= -0.00185) tmp = abs((ew * cos(t))); elseif (t <= 250000000000.0) tmp = abs((ew - (eh * (t * sin(atan((eh * (tan(t) / -ew)))))))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[((-t) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -6.8e+213], t$95$1, If[LessEqual[t, -0.00185], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 250000000000.0], N[Abs[N[(ew - N[(eh * N[(t * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{-t}{ew}\right)\right|\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -0.00185:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{elif}\;t \leq 250000000000:\\
\;\;\;\;\left|ew - eh \cdot \left(t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.79999999999999983e213 or 2.5e11 < t Initial program 99.6%
Taylor expanded in t around 0 65.8%
Taylor expanded in ew around 0 59.4%
mul-1-neg59.4%
associate-*r*59.4%
distribute-lft-neg-in59.4%
mul-1-neg59.4%
associate-/l*59.4%
distribute-lft-neg-out59.4%
*-commutative59.4%
Simplified59.4%
Taylor expanded in t around 0 59.8%
mul-1-neg59.8%
associate-/l*59.8%
distribute-rgt-neg-in59.8%
mul-1-neg59.8%
associate-*r/59.8%
mul-1-neg59.8%
Simplified59.8%
if -6.79999999999999983e213 < t < -0.0018500000000000001Initial program 99.7%
add-cbrt-cube53.8%
pow353.8%
Applied egg-rr53.8%
Taylor expanded in ew around inf 53.6%
cube-prod53.7%
Simplified53.7%
Taylor expanded in eh around inf 89.1%
associate-/l*89.1%
mul-1-neg89.1%
distribute-frac-neg89.1%
*-commutative89.1%
distribute-rgt-neg-out89.1%
associate-/l*89.1%
Simplified89.1%
Taylor expanded in eh around 0 68.4%
if -0.0018500000000000001 < t < 2.5e11Initial program 100.0%
add-cbrt-cube46.7%
pow346.7%
Applied egg-rr46.7%
Taylor expanded in t around 0 94.6%
mul-1-neg94.6%
unsub-neg94.6%
mul-1-neg94.6%
distribute-frac-neg294.6%
associate-/l*94.6%
Simplified94.6%
Final simplification78.1%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (cos t))))
double code(double eh, double ew, double t) {
return fabs((ew * cos(t)));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((ew * cos(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.cos(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.cos(t)))
function code(eh, ew, t) return abs(Float64(ew * cos(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * cos(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t\right|
\end{array}
Initial program 99.8%
add-cbrt-cube54.3%
pow354.3%
Applied egg-rr54.3%
Taylor expanded in ew around inf 52.9%
cube-prod53.0%
Simplified53.0%
Taylor expanded in eh around inf 85.7%
associate-/l*85.7%
mul-1-neg85.7%
distribute-frac-neg85.7%
*-commutative85.7%
distribute-rgt-neg-out85.7%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in eh around 0 63.4%
(FPCore (eh ew t) :precision binary64 (fabs ew))
double code(double eh, double ew, double t) {
return fabs(ew);
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(ew)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(ew);
}
def code(eh, ew, t): return math.fabs(ew)
function code(eh, ew, t) return abs(ew) end
function tmp = code(eh, ew, t) tmp = abs(ew); end
code[eh_, ew_, t_] := N[Abs[ew], $MachinePrecision]
\begin{array}{l}
\\
\left|ew\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 41.4%
mul-1-neg41.4%
distribute-frac-neg241.4%
associate-/l*41.4%
Simplified41.4%
Taylor expanded in t around 0 40.1%
mul-1-neg39.3%
associate-/l*39.3%
distribute-rgt-neg-in39.3%
mul-1-neg39.3%
associate-*r/39.3%
mul-1-neg39.3%
Simplified40.1%
cos-atan39.1%
hypot-1-def39.2%
Applied egg-rr39.2%
hypot-undefine39.1%
metadata-eval39.1%
associate-*r/39.0%
distribute-rgt-neg-out39.0%
distribute-frac-neg39.0%
associate-*r/39.0%
distribute-rgt-neg-out39.0%
distribute-frac-neg39.0%
sqr-neg39.0%
hypot-1-def39.1%
associate-/l*39.2%
Simplified39.2%
Taylor expanded in ew around inf 41.6%
herbie shell --seed 2024110
(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)))))))