
(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 (* ew (tan t)))))) (fabs (+ (* (sin t_1) (* (cos t) eh)) (* (* (sin t) ew) (cos t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * tan(t))));
return fabs(((sin(t_1) * (cos(t) * eh)) + ((sin(t) * ew) * cos(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(((sin(t_1) * (cos(t) * eh)) + ((sin(t) * ew) * cos(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(((Math.sin(t_1) * (Math.cos(t) * eh)) + ((Math.sin(t) * ew) * Math.cos(t_1))));
}
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.sin(t) * ew) * math.cos(t_1))))
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(Float64(sin(t) * ew) * cos(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan((eh / (ew * tan(t)))); tmp = abs(((sin(t_1) * (cos(t) * eh)) + ((sin(t) * ew) * cos(t_1)))); 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[(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{eh}{ew \cdot \tan t}\right)\\
\left|\sin t\_1 \cdot \left(\cos t \cdot eh\right) + \left(\sin t \cdot ew\right) \cdot \cos t\_1\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 (* ew (tan t))))
(fabs
(+
(/ (* (sin t) ew) (sqrt (+ 1.0 (pow (/ t_1 eh) -2.0))))
(* (sin (atan (/ eh t_1))) (* (cos t) eh))))))
double code(double eh, double ew, double t) {
double t_1 = ew * tan(t);
return fabs((((sin(t) * ew) / sqrt((1.0 + pow((t_1 / eh), -2.0)))) + (sin(atan((eh / 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 = ew * tan(t)
code = abs((((sin(t) * ew) / sqrt((1.0d0 + ((t_1 / eh) ** (-2.0d0))))) + (sin(atan((eh / t_1))) * (cos(t) * eh))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.tan(t);
return Math.abs((((Math.sin(t) * ew) / Math.sqrt((1.0 + Math.pow((t_1 / eh), -2.0)))) + (Math.sin(Math.atan((eh / t_1))) * (Math.cos(t) * eh))));
}
def code(eh, ew, t): t_1 = ew * math.tan(t) return math.fabs((((math.sin(t) * ew) / math.sqrt((1.0 + math.pow((t_1 / eh), -2.0)))) + (math.sin(math.atan((eh / t_1))) * (math.cos(t) * eh))))
function code(eh, ew, t) t_1 = Float64(ew * tan(t)) return abs(Float64(Float64(Float64(sin(t) * ew) / sqrt(Float64(1.0 + (Float64(t_1 / eh) ^ -2.0)))) + Float64(sin(atan(Float64(eh / t_1))) * Float64(cos(t) * eh)))) end
function tmp = code(eh, ew, t) t_1 = ew * tan(t); tmp = abs((((sin(t) * ew) / sqrt((1.0 + ((t_1 / eh) ^ -2.0)))) + (sin(atan((eh / t_1))) * (cos(t) * eh)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(t$95$1 / eh), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(eh / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \tan t\\
\left|\frac{\sin t \cdot ew}{\sqrt{1 + {\left(\frac{t\_1}{eh}\right)}^{-2}}} + \sin \tan^{-1} \left(\frac{eh}{t\_1}\right) \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-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-sqrt.f64N/A
Applied rewrites99.8%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (cos (atan (/ eh (* ew t)))) (sin t)) ew (* (* (cos t) eh) (sin (atan (/ (/ eh (tan t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(fma((cos(atan((eh / (ew * t)))) * sin(t)), ew, ((cos(t) * eh) * sin(atan(((eh / tan(t)) / ew))))));
}
function code(eh, ew, t) return abs(fma(Float64(cos(atan(Float64(eh / Float64(ew * t)))) * sin(t)), ew, Float64(Float64(cos(t) * eh) * sin(atan(Float64(Float64(eh / tan(t)) / ew)))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \sin t, ew, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\right)\right|
\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%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6498.7
Applied rewrites98.7%
Final simplification98.7%
(FPCore (eh ew t) :precision binary64 (fabs (fma (/ ew (sqrt (+ (pow (/ eh (* ew t)) 2.0) 1.0))) (sin t) (* (* (cos t) eh) (sin (atan (/ (/ eh (tan t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(fma((ew / sqrt((pow((eh / (ew * t)), 2.0) + 1.0))), sin(t), ((cos(t) * eh) * sin(atan(((eh / tan(t)) / ew))))));
}
function code(eh, ew, t) return abs(fma(Float64(ew / sqrt(Float64((Float64(eh / Float64(ew * t)) ^ 2.0) + 1.0))), sin(t), Float64(Float64(cos(t) * eh) * sin(atan(Float64(Float64(eh / tan(t)) / ew)))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[Sqrt[N[(N[Power[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[t], $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\frac{ew}{\sqrt{{\left(\frac{eh}{ew \cdot t}\right)}^{2} + 1}}, \sin t, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6498.7
Applied rewrites98.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
Applied rewrites98.7%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6498.7
lift-*.f64N/A
*-commutativeN/A
Applied rewrites98.7%
Final simplification98.7%
(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-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-sqrt.f64N/A
Applied rewrites99.8%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6497.9
Applied rewrites97.9%
Final simplification97.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) ew))))
(if (<= ew -6.1e+134)
t_1
(if (<= ew 2.9e+77)
(fabs
(*
(sin
(atan
(*
(/ eh (sin t))
(fma
(fma
(*
(fma
(/ (* t t) ew)
-0.001388888888888889
(/ 0.041666666666666664 ew))
t)
t
(/ -0.5 ew))
(* t t)
(/ 1.0 ew)))))
(* (cos t) eh)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (ew <= -6.1e+134) {
tmp = t_1;
} else if (ew <= 2.9e+77) {
tmp = fabs((sin(atan(((eh / sin(t)) * fma(fma((fma(((t * t) / ew), -0.001388888888888889, (0.041666666666666664 / ew)) * t), t, (-0.5 / ew)), (t * t), (1.0 / ew))))) * (cos(t) * eh)));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (ew <= -6.1e+134) tmp = t_1; elseif (ew <= 2.9e+77) tmp = abs(Float64(sin(atan(Float64(Float64(eh / sin(t)) * fma(fma(Float64(fma(Float64(Float64(t * t) / ew), -0.001388888888888889, Float64(0.041666666666666664 / ew)) * t), t, Float64(-0.5 / ew)), Float64(t * t), Float64(1.0 / ew))))) * Float64(cos(t) * eh))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -6.1e+134], t$95$1, If[LessEqual[ew, 2.9e+77], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision] * -0.001388888888888889 + N[(0.041666666666666664 / ew), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * t + N[(-0.5 / ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(1.0 / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;ew \leq -6.1 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 2.9 \cdot 10^{+77}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{eh}{\sin t} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{t \cdot t}{ew}, -0.001388888888888889, \frac{0.041666666666666664}{ew}\right) \cdot t, t, \frac{-0.5}{ew}\right), t \cdot t, \frac{1}{ew}\right)\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -6.09999999999999978e134 or 2.9000000000000002e77 < ew Initial 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-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-sqrt.f64N/A
Applied rewrites99.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6476.0
Applied rewrites76.0%
if -6.09999999999999978e134 < ew < 2.9000000000000002e77Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/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.f6478.4
Applied rewrites78.4%
Taylor expanded in t around 0
Applied rewrites78.6%
Final simplification77.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) ew))) (t_2 (* (cos t) eh)))
(if (<= ew -6.1e+134)
t_1
(if (<= ew -9e-164)
(fabs
(*
(sin
(atan
(/ (fma (* (* -0.3333333333333333 (/ eh ew)) t) t (/ eh ew)) t)))
t_2))
(if (<= ew 3.5e+24) (fabs (* (sin (atan (/ eh (* ew t)))) t_2)) t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double t_2 = cos(t) * eh;
double tmp;
if (ew <= -6.1e+134) {
tmp = t_1;
} else if (ew <= -9e-164) {
tmp = fabs((sin(atan((fma(((-0.3333333333333333 * (eh / ew)) * t), t, (eh / ew)) / t))) * t_2));
} else if (ew <= 3.5e+24) {
tmp = fabs((sin(atan((eh / (ew * t)))) * t_2));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) t_2 = Float64(cos(t) * eh) tmp = 0.0 if (ew <= -6.1e+134) tmp = t_1; elseif (ew <= -9e-164) tmp = abs(Float64(sin(atan(Float64(fma(Float64(Float64(-0.3333333333333333 * Float64(eh / ew)) * t), t, Float64(eh / ew)) / t))) * t_2)); elseif (ew <= 3.5e+24) tmp = abs(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * t_2)); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, If[LessEqual[ew, -6.1e+134], t$95$1, If[LessEqual[ew, -9e-164], 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$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 3.5e+24], N[Abs[N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision]], $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
t_2 := \cos t \cdot eh\\
\mathbf{if}\;ew \leq -6.1 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq -9 \cdot 10^{-164}:\\
\;\;\;\;\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\_2\right|\\
\mathbf{elif}\;ew \leq 3.5 \cdot 10^{+24}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot t\_2\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -6.09999999999999978e134 or 3.5000000000000002e24 < ew Initial 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-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-sqrt.f64N/A
Applied rewrites99.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6472.4
Applied rewrites72.4%
if -6.09999999999999978e134 < ew < -8.9999999999999995e-164Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/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.f6476.1
Applied rewrites76.1%
Taylor expanded in t around 0
Applied rewrites66.7%
if -8.9999999999999995e-164 < ew < 3.5000000000000002e24Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/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.f6483.3
Applied rewrites83.3%
Taylor expanded in t around 0
Applied rewrites74.7%
Final simplification71.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) ew))))
(if (<= ew -4.7e+64)
t_1
(if (<= ew 3.5e+24)
(fabs (* (sin (atan (/ eh (* ew t)))) (* (cos t) eh)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (ew <= -4.7e+64) {
tmp = t_1;
} else if (ew <= 3.5e+24) {
tmp = fabs((sin(atan((eh / (ew * t)))) * (cos(t) * 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 (ew <= (-4.7d+64)) then
tmp = t_1
else if (ew <= 3.5d+24) then
tmp = abs((sin(atan((eh / (ew * t)))) * (cos(t) * 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 (ew <= -4.7e+64) {
tmp = t_1;
} else if (ew <= 3.5e+24) {
tmp = Math.abs((Math.sin(Math.atan((eh / (ew * t)))) * (Math.cos(t) * eh)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(t) * ew)) tmp = 0 if ew <= -4.7e+64: tmp = t_1 elif ew <= 3.5e+24: tmp = math.fabs((math.sin(math.atan((eh / (ew * t)))) * (math.cos(t) * eh))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (ew <= -4.7e+64) tmp = t_1; elseif (ew <= 3.5e+24) tmp = abs(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * Float64(cos(t) * 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 (ew <= -4.7e+64) tmp = t_1; elseif (ew <= 3.5e+24) tmp = abs((sin(atan((eh / (ew * t)))) * (cos(t) * 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[ew, -4.7e+64], t$95$1, If[LessEqual[ew, 3.5e+24], 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], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;ew \leq -4.7 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 3.5 \cdot 10^{+24}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -4.70000000000000029e64 or 3.5000000000000002e24 < ew Initial 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-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-sqrt.f64N/A
Applied rewrites99.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6469.2
Applied rewrites69.2%
if -4.70000000000000029e64 < ew < 3.5000000000000002e24Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/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.f6482.6
Applied rewrites82.6%
Taylor expanded in t around 0
Applied rewrites69.3%
Final simplification69.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin t) ew)))) (if (<= t -9.8e-30) t_1 (if (<= t 1.42e-24) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (t <= -9.8e-30) {
tmp = t_1;
} else if (t <= 1.42e-24) {
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 <= (-9.8d-30)) then
tmp = t_1
else if (t <= 1.42d-24) 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 <= -9.8e-30) {
tmp = t_1;
} else if (t <= 1.42e-24) {
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 <= -9.8e-30: tmp = t_1 elif t <= 1.42e-24: 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 <= -9.8e-30) tmp = t_1; elseif (t <= 1.42e-24) 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 <= -9.8e-30) tmp = t_1; elseif (t <= 1.42e-24) 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, -9.8e-30], t$95$1, If[LessEqual[t, 1.42e-24], 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 -9.8 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.42 \cdot 10^{-24}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.79999999999999942e-30 or 1.42e-24 < 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-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-sqrt.f64N/A
Applied rewrites99.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6457.8
Applied rewrites57.8%
if -9.79999999999999942e-30 < t < 1.42e-24Initial 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.f6477.0
Applied rewrites77.0%
Taylor expanded in t around 0
Applied rewrites77.0%
Applied rewrites17.9%
Taylor expanded in eh around -inf
Applied rewrites77.3%
(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.f6445.0
Applied rewrites45.0%
Taylor expanded in t around 0
Applied rewrites42.6%
Applied rewrites12.2%
Taylor expanded in eh around -inf
Applied rewrites45.5%
herbie shell --seed 2024277
(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))))))))