
(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 11 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 (- (* (* 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{eh \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}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* ew (cos t)) (cos (atan (- (/ (* eh (tan t)) ew))))) (* (* eh (sin t)) (sin (atan (/ (* t (- eh)) ew)))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * cos(atan(-((eh * tan(t)) / 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 * cos(t)) * cos(atan(-((eh * tan(t)) / 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 * Math.cos(t)) * Math.cos(Math.atan(-((eh * Math.tan(t)) / 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.cos(math.atan(-((eh * math.tan(t)) / 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)) * cos(atan(Float64(-Float64(Float64(eh * tan(t)) / ew))))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(t * Float64(-eh)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) * cos(atan(-((eh * tan(t)) / 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[Cos[N[ArcTan[(-N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision])], $MachinePrecision]], $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|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(-\frac{eh \cdot \tan t}{ew}\right) - \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%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.4
Simplified99.4%
Final simplification99.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (* eh (tan t)) ew))
(t_2
(fabs
(*
eh
(fma
(- ew)
(/ (* (cos t) (/ 1.0 (sqrt (+ (pow t_1 2.0) 1.0)))) eh)
(* (sin (atan (/ (* t (- eh)) ew))) (sin t)))))))
(if (<= eh -4.8e-134)
t_2
(if (<= eh 2e-164)
(fabs
(/
(fma t_1 (* eh (sin t)) (* ew (cos t)))
(sqrt (+ (pow (* (- eh) (/ (tan t) ew)) 2.0) 1.0))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = (eh * tan(t)) / ew;
double t_2 = fabs((eh * fma(-ew, ((cos(t) * (1.0 / sqrt((pow(t_1, 2.0) + 1.0)))) / eh), (sin(atan(((t * -eh) / ew))) * sin(t)))));
double tmp;
if (eh <= -4.8e-134) {
tmp = t_2;
} else if (eh <= 2e-164) {
tmp = fabs((fma(t_1, (eh * sin(t)), (ew * cos(t))) / sqrt((pow((-eh * (tan(t) / ew)), 2.0) + 1.0))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh * tan(t)) / ew) t_2 = abs(Float64(eh * fma(Float64(-ew), Float64(Float64(cos(t) * Float64(1.0 / sqrt(Float64((t_1 ^ 2.0) + 1.0)))) / eh), Float64(sin(atan(Float64(Float64(t * Float64(-eh)) / ew))) * sin(t))))) tmp = 0.0 if (eh <= -4.8e-134) tmp = t_2; elseif (eh <= 2e-164) tmp = abs(Float64(fma(t_1, Float64(eh * sin(t)), Float64(ew * cos(t))) / sqrt(Float64((Float64(Float64(-eh) * Float64(tan(t) / ew)) ^ 2.0) + 1.0)))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(eh * N[((-ew) * N[(N[(N[Cos[t], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eh), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -4.8e-134], t$95$2, If[LessEqual[eh, 2e-164], N[Abs[N[(N[(t$95$1 * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[N[((-eh) * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh \cdot \tan t}{ew}\\
t_2 := \left|eh \cdot \mathsf{fma}\left(-ew, \frac{\cos t \cdot \frac{1}{\sqrt{{t\_1}^{2} + 1}}}{eh}, \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right) \cdot \sin t\right)\right|\\
\mathbf{if}\;eh \leq -4.8 \cdot 10^{-134}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 2 \cdot 10^{-164}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1, eh \cdot \sin t, ew \cdot \cos t\right)}{\sqrt{{\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}^{2} + 1}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -4.80000000000000019e-134 or 1.99999999999999992e-164 < eh Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.7
Simplified99.7%
Taylor expanded in eh around -inf
Simplified99.0%
Applied egg-rr99.0%
if -4.80000000000000019e-134 < eh < 1.99999999999999992e-164Initial program 99.8%
Applied egg-rr99.8%
Applied egg-rr99.8%
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-fma.f6499.8
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6499.8
Applied egg-rr99.8%
Final simplification99.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(*
eh
(fma
(- ew)
(/ (cos t) eh)
(* (sin (atan (/ (* t (- eh)) ew))) (sin t)))))))
(if (<= eh -4.8e-134)
t_1
(if (<= eh 2e-164)
(fabs
(/
(fma (/ (* eh (tan t)) ew) (* eh (sin t)) (* ew (cos t)))
(sqrt (+ (pow (* (- eh) (/ (tan t) ew)) 2.0) 1.0))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * fma(-ew, (cos(t) / eh), (sin(atan(((t * -eh) / ew))) * sin(t)))));
double tmp;
if (eh <= -4.8e-134) {
tmp = t_1;
} else if (eh <= 2e-164) {
tmp = fabs((fma(((eh * tan(t)) / ew), (eh * sin(t)), (ew * cos(t))) / sqrt((pow((-eh * (tan(t) / ew)), 2.0) + 1.0))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * fma(Float64(-ew), Float64(cos(t) / eh), Float64(sin(atan(Float64(Float64(t * Float64(-eh)) / ew))) * sin(t))))) tmp = 0.0 if (eh <= -4.8e-134) tmp = t_1; elseif (eh <= 2e-164) tmp = abs(Float64(fma(Float64(Float64(eh * tan(t)) / ew), Float64(eh * sin(t)), Float64(ew * cos(t))) / sqrt(Float64((Float64(Float64(-eh) * Float64(tan(t) / ew)) ^ 2.0) + 1.0)))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[((-ew) * N[(N[Cos[t], $MachinePrecision] / eh), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -4.8e-134], t$95$1, If[LessEqual[eh, 2e-164], N[Abs[N[(N[(N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[N[((-eh) * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \mathsf{fma}\left(-ew, \frac{\cos t}{eh}, \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right) \cdot \sin t\right)\right|\\
\mathbf{if}\;eh \leq -4.8 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 2 \cdot 10^{-164}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{eh \cdot \tan t}{ew}, eh \cdot \sin t, ew \cdot \cos t\right)}{\sqrt{{\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}^{2} + 1}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -4.80000000000000019e-134 or 1.99999999999999992e-164 < eh Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.7
Simplified99.7%
Taylor expanded in eh around -inf
Simplified99.0%
Applied egg-rr99.0%
Taylor expanded in eh around 0
lower-/.f64N/A
lower-cos.f6497.1
Simplified97.1%
if -4.80000000000000019e-134 < eh < 1.99999999999999992e-164Initial program 99.8%
Applied egg-rr99.8%
Applied egg-rr99.8%
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-fma.f6499.8
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6499.8
Applied egg-rr99.8%
Final simplification97.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(*
eh
(fma
(- ew)
(/ (cos t) eh)
(* (sin (atan (/ (* t (- eh)) ew))) (sin t)))))))
(if (<= eh -4.8e-134)
t_1
(if (<= eh 3.8e-146)
(fabs
(/
(fma (* (tan t) (/ eh ew)) (* eh (sin t)) (* ew (cos t)))
(sqrt (+ (pow (/ (* eh (tan t)) ew) 2.0) 1.0))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * fma(-ew, (cos(t) / eh), (sin(atan(((t * -eh) / ew))) * sin(t)))));
double tmp;
if (eh <= -4.8e-134) {
tmp = t_1;
} else if (eh <= 3.8e-146) {
tmp = fabs((fma((tan(t) * (eh / ew)), (eh * sin(t)), (ew * cos(t))) / sqrt((pow(((eh * tan(t)) / ew), 2.0) + 1.0))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * fma(Float64(-ew), Float64(cos(t) / eh), Float64(sin(atan(Float64(Float64(t * Float64(-eh)) / ew))) * sin(t))))) tmp = 0.0 if (eh <= -4.8e-134) tmp = t_1; elseif (eh <= 3.8e-146) tmp = abs(Float64(fma(Float64(tan(t) * Float64(eh / ew)), Float64(eh * sin(t)), Float64(ew * cos(t))) / sqrt(Float64((Float64(Float64(eh * tan(t)) / ew) ^ 2.0) + 1.0)))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[((-ew) * N[(N[Cos[t], $MachinePrecision] / eh), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -4.8e-134], t$95$1, If[LessEqual[eh, 3.8e-146], N[Abs[N[(N[(N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \mathsf{fma}\left(-ew, \frac{\cos t}{eh}, \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right) \cdot \sin t\right)\right|\\
\mathbf{if}\;eh \leq -4.8 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 3.8 \cdot 10^{-146}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\tan t \cdot \frac{eh}{ew}, eh \cdot \sin t, ew \cdot \cos t\right)}{\sqrt{{\left(\frac{eh \cdot \tan t}{ew}\right)}^{2} + 1}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -4.80000000000000019e-134 or 3.79999999999999994e-146 < eh Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.7
Simplified99.7%
Taylor expanded in eh around -inf
Simplified99.0%
Applied egg-rr99.0%
Taylor expanded in eh around 0
lower-/.f64N/A
lower-cos.f6497.0
Simplified97.0%
if -4.80000000000000019e-134 < eh < 3.79999999999999994e-146Initial program 99.8%
Applied egg-rr99.8%
Applied egg-rr99.8%
lift-neg.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
unpow1N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.8
lift-pow.f64N/A
unpow2N/A
Applied egg-rr99.8%
Final simplification97.8%
(FPCore (eh ew t)
:precision binary64
(if (<= ew 2.6e+132)
(fabs
(*
eh
(fma (- ew) (/ (cos t) eh) (* (sin (atan (/ (* t (- eh)) ew))) (sin t)))))
(fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= 2.6e+132) {
tmp = fabs((eh * fma(-ew, (cos(t) / eh), (sin(atan(((t * -eh) / ew))) * sin(t)))));
} else {
tmp = fabs((ew * cos(t)));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= 2.6e+132) tmp = abs(Float64(eh * fma(Float64(-ew), Float64(cos(t) / eh), Float64(sin(atan(Float64(Float64(t * Float64(-eh)) / ew))) * sin(t))))); else tmp = abs(Float64(ew * cos(t))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, 2.6e+132], N[Abs[N[(eh * N[((-ew) * N[(N[Cos[t], $MachinePrecision] / eh), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq 2.6 \cdot 10^{+132}:\\
\;\;\;\;\left|eh \cdot \mathsf{fma}\left(-ew, \frac{\cos t}{eh}, \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right) \cdot \sin t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if ew < 2.6e132Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.4
Simplified99.4%
Taylor expanded in eh around -inf
Simplified94.4%
Applied egg-rr94.4%
Taylor expanded in eh around 0
lower-/.f64N/A
lower-cos.f6492.7
Simplified92.7%
if 2.6e132 < ew Initial program 99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6497.1
Simplified97.1%
Final simplification93.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (cos t))))) (if (<= ew -1.7e-21) t_1 (if (<= ew 2.9e-84) (fabs (* eh (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (ew <= -1.7e-21) {
tmp = t_1;
} else if (ew <= 2.9e-84) {
tmp = fabs((eh * sin(t)));
} 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((ew * cos(t)))
if (ew <= (-1.7d-21)) then
tmp = t_1
else if (ew <= 2.9d-84) then
tmp = abs((eh * sin(t)))
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((ew * Math.cos(t)));
double tmp;
if (ew <= -1.7e-21) {
tmp = t_1;
} else if (ew <= 2.9e-84) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.cos(t))) tmp = 0 if ew <= -1.7e-21: tmp = t_1 elif ew <= 2.9e-84: tmp = math.fabs((eh * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * cos(t))) tmp = 0.0 if (ew <= -1.7e-21) tmp = t_1; elseif (ew <= 2.9e-84) tmp = abs(Float64(eh * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * cos(t))); tmp = 0.0; if (ew <= -1.7e-21) tmp = t_1; elseif (ew <= 2.9e-84) tmp = abs((eh * sin(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.7e-21], t$95$1, If[LessEqual[ew, 2.9e-84], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -1.7 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 2.9 \cdot 10^{-84}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -1.7e-21 or 2.90000000000000019e-84 < ew Initial program 99.8%
Applied egg-rr93.1%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6483.5
Simplified83.5%
if -1.7e-21 < ew < 2.90000000000000019e-84Initial program 99.8%
Applied egg-rr59.8%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6474.2
Simplified74.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= t -1.8e-27)
t_1
(if (<= t 2.25e-53)
(fabs
(fma (* eh 0.5) (/ (* eh (* t t)) ew) (fma t (* t (* ew -0.5)) ew)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (t <= -1.8e-27) {
tmp = t_1;
} else if (t <= 2.25e-53) {
tmp = fabs(fma((eh * 0.5), ((eh * (t * t)) / ew), fma(t, (t * (ew * -0.5)), ew)));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (t <= -1.8e-27) tmp = t_1; elseif (t <= 2.25e-53) tmp = abs(fma(Float64(eh * 0.5), Float64(Float64(eh * Float64(t * t)) / ew), fma(t, Float64(t * Float64(ew * -0.5)), ew))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.8e-27], t$95$1, If[LessEqual[t, 2.25e-53], N[Abs[N[(N[(eh * 0.5), $MachinePrecision] * N[(N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] + N[(t * N[(t * N[(ew * -0.5), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{-53}:\\
\;\;\;\;\left|\mathsf{fma}\left(eh \cdot 0.5, \frac{eh \cdot \left(t \cdot t\right)}{ew}, \mathsf{fma}\left(t, t \cdot \left(ew \cdot -0.5\right), ew\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.7999999999999999e-27 or 2.24999999999999992e-53 < t Initial program 99.6%
Applied egg-rr68.9%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6456.0
Simplified56.0%
if -1.7999999999999999e-27 < t < 2.24999999999999992e-53Initial program 100.0%
Applied egg-rr88.4%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
Simplified59.9%
Taylor expanded in t around inf
lower-fabs.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.0
Simplified60.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
Applied egg-rr71.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* t (* ew t)) -0.5 ew)))
double code(double eh, double ew, double t) {
return fabs(fma((t * (ew * t)), -0.5, ew));
}
function code(eh, ew, t) return abs(fma(Float64(t * Float64(ew * t)), -0.5, ew)) end
code[eh_, ew_, t_] := N[Abs[N[(N[(t * N[(ew * t), $MachinePrecision]), $MachinePrecision] * -0.5 + ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(t \cdot \left(ew \cdot t\right), -0.5, ew\right)\right|
\end{array}
Initial program 99.8%
Applied egg-rr78.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
Simplified32.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f6438.2
Simplified38.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6438.2
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6438.3
Applied egg-rr38.3%
Final simplification38.3%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* t t) (* ew -0.5) ew)))
double code(double eh, double ew, double t) {
return fabs(fma((t * t), (ew * -0.5), ew));
}
function code(eh, ew, t) return abs(fma(Float64(t * t), Float64(ew * -0.5), ew)) end
code[eh_, ew_, t_] := N[Abs[N[(N[(t * t), $MachinePrecision] * N[(ew * -0.5), $MachinePrecision] + ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(t \cdot t, ew \cdot -0.5, ew\right)\right|
\end{array}
Initial program 99.8%
Applied egg-rr78.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
Simplified32.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f6438.2
Simplified38.2%
(FPCore (eh ew t) :precision binary64 (fabs (* -0.5 (* ew (* t t)))))
double code(double eh, double ew, double t) {
return fabs((-0.5 * (ew * (t * 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(((-0.5d0) * (ew * (t * t))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((-0.5 * (ew * (t * t))));
}
def code(eh, ew, t): return math.fabs((-0.5 * (ew * (t * t))))
function code(eh, ew, t) return abs(Float64(-0.5 * Float64(ew * Float64(t * t)))) end
function tmp = code(eh, ew, t) tmp = abs((-0.5 * (ew * (t * t)))); end
code[eh_, ew_, t_] := N[Abs[N[(-0.5 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|-0.5 \cdot \left(ew \cdot \left(t \cdot t\right)\right)\right|
\end{array}
Initial program 99.8%
Applied egg-rr78.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
Simplified32.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f6438.2
Simplified38.2%
Taylor expanded in t around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f644.8
Simplified4.8%
Final simplification4.8%
herbie shell --seed 2024207
(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)))))))