
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (* eh (/ (tan t) (- ew)))))) (fabs (fma ew (* (cos t_1) (- (cos t))) (* eh (* (sin t) (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh * (tan(t) / -ew)));
return fabs(fma(ew, (cos(t_1) * -cos(t)), (eh * (sin(t) * sin(t_1)))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh * Float64(tan(t) / Float64(-ew)))) return abs(fma(ew, Float64(cos(t_1) * Float64(-cos(t))), Float64(eh * Float64(sin(t) * sin(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(ew * N[(N[Cos[t$95$1], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] + N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\\
\left|\mathsf{fma}\left(ew, \cos t\_1 \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin t\_1\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
Final simplification99.8%
(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(eh * Float64(-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{eh \cdot \left(-\tan t\right)}{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}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.8e+88) (not (<= eh 4.5e+121))) (fabs (* (* 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.8e+88) || !(eh <= 4.5e+121)) {
tmp = fabs(((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.8d+88)) .or. (.not. (eh <= 4.5d+121))) then
tmp = abs(((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.8e+88) || !(eh <= 4.5e+121)) {
tmp = Math.abs(((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.8e+88) or not (eh <= 4.5e+121): tmp = math.fabs(((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.8e+88) || !(eh <= 4.5e+121)) tmp = abs(Float64(Float64(eh * 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.8e+88) || ~((eh <= 4.5e+121))) tmp = abs(((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.8e+88], N[Not[LessEqual[eh, 4.5e+121]], $MachinePrecision]], N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-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 -1.8 \cdot 10^{+88} \lor \neg \left(eh \leq 4.5 \cdot 10^{+121}\right):\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -1.8000000000000001e88 or 4.5000000000000003e121 < eh Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
associate-*r/99.8%
add-cube-cbrt99.8%
pow399.8%
*-commutative99.8%
associate-/l*99.8%
add-sqr-sqrt52.2%
sqrt-unprod82.3%
sqr-neg82.3%
sqrt-unprod47.6%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in ew around 0 77.9%
associate-*r*78.0%
mul-1-neg78.0%
*-commutative78.0%
distribute-frac-neg278.0%
associate-/l*78.0%
Simplified78.0%
if -1.8000000000000001e88 < eh < 4.5000000000000003e121Initial program 99.8%
Applied egg-rr51.9%
Taylor expanded in eh around 0 43.5%
add-sqr-sqrt42.2%
sqrt-unprod44.8%
pow244.8%
Applied egg-rr44.8%
unpow244.8%
rem-sqrt-square81.4%
Simplified81.4%
Final simplification80.3%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.1e+88) (not (<= eh 5e+121))) (fabs (* eh (* (sin t) (sin (atan (* eh (/ (tan t) (- ew)))))))) (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.1e+88) || !(eh <= 5e+121)) {
tmp = fabs((eh * (sin(t) * sin(atan((eh * (tan(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 <= (-1.1d+88)) .or. (.not. (eh <= 5d+121))) then
tmp = abs((eh * (sin(t) * sin(atan((eh * (tan(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 <= -1.1e+88) || !(eh <= 5e+121)) {
tmp = Math.abs((eh * (Math.sin(t) * Math.sin(Math.atan((eh * (Math.tan(t) / -ew)))))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.1e+88) or not (eh <= 5e+121): tmp = math.fabs((eh * (math.sin(t) * math.sin(math.atan((eh * (math.tan(t) / -ew))))))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.1e+88) || !(eh <= 5e+121)) tmp = abs(Float64(eh * Float64(sin(t) * sin(atan(Float64(eh * Float64(tan(t) / 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.1e+88) || ~((eh <= 5e+121))) tmp = abs((eh * (sin(t) * sin(atan((eh * (tan(t) / -ew))))))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.1e+88], N[Not[LessEqual[eh, 5e+121]], $MachinePrecision]], N[Abs[N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $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.1 \cdot 10^{+88} \lor \neg \left(eh \leq 5 \cdot 10^{+121}\right):\\
\;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -1.10000000000000004e88 or 5.00000000000000007e121 < eh Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in ew around 0 77.9%
mul-1-neg77.9%
distribute-frac-neg277.9%
associate-/l*77.9%
Simplified77.9%
if -1.10000000000000004e88 < eh < 5.00000000000000007e121Initial program 99.8%
Applied egg-rr51.9%
Taylor expanded in eh around 0 43.5%
add-sqr-sqrt42.2%
sqrt-unprod44.8%
pow244.8%
Applied egg-rr44.8%
unpow244.8%
rem-sqrt-square81.4%
Simplified81.4%
Final simplification80.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -130000.0) (not (<= t 11000000000.0))) (fabs (* ew (cos t))) (fabs (+ ew (* t (* eh (sin (atan (* (tan t) (/ eh (- ew)))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -130000.0) || !(t <= 11000000000.0)) {
tmp = fabs((ew * cos(t)));
} else {
tmp = fabs((ew + (t * (eh * sin(atan((tan(t) * (eh / -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) :: tmp
if ((t <= (-130000.0d0)) .or. (.not. (t <= 11000000000.0d0))) then
tmp = abs((ew * cos(t)))
else
tmp = abs((ew + (t * (eh * sin(atan((tan(t) * (eh / -ew))))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -130000.0) || !(t <= 11000000000.0)) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = Math.abs((ew + (t * (eh * Math.sin(Math.atan((Math.tan(t) * (eh / -ew))))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -130000.0) or not (t <= 11000000000.0): tmp = math.fabs((ew * math.cos(t))) else: tmp = math.fabs((ew + (t * (eh * math.sin(math.atan((math.tan(t) * (eh / -ew)))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -130000.0) || !(t <= 11000000000.0)) tmp = abs(Float64(ew * cos(t))); else tmp = abs(Float64(ew + Float64(t * Float64(eh * sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -130000.0) || ~((t <= 11000000000.0))) tmp = abs((ew * cos(t))); else tmp = abs((ew + (t * (eh * sin(atan((tan(t) * (eh / -ew)))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -130000.0], N[Not[LessEqual[t, 11000000000.0]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew + N[(t * 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}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -130000 \lor \neg \left(t \leq 11000000000\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew + t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)\right)\right|\\
\end{array}
\end{array}
if t < -1.3e5 or 1.1e10 < t Initial program 99.7%
Applied egg-rr51.9%
Taylor expanded in eh around 0 31.9%
add-sqr-sqrt31.1%
sqrt-unprod28.4%
pow228.4%
Applied egg-rr28.4%
unpow228.4%
rem-sqrt-square55.4%
Simplified55.4%
if -1.3e5 < t < 1.1e10Initial program 100.0%
fabs-sub100.0%
sub-neg100.0%
+-commutative100.0%
associate-*l*100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
Simplified100.0%
add-cbrt-cube100.0%
pow3100.0%
Applied egg-rr98.7%
Taylor expanded in t around 0 95.9%
associate-*r*95.9%
*-commutative95.9%
mul-1-neg95.9%
*-commutative95.9%
distribute-frac-neg295.9%
associate-*r*95.9%
distribute-frac-neg295.9%
*-commutative95.9%
mul-1-neg95.9%
Simplified95.9%
Final simplification75.9%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -2.7e+188) (not (<= eh 7.5e+196))) (fabs (* t (* eh (sin (atan (* (tan t) (/ eh (- ew)))))))) (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -2.7e+188) || !(eh <= 7.5e+196)) {
tmp = fabs((t * (eh * 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 <= (-2.7d+188)) .or. (.not. (eh <= 7.5d+196))) then
tmp = abs((t * (eh * 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 <= -2.7e+188) || !(eh <= 7.5e+196)) {
tmp = Math.abs((t * (eh * 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 <= -2.7e+188) or not (eh <= 7.5e+196): tmp = math.fabs((t * (eh * 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 <= -2.7e+188) || !(eh <= 7.5e+196)) tmp = abs(Float64(t * Float64(eh * 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 <= -2.7e+188) || ~((eh <= 7.5e+196))) tmp = abs((t * (eh * 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, -2.7e+188], N[Not[LessEqual[eh, 7.5e+196]], $MachinePrecision]], N[Abs[N[(t * N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $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 -2.7 \cdot 10^{+188} \lor \neg \left(eh \leq 7.5 \cdot 10^{+196}\right):\\
\;\;\;\;\left|t \cdot \left(eh \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 < -2.7e188 or 7.5000000000000005e196 < eh Initial program 99.7%
fabs-sub99.7%
sub-neg99.7%
+-commutative99.7%
associate-*l*99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in t around 0 54.2%
+-commutative54.2%
mul-1-neg54.2%
unsub-neg54.2%
associate-*r*54.2%
*-commutative54.2%
associate-*r*54.2%
fma-neg54.2%
Simplified54.2%
Taylor expanded in t around inf 43.6%
associate-*r*43.6%
*-commutative43.6%
mul-1-neg43.6%
*-commutative43.6%
distribute-frac-neg243.6%
associate-*r*43.6%
distribute-frac-neg243.6%
*-commutative43.6%
mul-1-neg43.6%
mul-1-neg43.6%
Simplified43.6%
if -2.7e188 < eh < 7.5000000000000005e196Initial program 99.8%
Applied egg-rr52.0%
Taylor expanded in eh around 0 40.0%
add-sqr-sqrt38.8%
sqrt-unprod39.7%
pow239.7%
Applied egg-rr39.7%
unpow239.7%
rem-sqrt-square74.1%
Simplified74.1%
Final simplification67.7%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -4e-272) (not (<= ew 1.45e-149))) (fabs (* ew (cos t))) (* (* eh (sin t)) (sin (atan (* (tan t) (/ eh ew)))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -4e-272) || !(ew <= 1.45e-149)) {
tmp = fabs((ew * cos(t)));
} else {
tmp = (eh * sin(t)) * sin(atan((tan(t) * (eh / 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) :: tmp
if ((ew <= (-4d-272)) .or. (.not. (ew <= 1.45d-149))) then
tmp = abs((ew * cos(t)))
else
tmp = (eh * sin(t)) * sin(atan((tan(t) * (eh / ew))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -4e-272) || !(ew <= 1.45e-149)) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = (eh * Math.sin(t)) * Math.sin(Math.atan((Math.tan(t) * (eh / ew))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -4e-272) or not (ew <= 1.45e-149): tmp = math.fabs((ew * math.cos(t))) else: tmp = (eh * math.sin(t)) * math.sin(math.atan((math.tan(t) * (eh / ew)))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -4e-272) || !(ew <= 1.45e-149)) tmp = abs(Float64(ew * cos(t))); else tmp = Float64(Float64(eh * sin(t)) * sin(atan(Float64(tan(t) * Float64(eh / ew))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -4e-272) || ~((ew <= 1.45e-149))) tmp = abs((ew * cos(t))); else tmp = (eh * sin(t)) * sin(atan((tan(t) * (eh / ew)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -4e-272], N[Not[LessEqual[ew, 1.45e-149]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4 \cdot 10^{-272} \lor \neg \left(ew \leq 1.45 \cdot 10^{-149}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\\
\end{array}
\end{array}
if ew < -3.99999999999999972e-272 or 1.45e-149 < ew Initial program 99.8%
Applied egg-rr45.2%
Taylor expanded in eh around 0 36.8%
add-sqr-sqrt35.7%
sqrt-unprod38.7%
pow238.7%
Applied egg-rr38.7%
unpow238.7%
rem-sqrt-square69.6%
Simplified69.6%
if -3.99999999999999972e-272 < ew < 1.45e-149Initial program 99.8%
Applied egg-rr71.5%
Taylor expanded in eh around inf 54.8%
associate-*r/54.8%
associate-*r/54.8%
*-commutative54.8%
associate-*r/54.8%
associate-*l*54.8%
*-commutative54.8%
Simplified54.8%
Final simplification67.1%
(FPCore (eh ew t) :precision binary64 (if (<= eh -5e+192) (+ ew (* eh (* t (sin (atan (/ (* eh (tan t)) ew)))))) (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5e+192) {
tmp = ew + (eh * (t * sin(atan(((eh * tan(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 <= (-5d+192)) then
tmp = ew + (eh * (t * sin(atan(((eh * tan(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 <= -5e+192) {
tmp = ew + (eh * (t * Math.sin(Math.atan(((eh * Math.tan(t)) / ew)))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -5e+192: tmp = ew + (eh * (t * math.sin(math.atan(((eh * math.tan(t)) / ew))))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -5e+192) tmp = Float64(ew + Float64(eh * Float64(t * sin(atan(Float64(Float64(eh * tan(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 <= -5e+192) tmp = ew + (eh * (t * sin(atan(((eh * tan(t)) / ew))))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -5e+192], N[(ew + N[(eh * N[(t * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / 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 -5 \cdot 10^{+192}:\\
\;\;\;\;ew + eh \cdot \left(t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -5.00000000000000033e192Initial program 99.8%
Applied egg-rr46.0%
Taylor expanded in t around 0 32.6%
if -5.00000000000000033e192 < eh Initial program 99.8%
Applied egg-rr50.0%
Taylor expanded in eh around 0 36.5%
add-sqr-sqrt35.3%
sqrt-unprod35.8%
pow235.8%
Applied egg-rr35.8%
unpow235.8%
rem-sqrt-square67.9%
Simplified67.9%
(FPCore (eh ew t) :precision binary64 (if (<= eh -1e+243) (* (* eh t) (sin (atan (* eh (/ (tan t) ew))))) (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -1e+243) {
tmp = (eh * t) * sin(atan((eh * (tan(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 <= (-1d+243)) then
tmp = (eh * t) * sin(atan((eh * (tan(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 <= -1e+243) {
tmp = (eh * t) * Math.sin(Math.atan((eh * (Math.tan(t) / ew))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -1e+243: tmp = (eh * t) * math.sin(math.atan((eh * (math.tan(t) / ew)))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -1e+243) tmp = Float64(Float64(eh * t) * sin(atan(Float64(eh * Float64(tan(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 <= -1e+243) tmp = (eh * t) * sin(atan((eh * (tan(t) / ew)))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -1e+243], N[(N[(eh * t), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $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 \cdot 10^{+243}:\\
\;\;\;\;\left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -1.0000000000000001e243Initial program 99.8%
Applied egg-rr42.4%
Taylor expanded in eh around inf 42.4%
associate-*r/42.4%
associate-*r/42.4%
*-commutative42.4%
associate-*r/42.4%
associate-*l*42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in t around 0 33.0%
associate-*r*33.0%
*-commutative33.0%
*-commutative33.0%
associate-*r/33.0%
associate-*r/33.0%
*-commutative33.0%
associate-/l*33.0%
Simplified33.0%
if -1.0000000000000001e243 < eh Initial program 99.8%
Applied egg-rr50.0%
Taylor expanded in eh around 0 36.1%
add-sqr-sqrt35.0%
sqrt-unprod34.8%
pow234.8%
Applied egg-rr34.8%
unpow234.8%
rem-sqrt-square65.8%
Simplified65.8%
Final simplification64.0%
(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%
Applied egg-rr49.6%
Taylor expanded in eh around 0 34.3%
add-sqr-sqrt33.2%
sqrt-unprod33.1%
pow233.1%
Applied egg-rr33.1%
unpow233.1%
rem-sqrt-square62.4%
Simplified62.4%
(FPCore (eh ew t) :precision binary64 (* ew (cos t)))
double code(double eh, double ew, double t) {
return 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 = ew * cos(t)
end function
public static double code(double eh, double ew, double t) {
return ew * Math.cos(t);
}
def code(eh, ew, t): return ew * math.cos(t)
function code(eh, ew, t) return Float64(ew * cos(t)) end
function tmp = code(eh, ew, t) tmp = ew * cos(t); end
code[eh_, ew_, t_] := N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot \cos t
\end{array}
Initial program 99.8%
Applied egg-rr49.6%
Taylor expanded in eh around 0 34.3%
(FPCore (eh ew t) :precision binary64 ew)
double code(double eh, double ew, double t) {
return ew;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = ew
end function
public static double code(double eh, double ew, double t) {
return ew;
}
def code(eh, ew, t): return ew
function code(eh, ew, t) return ew end
function tmp = code(eh, ew, t) tmp = ew; end
code[eh_, ew_, t_] := ew
\begin{array}{l}
\\
ew
\end{array}
Initial program 99.8%
Applied egg-rr49.6%
Taylor expanded in t around 0 22.2%
herbie shell --seed 2024125
(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)))))))