
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (- (* (/ 1.0 (sqrt (+ (pow (* (/ (tan t) ew) eh) 2.0) 1.0))) (* ew (cos t))) (* (* eh (sin t)) (sin (atan (/ (* (tan t) (- eh)) ew)))))))
double code(double eh, double ew, double t) {
return fabs((((1.0 / sqrt((pow(((tan(t) / ew) * eh), 2.0) + 1.0))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((tan(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((((1.0d0 / sqrt(((((tan(t) / ew) * eh) ** 2.0d0) + 1.0d0))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((1.0 / Math.sqrt((Math.pow(((Math.tan(t) / ew) * eh), 2.0) + 1.0))) * (ew * Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * -eh) / ew))))));
}
def code(eh, ew, t): return math.fabs((((1.0 / math.sqrt((math.pow(((math.tan(t) / ew) * eh), 2.0) + 1.0))) * (ew * math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * -eh) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(1.0 / sqrt(Float64((Float64(Float64(tan(t) / ew) * eh) ^ 2.0) + 1.0))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((1.0 / sqrt(((((tan(t) / ew) * eh) ^ 2.0) + 1.0))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(1.0 / N[Sqrt[N[(N[Power[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\sqrt{{\left(\frac{\tan t}{ew} \cdot eh\right)}^{2} + 1}} \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (cos (atan (/ (* (tan t) (- eh)) ew))) (* ew (cos t))) (* (* eh (sin t)) (sin (atan (* eh (/ t (- ew)))))))))
double code(double eh, double ew, double t) {
return fabs(((cos(atan(((tan(t) * -eh) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan((eh * (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(((cos(atan(((tan(t) * -eh) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan((eh * (t / -ew)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.cos(Math.atan(((Math.tan(t) * -eh) / ew))) * (ew * Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan((eh * (t / -ew)))))));
}
def code(eh, ew, t): return math.fabs(((math.cos(math.atan(((math.tan(t) * -eh) / ew))) * (ew * math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan((eh * (t / -ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(cos(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(eh * Float64(t / Float64(-ew)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((cos(atan(((tan(t) * -eh) / ew))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan((eh * (t / -ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(t / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\cos \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right) \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{t}{-ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
Simplified99.5%
Final simplification99.5%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* (tan t) (- eh)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(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)) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / 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(((Math.tan(t) * -eh) / ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * -eh) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * -eh) / 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[(N[Tan[t], $MachinePrecision] * (-eh)), $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{\tan t \cdot \left(-eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.7
Simplified65.7%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6499.0
Simplified99.0%
Final simplification99.0%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* t (- eh)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((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)) - ((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)) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((t * -eh) / ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((t * -eh) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - 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)) - ((eh * sin(t)) * sin(atan(((t * -eh) / 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[(t * (-eh)), $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{t \cdot \left(-eh\right)}{ew}\right)\right|
\end{array}
Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.7
Simplified65.7%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6499.0
Simplified99.0%
Taylor expanded in t around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6498.8
Simplified98.8%
Final simplification98.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t)))
(t_2 (* eh (sin t)))
(t_3 (sin (atan (/ (* t (- eh)) ew))))
(t_4 (fabs (- t_1 (* t_3 (* t eh))))))
(if (<= ew -3.9e+105)
t_4
(if (<= ew -1.35e-160)
(fabs
(+
t_1
(*
t_2
(/
(* t eh)
(* ew (sqrt (fma eh (/ (* eh (* t t)) (* ew ew)) 1.0)))))))
(if (<= ew 6.2e-188)
(fabs (- (fma ew (* (* t t) -0.5) ew) (* t_2 t_3)))
t_4)))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = eh * sin(t);
double t_3 = sin(atan(((t * -eh) / ew)));
double t_4 = fabs((t_1 - (t_3 * (t * eh))));
double tmp;
if (ew <= -3.9e+105) {
tmp = t_4;
} else if (ew <= -1.35e-160) {
tmp = fabs((t_1 + (t_2 * ((t * eh) / (ew * sqrt(fma(eh, ((eh * (t * t)) / (ew * ew)), 1.0)))))));
} else if (ew <= 6.2e-188) {
tmp = fabs((fma(ew, ((t * t) * -0.5), ew) - (t_2 * t_3)));
} else {
tmp = t_4;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = Float64(eh * sin(t)) t_3 = sin(atan(Float64(Float64(t * Float64(-eh)) / ew))) t_4 = abs(Float64(t_1 - Float64(t_3 * Float64(t * eh)))) tmp = 0.0 if (ew <= -3.9e+105) tmp = t_4; elseif (ew <= -1.35e-160) tmp = abs(Float64(t_1 + Float64(t_2 * Float64(Float64(t * eh) / Float64(ew * sqrt(fma(eh, Float64(Float64(eh * Float64(t * t)) / Float64(ew * ew)), 1.0))))))); elseif (ew <= 6.2e-188) tmp = abs(Float64(fma(ew, Float64(Float64(t * t) * -0.5), ew) - Float64(t_2 * t_3))); else tmp = t_4; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[(t$95$1 - N[(t$95$3 * N[(t * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.9e+105], t$95$4, If[LessEqual[ew, -1.35e-160], N[Abs[N[(t$95$1 + N[(t$95$2 * N[(N[(t * eh), $MachinePrecision] / N[(ew * N[Sqrt[N[(eh * N[(N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision] / N[(ew * ew), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 6.2e-188], N[Abs[N[(N[(ew * N[(N[(t * t), $MachinePrecision] * -0.5), $MachinePrecision] + ew), $MachinePrecision] - N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$4]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := eh \cdot \sin t\\
t_3 := \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right)\\
t_4 := \left|t\_1 - t\_3 \cdot \left(t \cdot eh\right)\right|\\
\mathbf{if}\;ew \leq -3.9 \cdot 10^{+105}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;ew \leq -1.35 \cdot 10^{-160}:\\
\;\;\;\;\left|t\_1 + t\_2 \cdot \frac{t \cdot eh}{ew \cdot \sqrt{\mathsf{fma}\left(eh, \frac{eh \cdot \left(t \cdot t\right)}{ew \cdot ew}, 1\right)}}\right|\\
\mathbf{elif}\;ew \leq 6.2 \cdot 10^{-188}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew, \left(t \cdot t\right) \cdot -0.5, ew\right) - t\_2 \cdot t\_3\right|\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if ew < -3.89999999999999978e105 or 6.2000000000000004e-188 < ew Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified99.7%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6499.3
Simplified99.3%
Taylor expanded in t around 0
lower-*.f6483.3
Simplified83.3%
if -3.89999999999999978e105 < ew < -1.35000000000000005e-160Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified98.9%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6498.9
Simplified98.9%
Applied egg-rr70.8%
if -1.35000000000000005e-160 < ew < 6.2000000000000004e-188Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified97.4%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6497.4
Simplified97.4%
Taylor expanded in t around 0
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.1
Simplified66.1%
Final simplification76.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t)))
(t_2 (fabs (- t_1 (* (sin (atan (/ (* t (- eh)) ew))) (* t eh))))))
(if (<= ew -3.9e+105)
t_2
(if (<= ew -5.8e-142)
(fabs
(+
t_1
(*
(* eh (sin t))
(/
(* t eh)
(* ew (sqrt (fma eh (/ (* eh (* t t)) (* ew ew)) 1.0)))))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = fabs((t_1 - (sin(atan(((t * -eh) / ew))) * (t * eh))));
double tmp;
if (ew <= -3.9e+105) {
tmp = t_2;
} else if (ew <= -5.8e-142) {
tmp = fabs((t_1 + ((eh * sin(t)) * ((t * eh) / (ew * sqrt(fma(eh, ((eh * (t * t)) / (ew * ew)), 1.0)))))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = abs(Float64(t_1 - Float64(sin(atan(Float64(Float64(t * Float64(-eh)) / ew))) * Float64(t * eh)))) tmp = 0.0 if (ew <= -3.9e+105) tmp = t_2; elseif (ew <= -5.8e-142) tmp = abs(Float64(t_1 + Float64(Float64(eh * sin(t)) * Float64(Float64(t * eh) / Float64(ew * sqrt(fma(eh, Float64(Float64(eh * Float64(t * t)) / Float64(ew * ew)), 1.0))))))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(t$95$1 - N[(N[Sin[N[ArcTan[N[(N[(t * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(t * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.9e+105], t$95$2, If[LessEqual[ew, -5.8e-142], N[Abs[N[(t$95$1 + N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(N[(t * eh), $MachinePrecision] / N[(ew * N[Sqrt[N[(eh * N[(N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision] / N[(ew * ew), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \left|t\_1 - \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right) \cdot \left(t \cdot eh\right)\right|\\
\mathbf{if}\;ew \leq -3.9 \cdot 10^{+105}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;ew \leq -5.8 \cdot 10^{-142}:\\
\;\;\;\;\left|t\_1 + \left(eh \cdot \sin t\right) \cdot \frac{t \cdot eh}{ew \cdot \sqrt{\mathsf{fma}\left(eh, \frac{eh \cdot \left(t \cdot t\right)}{ew \cdot ew}, 1\right)}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if ew < -3.89999999999999978e105 or -5.7999999999999998e-142 < ew Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified99.0%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6498.8
Simplified98.8%
Taylor expanded in t around 0
lower-*.f6475.3
Simplified75.3%
if -3.89999999999999978e105 < ew < -5.7999999999999998e-142Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified98.8%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6498.8
Simplified98.8%
Applied egg-rr71.0%
Final simplification74.5%
(FPCore (eh ew t)
:precision binary64
(fabs
(+
(* ew (cos t))
(*
(* eh (sin t))
(/ (* t eh) (* ew (sqrt (fma eh (/ (* eh (* t t)) (* ew ew)) 1.0))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) + ((eh * sin(t)) * ((t * eh) / (ew * sqrt(fma(eh, ((eh * (t * t)) / (ew * ew)), 1.0)))))));
}
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) + Float64(Float64(eh * sin(t)) * Float64(Float64(t * eh) / Float64(ew * sqrt(fma(eh, Float64(Float64(eh * Float64(t * t)) / Float64(ew * ew)), 1.0))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(N[(t * eh), $MachinePrecision] / N[(ew * N[Sqrt[N[(eh * N[(N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision] / N[(ew * ew), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t + \left(eh \cdot \sin t\right) \cdot \frac{t \cdot eh}{ew \cdot \sqrt{\mathsf{fma}\left(eh, \frac{eh \cdot \left(t \cdot t\right)}{ew \cdot ew}, 1\right)}}\right|
\end{array}
Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified99.0%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6498.8
Simplified98.8%
Applied egg-rr56.8%
Final simplification56.8%
(FPCore (eh ew t)
:precision binary64
(fabs
(+
(* ew (cos t))
(*
(sin t)
(/
(* eh (* t eh))
(* ew (sqrt (fma eh (/ (* eh (* t t)) (* ew ew)) 1.0))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) + (sin(t) * ((eh * (t * eh)) / (ew * sqrt(fma(eh, ((eh * (t * t)) / (ew * ew)), 1.0)))))));
}
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) + Float64(sin(t) * Float64(Float64(eh * Float64(t * eh)) / Float64(ew * sqrt(fma(eh, Float64(Float64(eh * Float64(t * t)) / Float64(ew * ew)), 1.0))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * N[(N[(eh * N[(t * eh), $MachinePrecision]), $MachinePrecision] / N[(ew * N[Sqrt[N[(eh * N[(N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision] / N[(ew * ew), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t + \sin t \cdot \frac{eh \cdot \left(t \cdot eh\right)}{ew \cdot \sqrt{\mathsf{fma}\left(eh, \frac{eh \cdot \left(t \cdot t\right)}{ew \cdot ew}, 1\right)}}\right|
\end{array}
Initial program 99.8%
lift-tan.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
+-lft-identityN/A
+-lft-identityN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified99.0%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6498.8
Simplified98.8%
Applied egg-rr54.8%
Final simplification54.8%
herbie shell --seed 2024215
(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)))))))