
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(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 / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos 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 ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(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 / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos 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 (* (sin t) (cos t_1)) ew (* (* (cos t) eh) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / tan(t)) / ew));
return fabs(fma((sin(t) * cos(t_1)), ew, ((cos(t) * eh) * sin(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / tan(t)) / ew)) return abs(fma(Float64(sin(t) * cos(t_1)), ew, Float64(Float64(cos(t) * eh) * 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[Sin[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Cos[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{\frac{eh}{\tan t}}{ew}\right)\\
\left|\mathsf{fma}\left(\sin t \cdot \cos t\_1, ew, \left(\cos t \cdot eh\right) \cdot \sin t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh (tan t)) ew)))) (fabs (fma (* (cos t) eh) (sin t_1) (* (* (sin t) ew) (cos t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / tan(t)) / ew));
return fabs(fma((cos(t) * eh), sin(t_1), ((sin(t) * ew) * cos(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / tan(t)) / ew)) return abs(fma(Float64(cos(t) * eh), sin(t_1), Float64(Float64(sin(t) * ew) * cos(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[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\\
\left|\mathsf{fma}\left(\cos t \cdot eh, \sin t\_1, \left(\sin t \cdot ew\right) \cdot \cos t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ eh (* ew (tan t)))))) (fabs (+ (* (sin t_1) (* (cos t) eh)) (* (cos t_1) (* (sin t) ew))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * tan(t))));
return fabs(((sin(t_1) * (cos(t) * eh)) + (cos(t_1) * (sin(t) * ew))));
}
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 / (ew * tan(t))))
code = abs(((sin(t_1) * (cos(t) * eh)) + (cos(t_1) * (sin(t) * ew))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan((eh / (ew * Math.tan(t))));
return Math.abs(((Math.sin(t_1) * (Math.cos(t) * eh)) + (Math.cos(t_1) * (Math.sin(t) * ew))));
}
def code(eh, ew, t): t_1 = math.atan((eh / (ew * math.tan(t)))) return math.fabs(((math.sin(t_1) * (math.cos(t) * eh)) + (math.cos(t_1) * (math.sin(t) * ew))))
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * tan(t)))) return abs(Float64(Float64(sin(t_1) * Float64(cos(t) * eh)) + Float64(cos(t_1) * Float64(sin(t) * ew)))) end
function tmp = code(eh, ew, t) t_1 = atan((eh / (ew * tan(t)))); tmp = abs(((sin(t_1) * (cos(t) * eh)) + (cos(t_1) * (sin(t) * ew)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[Sin[t$95$1], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[Cos[t$95$1], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\sin t\_1 \cdot \left(\cos t \cdot eh\right) + \cos t\_1 \cdot \left(\sin t \cdot ew\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* ew (tan t)))))
(fabs
(+
(/ (* (sin t) ew) (sqrt (+ 1.0 (pow t_1 2.0))))
(* (sin (atan t_1)) (* (cos t) eh))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (ew * tan(t));
return fabs((((sin(t) * ew) / sqrt((1.0 + pow(t_1, 2.0)))) + (sin(atan(t_1)) * (cos(t) * eh))));
}
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 = eh / (ew * tan(t))
code = abs((((sin(t) * ew) / sqrt((1.0d0 + (t_1 ** 2.0d0)))) + (sin(atan(t_1)) * (cos(t) * eh))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh / (ew * Math.tan(t));
return Math.abs((((Math.sin(t) * ew) / Math.sqrt((1.0 + Math.pow(t_1, 2.0)))) + (Math.sin(Math.atan(t_1)) * (Math.cos(t) * eh))));
}
def code(eh, ew, t): t_1 = eh / (ew * math.tan(t)) return math.fabs((((math.sin(t) * ew) / math.sqrt((1.0 + math.pow(t_1, 2.0)))) + (math.sin(math.atan(t_1)) * (math.cos(t) * eh))))
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * tan(t))) return abs(Float64(Float64(Float64(sin(t) * ew) / sqrt(Float64(1.0 + (t_1 ^ 2.0)))) + Float64(sin(atan(t_1)) * Float64(cos(t) * eh)))) end
function tmp = code(eh, ew, t) t_1 = eh / (ew * tan(t)); tmp = abs((((sin(t) * ew) / sqrt((1.0 + (t_1 ^ 2.0)))) + (sin(atan(t_1)) * (cos(t) * eh)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot \tan t}\\
\left|\frac{\sin t \cdot ew}{\sqrt{1 + {t\_1}^{2}}} + \sin \tan^{-1} t\_1 \cdot \left(\cos t \cdot eh\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (cos (atan (/ eh (* ew t)))) (* (sin t) ew)) (* (sin (atan (/ eh (* ew (tan t))))) (* (cos t) eh)))))
double code(double eh, double ew, double t) {
return fabs(((cos(atan((eh / (ew * t)))) * (sin(t) * ew)) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * 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(atan((eh / (ew * t)))) * (sin(t) * ew)) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * eh))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.cos(Math.atan((eh / (ew * t)))) * (Math.sin(t) * ew)) + (Math.sin(Math.atan((eh / (ew * Math.tan(t))))) * (Math.cos(t) * eh))));
}
def code(eh, ew, t): return math.fabs(((math.cos(math.atan((eh / (ew * t)))) * (math.sin(t) * ew)) + (math.sin(math.atan((eh / (ew * math.tan(t))))) * (math.cos(t) * eh))))
function code(eh, ew, t) return abs(Float64(Float64(cos(atan(Float64(eh / Float64(ew * t)))) * Float64(sin(t) * ew)) + Float64(sin(atan(Float64(eh / Float64(ew * tan(t))))) * Float64(cos(t) * eh)))) end
function tmp = code(eh, ew, t) tmp = abs(((cos(atan((eh / (ew * t)))) * (sin(t) * ew)) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * eh)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(\sin t \cdot ew\right) + \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \left(\cos t \cdot eh\right)\right|
\end{array}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.3
Applied rewrites99.3%
Final simplification99.3%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin t) ew) (* (sin (atan (/ eh (* ew (tan t))))) (* (cos t) eh)))))
double code(double eh, double ew, double t) {
return fabs(((sin(t) * ew) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * 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(((sin(t) * ew) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * eh))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(t) * ew) + (Math.sin(Math.atan((eh / (ew * Math.tan(t))))) * (Math.cos(t) * eh))));
}
def code(eh, ew, t): return math.fabs(((math.sin(t) * ew) + (math.sin(math.atan((eh / (ew * math.tan(t))))) * (math.cos(t) * eh))))
function code(eh, ew, t) return abs(Float64(Float64(sin(t) * ew) + Float64(sin(atan(Float64(eh / Float64(ew * tan(t))))) * Float64(cos(t) * eh)))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * ew) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * eh)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot ew + \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \left(\cos t \cdot eh\right)\right|
\end{array}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.8%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6498.4
Applied rewrites98.4%
Final simplification98.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh))
(t_2
(fabs
(*
(sin
(atan
(/ (fma (* (* -0.3333333333333333 (/ eh ew)) t) t (/ eh ew)) t)))
t_1))))
(if (<= eh -5.6e+108)
(/ 1.0 (fabs (/ (/ (/ 1.0 eh) (cos t)) (sin (atan (/ (/ eh ew) t))))))
(if (<= eh -2.5e-83)
t_2
(if (<= eh 5.3e-61)
(fabs (* (sin t) ew))
(if (<= eh 4.5e+108)
t_2
(fabs (* (sin (atan (/ eh (* ew t)))) t_1))))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = fabs((sin(atan((fma(((-0.3333333333333333 * (eh / ew)) * t), t, (eh / ew)) / t))) * t_1));
double tmp;
if (eh <= -5.6e+108) {
tmp = 1.0 / fabs((((1.0 / eh) / cos(t)) / sin(atan(((eh / ew) / t)))));
} else if (eh <= -2.5e-83) {
tmp = t_2;
} else if (eh <= 5.3e-61) {
tmp = fabs((sin(t) * ew));
} else if (eh <= 4.5e+108) {
tmp = t_2;
} else {
tmp = fabs((sin(atan((eh / (ew * t)))) * t_1));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = abs(Float64(sin(atan(Float64(fma(Float64(Float64(-0.3333333333333333 * Float64(eh / ew)) * t), t, Float64(eh / ew)) / t))) * t_1)) tmp = 0.0 if (eh <= -5.6e+108) tmp = Float64(1.0 / abs(Float64(Float64(Float64(1.0 / eh) / cos(t)) / sin(atan(Float64(Float64(eh / ew) / t)))))); elseif (eh <= -2.5e-83) tmp = t_2; elseif (eh <= 5.3e-61) tmp = abs(Float64(sin(t) * ew)); elseif (eh <= 4.5e+108) tmp = t_2; else tmp = abs(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * t_1)); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(-0.3333333333333333 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * t + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -5.6e+108], N[(1.0 / N[Abs[N[(N[(N[(1.0 / eh), $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[eh, -2.5e-83], t$95$2, If[LessEqual[eh, 5.3e-61], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 4.5e+108], t$95$2, N[Abs[N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot \frac{eh}{ew}\right) \cdot t, t, \frac{eh}{ew}\right)}{t}\right) \cdot t\_1\right|\\
\mathbf{if}\;eh \leq -5.6 \cdot 10^{+108}:\\
\;\;\;\;\frac{1}{\left|\frac{\frac{\frac{1}{eh}}{\cos t}}{\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)}\right|}\\
\mathbf{elif}\;eh \leq -2.5 \cdot 10^{-83}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 5.3 \cdot 10^{-61}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{elif}\;eh \leq 4.5 \cdot 10^{+108}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot t\_1\right|\\
\end{array}
\end{array}
if eh < -5.5999999999999996e108Initial program 99.7%
lift-fabs.f64N/A
lift-+.f64N/A
flip-+N/A
clear-numN/A
Applied rewrites99.5%
Taylor expanded in ew around 0
associate-/r*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6486.8
Applied rewrites86.8%
Taylor expanded in t around 0
Applied rewrites76.0%
if -5.5999999999999996e108 < eh < -2.5e-83 or 5.3e-61 < eh < 4.5e108Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites71.5%
Taylor expanded in t around 0
Applied rewrites71.7%
if -2.5e-83 < eh < 5.3e-61Initial program 99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6474.6
Applied rewrites74.6%
if 4.5e108 < eh Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites96.2%
Taylor expanded in t around 0
Applied rewrites86.2%
Final simplification76.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh))
(t_2
(fabs
(*
(sin
(atan
(/ (fma (* (* -0.3333333333333333 (/ eh ew)) t) t (/ eh ew)) t)))
t_1)))
(t_3 (fabs (* (sin (atan (/ eh (* ew t)))) t_1))))
(if (<= eh -5.6e+108)
t_3
(if (<= eh -2.5e-83)
t_2
(if (<= eh 5.3e-61)
(fabs (* (sin t) ew))
(if (<= eh 4.5e+108) t_2 t_3))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = fabs((sin(atan((fma(((-0.3333333333333333 * (eh / ew)) * t), t, (eh / ew)) / t))) * t_1));
double t_3 = fabs((sin(atan((eh / (ew * t)))) * t_1));
double tmp;
if (eh <= -5.6e+108) {
tmp = t_3;
} else if (eh <= -2.5e-83) {
tmp = t_2;
} else if (eh <= 5.3e-61) {
tmp = fabs((sin(t) * ew));
} else if (eh <= 4.5e+108) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = abs(Float64(sin(atan(Float64(fma(Float64(Float64(-0.3333333333333333 * Float64(eh / ew)) * t), t, Float64(eh / ew)) / t))) * t_1)) t_3 = abs(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * t_1)) tmp = 0.0 if (eh <= -5.6e+108) tmp = t_3; elseif (eh <= -2.5e-83) tmp = t_2; elseif (eh <= 5.3e-61) tmp = abs(Float64(sin(t) * ew)); elseif (eh <= 4.5e+108) tmp = t_2; else tmp = t_3; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(-0.3333333333333333 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * t + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -5.6e+108], t$95$3, If[LessEqual[eh, -2.5e-83], t$95$2, If[LessEqual[eh, 5.3e-61], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 4.5e+108], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot \frac{eh}{ew}\right) \cdot t, t, \frac{eh}{ew}\right)}{t}\right) \cdot t\_1\right|\\
t_3 := \left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot t\_1\right|\\
\mathbf{if}\;eh \leq -5.6 \cdot 10^{+108}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;eh \leq -2.5 \cdot 10^{-83}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 5.3 \cdot 10^{-61}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{elif}\;eh \leq 4.5 \cdot 10^{+108}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if eh < -5.5999999999999996e108 or 4.5e108 < eh Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites91.8%
Taylor expanded in t around 0
Applied rewrites81.2%
if -5.5999999999999996e108 < eh < -2.5e-83 or 5.3e-61 < eh < 4.5e108Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites71.5%
Taylor expanded in t around 0
Applied rewrites71.7%
if -2.5e-83 < eh < 5.3e-61Initial program 99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6474.6
Applied rewrites74.6%
Final simplification76.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin (atan (/ eh (* ew t)))) (* (cos t) eh))))) (if (<= eh -2.9e-83) t_1 (if (<= eh 5.3e-61) (fabs (* (sin t) ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(atan((eh / (ew * t)))) * (cos(t) * eh)));
double tmp;
if (eh <= -2.9e-83) {
tmp = t_1;
} else if (eh <= 5.3e-61) {
tmp = fabs((sin(t) * ew));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = abs((sin(atan((eh / (ew * t)))) * (cos(t) * eh)))
if (eh <= (-2.9d-83)) then
tmp = t_1
else if (eh <= 5.3d-61) then
tmp = abs((sin(t) * ew))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((Math.sin(Math.atan((eh / (ew * t)))) * (Math.cos(t) * eh)));
double tmp;
if (eh <= -2.9e-83) {
tmp = t_1;
} else if (eh <= 5.3e-61) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(math.atan((eh / (ew * t)))) * (math.cos(t) * eh))) tmp = 0 if eh <= -2.9e-83: tmp = t_1 elif eh <= 5.3e-61: tmp = math.fabs((math.sin(t) * ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * Float64(cos(t) * eh))) tmp = 0.0 if (eh <= -2.9e-83) tmp = t_1; elseif (eh <= 5.3e-61) tmp = abs(Float64(sin(t) * ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((sin(atan((eh / (ew * t)))) * (cos(t) * eh))); tmp = 0.0; if (eh <= -2.9e-83) tmp = t_1; elseif (eh <= 5.3e-61) tmp = abs((sin(t) * ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -2.9e-83], t$95$1, If[LessEqual[eh, 5.3e-61], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{if}\;eh \leq -2.9 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 5.3 \cdot 10^{-61}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -2.8999999999999999e-83 or 5.3e-61 < eh Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites82.3%
Taylor expanded in t around 0
Applied rewrites70.2%
if -2.8999999999999999e-83 < eh < 5.3e-61Initial program 99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6474.6
Applied rewrites74.6%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin t) ew)))) (if (<= t -1.02e-5) t_1 (if (<= t 8.2e-32) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (t <= -1.02e-5) {
tmp = t_1;
} else if (t <= 8.2e-32) {
tmp = fabs(-eh);
} 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((sin(t) * ew))
if (t <= (-1.02d-5)) then
tmp = t_1
else if (t <= 8.2d-32) then
tmp = abs(-eh)
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((Math.sin(t) * ew));
double tmp;
if (t <= -1.02e-5) {
tmp = t_1;
} else if (t <= 8.2e-32) {
tmp = Math.abs(-eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(t) * ew)) tmp = 0 if t <= -1.02e-5: tmp = t_1 elif t <= 8.2e-32: tmp = math.fabs(-eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (t <= -1.02e-5) tmp = t_1; elseif (t <= 8.2e-32) tmp = abs(Float64(-eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((sin(t) * ew)); tmp = 0.0; if (t <= -1.02e-5) tmp = t_1; elseif (t <= 8.2e-32) tmp = abs(-eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.02e-5], t$95$1, If[LessEqual[t, 8.2e-32], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -1.02 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{-32}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.0200000000000001e-5 or 8.1999999999999995e-32 < t Initial program 99.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6452.9
Applied rewrites52.9%
if -1.0200000000000001e-5 < t < 8.1999999999999995e-32Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6481.3
Applied rewrites81.3%
Taylor expanded in t around 0
Applied rewrites81.3%
Applied rewrites21.5%
Taylor expanded in eh around -inf
Applied rewrites81.6%
(FPCore (eh ew t) :precision binary64 (fabs (- eh)))
double code(double eh, double ew, double t) {
return fabs(-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(-eh)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(-eh);
}
def code(eh, ew, t): return math.fabs(-eh)
function code(eh, ew, t) return abs(Float64(-eh)) end
function tmp = code(eh, ew, t) tmp = abs(-eh); end
code[eh_, ew_, t_] := N[Abs[(-eh)], $MachinePrecision]
\begin{array}{l}
\\
\left|-eh\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6446.4
Applied rewrites46.4%
Taylor expanded in t around 0
Applied rewrites44.7%
Applied rewrites14.2%
Taylor expanded in eh around -inf
Applied rewrites46.9%
herbie shell --seed 2024270
(FPCore (eh ew t)
:name "Example from Robby"
:precision binary64
(fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))