
(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 (let* ((t_1 (atan (* (/ (tan t) ew) eh)))) (fabs (fma (* (cos t_1) (cos t)) ew (* (* (sin t) eh) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((tan(t) / ew) * eh));
return fabs(fma((cos(t_1) * cos(t)), ew, ((sin(t) * eh) * sin(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(Float64(tan(t) / ew) * eh)) return abs(fma(Float64(cos(t_1) * cos(t)), ew, Float64(Float64(sin(t) * eh) * sin(t_1)))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[Cos[t$95$1], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)\\
\left|\mathsf{fma}\left(\cos t\_1 \cdot \cos t, ew, \left(\sin t \cdot eh\right) \cdot \sin t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (cos (atan (* (/ (tan t) ew) eh))) (cos t)) ew (* (* (sin t) eh) (sin (atan (* (/ t ew) eh)))))))
double code(double eh, double ew, double t) {
return fabs(fma((cos(atan(((tan(t) / ew) * eh))) * cos(t)), ew, ((sin(t) * eh) * sin(atan(((t / ew) * eh))))));
}
function code(eh, ew, t) return abs(fma(Float64(cos(atan(Float64(Float64(tan(t) / ew) * eh))) * cos(t)), ew, Float64(Float64(sin(t) * eh) * sin(atan(Float64(Float64(t / ew) * eh)))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(t / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \cos t, ew, \left(\sin t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{t}{ew} \cdot eh\right)\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in t around 0
lower-/.f6498.9
Applied rewrites98.9%
Final simplification98.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)))
(if (or (<= eh -7.7e+136) (not (<= eh 2.4e+196)))
(fabs
(*
(* (sin t) (- eh))
(sin (atan (* (/ (- (sin t)) ew) (/ eh (cos t)))))))
(*
(fabs (+ (* (* (* t_1 eh) eh) (sin t)) (* (cos t) ew)))
(pow (+ (pow (* eh t_1) 2.0) 1.0) -0.5)))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double tmp;
if ((eh <= -7.7e+136) || !(eh <= 2.4e+196)) {
tmp = fabs(((sin(t) * -eh) * sin(atan(((-sin(t) / ew) * (eh / cos(t)))))));
} else {
tmp = fabs(((((t_1 * eh) * eh) * sin(t)) + (cos(t) * ew))) * pow((pow((eh * t_1), 2.0) + 1.0), -0.5);
}
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 = tan(t) / ew
if ((eh <= (-7.7d+136)) .or. (.not. (eh <= 2.4d+196))) then
tmp = abs(((sin(t) * -eh) * sin(atan(((-sin(t) / ew) * (eh / cos(t)))))))
else
tmp = abs(((((t_1 * eh) * eh) * sin(t)) + (cos(t) * ew))) * ((((eh * t_1) ** 2.0d0) + 1.0d0) ** (-0.5d0))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) / ew;
double tmp;
if ((eh <= -7.7e+136) || !(eh <= 2.4e+196)) {
tmp = Math.abs(((Math.sin(t) * -eh) * Math.sin(Math.atan(((-Math.sin(t) / ew) * (eh / Math.cos(t)))))));
} else {
tmp = Math.abs(((((t_1 * eh) * eh) * Math.sin(t)) + (Math.cos(t) * ew))) * Math.pow((Math.pow((eh * t_1), 2.0) + 1.0), -0.5);
}
return tmp;
}
def code(eh, ew, t): t_1 = math.tan(t) / ew tmp = 0 if (eh <= -7.7e+136) or not (eh <= 2.4e+196): tmp = math.fabs(((math.sin(t) * -eh) * math.sin(math.atan(((-math.sin(t) / ew) * (eh / math.cos(t))))))) else: tmp = math.fabs(((((t_1 * eh) * eh) * math.sin(t)) + (math.cos(t) * ew))) * math.pow((math.pow((eh * t_1), 2.0) + 1.0), -0.5) return tmp
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) tmp = 0.0 if ((eh <= -7.7e+136) || !(eh <= 2.4e+196)) tmp = abs(Float64(Float64(sin(t) * Float64(-eh)) * sin(atan(Float64(Float64(Float64(-sin(t)) / ew) * Float64(eh / cos(t))))))); else tmp = Float64(abs(Float64(Float64(Float64(Float64(t_1 * eh) * eh) * sin(t)) + Float64(cos(t) * ew))) * (Float64((Float64(eh * t_1) ^ 2.0) + 1.0) ^ -0.5)); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = tan(t) / ew; tmp = 0.0; if ((eh <= -7.7e+136) || ~((eh <= 2.4e+196))) tmp = abs(((sin(t) * -eh) * sin(atan(((-sin(t) / ew) * (eh / cos(t))))))); else tmp = abs(((((t_1 * eh) * eh) * sin(t)) + (cos(t) * ew))) * ((((eh * t_1) ^ 2.0) + 1.0) ^ -0.5); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -7.7e+136], N[Not[LessEqual[eh, 2.4e+196]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-N[Sin[t], $MachinePrecision]) / ew), $MachinePrecision] * N[(eh / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[N[(N[(N[(N[(t$95$1 * eh), $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[Power[N[(eh * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
\mathbf{if}\;eh \leq -7.7 \cdot 10^{+136} \lor \neg \left(eh \leq 2.4 \cdot 10^{+196}\right):\\
\;\;\;\;\left|\left(\sin t \cdot \left(-eh\right)\right) \cdot \sin \tan^{-1} \left(\frac{-\sin t}{ew} \cdot \frac{eh}{\cos t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\left(t\_1 \cdot eh\right) \cdot eh\right) \cdot \sin t + \cos t \cdot ew\right| \cdot {\left({\left(eh \cdot t\_1\right)}^{2} + 1\right)}^{-0.5}\\
\end{array}
\end{array}
if eh < -7.7000000000000003e136 or 2.4e196 < eh Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
Applied rewrites80.1%
if -7.7000000000000003e136 < eh < 2.4e196Initial program 99.8%
Applied rewrites99.8%
Applied rewrites79.9%
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
inv-powN/A
sqrt-pow2N/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval91.5
Applied rewrites91.5%
Final simplification89.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) ew)))
(if (or (<= eh -1.2e+95) (not (<= eh 2.1e+196)))
(fabs
(*
(* (sin t) (- eh))
(sin (atan (* (/ (- (sin t)) ew) (/ eh (cos t)))))))
(*
(fabs (fma (* (* eh t_1) eh) (sin t) (* (cos t) ew)))
(cos (atan (* t_1 eh)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / ew;
double tmp;
if ((eh <= -1.2e+95) || !(eh <= 2.1e+196)) {
tmp = fabs(((sin(t) * -eh) * sin(atan(((-sin(t) / ew) * (eh / cos(t)))))));
} else {
tmp = fabs(fma(((eh * t_1) * eh), sin(t), (cos(t) * ew))) * cos(atan((t_1 * eh)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(tan(t) / ew) tmp = 0.0 if ((eh <= -1.2e+95) || !(eh <= 2.1e+196)) tmp = abs(Float64(Float64(sin(t) * Float64(-eh)) * sin(atan(Float64(Float64(Float64(-sin(t)) / ew) * Float64(eh / cos(t))))))); else tmp = Float64(abs(fma(Float64(Float64(eh * t_1) * eh), sin(t), Float64(cos(t) * ew))) * cos(atan(Float64(t_1 * eh)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -1.2e+95], N[Not[LessEqual[eh, 2.1e+196]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-N[Sin[t], $MachinePrecision]) / ew), $MachinePrecision] * N[(eh / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[N[(N[(N[(eh * t$95$1), $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t], $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[ArcTan[N[(t$95$1 * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
\mathbf{if}\;eh \leq -1.2 \cdot 10^{+95} \lor \neg \left(eh \leq 2.1 \cdot 10^{+196}\right):\\
\;\;\;\;\left|\left(\sin t \cdot \left(-eh\right)\right) \cdot \sin \tan^{-1} \left(\frac{-\sin t}{ew} \cdot \frac{eh}{\cos t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(\left(eh \cdot t\_1\right) \cdot eh, \sin t, \cos t \cdot ew\right)\right| \cdot \cos \tan^{-1} \left(t\_1 \cdot eh\right)\\
\end{array}
\end{array}
if eh < -1.2e95 or 2.10000000000000015e196 < eh Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
Applied rewrites78.0%
if -1.2e95 < eh < 2.10000000000000015e196Initial program 99.8%
Applied rewrites99.8%
Applied rewrites81.5%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
+-commutativeN/A
lower-fma.f6481.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.5
Applied rewrites81.5%
Final simplification80.6%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -1.2e+95) (not (<= eh 2.1e+196)))
(fabs
(* (* (sin t) (- eh)) (sin (atan (* (/ (- (sin t)) ew) (/ eh (cos t)))))))
(fabs
(/ (* (- ew) (cos t)) (pow (cos (atan (* (/ (tan t) ew) eh))) -1.0)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.2e+95) || !(eh <= 2.1e+196)) {
tmp = fabs(((sin(t) * -eh) * sin(atan(((-sin(t) / ew) * (eh / cos(t)))))));
} else {
tmp = fabs(((-ew * cos(t)) / pow(cos(atan(((tan(t) / ew) * eh))), -1.0)));
}
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.2d+95)) .or. (.not. (eh <= 2.1d+196))) then
tmp = abs(((sin(t) * -eh) * sin(atan(((-sin(t) / ew) * (eh / cos(t)))))))
else
tmp = abs(((-ew * cos(t)) / (cos(atan(((tan(t) / ew) * eh))) ** (-1.0d0))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.2e+95) || !(eh <= 2.1e+196)) {
tmp = Math.abs(((Math.sin(t) * -eh) * Math.sin(Math.atan(((-Math.sin(t) / ew) * (eh / Math.cos(t)))))));
} else {
tmp = Math.abs(((-ew * Math.cos(t)) / Math.pow(Math.cos(Math.atan(((Math.tan(t) / ew) * eh))), -1.0)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.2e+95) or not (eh <= 2.1e+196): tmp = math.fabs(((math.sin(t) * -eh) * math.sin(math.atan(((-math.sin(t) / ew) * (eh / math.cos(t))))))) else: tmp = math.fabs(((-ew * math.cos(t)) / math.pow(math.cos(math.atan(((math.tan(t) / ew) * eh))), -1.0))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.2e+95) || !(eh <= 2.1e+196)) tmp = abs(Float64(Float64(sin(t) * Float64(-eh)) * sin(atan(Float64(Float64(Float64(-sin(t)) / ew) * Float64(eh / cos(t))))))); else tmp = abs(Float64(Float64(Float64(-ew) * cos(t)) / (cos(atan(Float64(Float64(tan(t) / ew) * eh))) ^ -1.0))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.2e+95) || ~((eh <= 2.1e+196))) tmp = abs(((sin(t) * -eh) * sin(atan(((-sin(t) / ew) * (eh / cos(t))))))); else tmp = abs(((-ew * cos(t)) / (cos(atan(((tan(t) / ew) * eh))) ^ -1.0))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.2e+95], N[Not[LessEqual[eh, 2.1e+196]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * (-eh)), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-N[Sin[t], $MachinePrecision]) / ew), $MachinePrecision] * N[(eh / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[((-ew) * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.2 \cdot 10^{+95} \lor \neg \left(eh \leq 2.1 \cdot 10^{+196}\right):\\
\;\;\;\;\left|\left(\sin t \cdot \left(-eh\right)\right) \cdot \sin \tan^{-1} \left(\frac{-\sin t}{ew} \cdot \frac{eh}{\cos t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(-ew\right) \cdot \cos t}{{\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)}^{-1}}\right|\\
\end{array}
\end{array}
if eh < -1.2e95 or 2.10000000000000015e196 < eh Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
Applied rewrites78.0%
if -1.2e95 < eh < 2.10000000000000015e196Initial program 99.8%
Applied rewrites81.5%
Taylor expanded in eh around 0
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f6479.8
Applied rewrites79.8%
Final simplification79.3%
(FPCore (eh ew t) :precision binary64 (fabs (/ (* (- ew) (cos t)) (pow (cos (atan (* (/ (tan t) ew) eh))) -1.0))))
double code(double eh, double ew, double t) {
return fabs(((-ew * cos(t)) / pow(cos(atan(((tan(t) / ew) * eh))), -1.0)));
}
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)) / (cos(atan(((tan(t) / ew) * eh))) ** (-1.0d0))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((-ew * Math.cos(t)) / Math.pow(Math.cos(Math.atan(((Math.tan(t) / ew) * eh))), -1.0)));
}
def code(eh, ew, t): return math.fabs(((-ew * math.cos(t)) / math.pow(math.cos(math.atan(((math.tan(t) / ew) * eh))), -1.0)))
function code(eh, ew, t) return abs(Float64(Float64(Float64(-ew) * cos(t)) / (cos(atan(Float64(Float64(tan(t) / ew) * eh))) ^ -1.0))) end
function tmp = code(eh, ew, t) tmp = abs(((-ew * cos(t)) / (cos(atan(((tan(t) / ew) * eh))) ^ -1.0))); end
code[eh_, ew_, t_] := N[Abs[N[(N[((-ew) * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\left(-ew\right) \cdot \cos t}{{\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)}^{-1}}\right|
\end{array}
Initial program 99.8%
Applied rewrites68.6%
Taylor expanded in eh around 0
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f6466.7
Applied rewrites66.7%
Final simplification66.7%
(FPCore (eh ew t) :precision binary64 (* (fabs (* (cos t) ew)) (cos (atan (* (/ (tan t) ew) eh)))))
double code(double eh, double ew, double t) {
return fabs((cos(t) * ew)) * cos(atan(((tan(t) / ew) * 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((cos(t) * ew)) * cos(atan(((tan(t) / ew) * eh)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.cos(t) * ew)) * Math.cos(Math.atan(((Math.tan(t) / ew) * eh)));
}
def code(eh, ew, t): return math.fabs((math.cos(t) * ew)) * math.cos(math.atan(((math.tan(t) / ew) * eh)))
function code(eh, ew, t) return Float64(abs(Float64(cos(t) * ew)) * cos(atan(Float64(Float64(tan(t) / ew) * eh)))) end
function tmp = code(eh, ew, t) tmp = abs((cos(t) * ew)) * cos(atan(((tan(t) / ew) * eh))); end
code[eh_, ew_, t_] := N[(N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|\cos t \cdot ew\right| \cdot \cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites68.6%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6466.7
Applied rewrites66.7%
(FPCore (eh ew t) :precision binary64 (fabs (/ ew 1.0)))
double code(double eh, double ew, double t) {
return fabs((ew / 1.0));
}
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 / 1.0d0))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew / 1.0));
}
def code(eh, ew, t): return math.fabs((ew / 1.0))
function code(eh, ew, t) return abs(Float64(ew / 1.0)) end
function tmp = code(eh, ew, t) tmp = abs((ew / 1.0)); end
code[eh_, ew_, t_] := N[Abs[N[(ew / 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{1}\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites45.4%
Taylor expanded in t around 0
Applied rewrites44.3%
Applied rewrites43.4%
Taylor expanded in eh around 0
Applied rewrites45.6%
herbie shell --seed 2024317
(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)))))))