
(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 10 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 (fabs (fma (* (sin t) (cos (atan (/ (/ eh (tan t)) ew)))) ew (* (* (cos t) eh) (sin (atan (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(t) * cos(atan(((eh / tan(t)) / ew)))), ew, ((cos(t) * eh) * sin(atan((eh / (ew * tan(t))))))));
}
function code(eh, ew, t) return abs(fma(Float64(sin(t) * cos(atan(Float64(Float64(eh / tan(t)) / ew)))), ew, Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right), ew, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|
\end{array}
Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (tan t))))
(fabs
(fma
(/ (sin t) (sqrt (+ 1.0 (pow (/ t_1 eh) -2.0))))
ew
(* (* (cos t) eh) (sin (atan (/ eh t_1))))))))
double code(double eh, double ew, double t) {
double t_1 = ew * tan(t);
return fabs(fma((sin(t) / sqrt((1.0 + pow((t_1 / eh), -2.0)))), ew, ((cos(t) * eh) * sin(atan((eh / t_1))))));
}
function code(eh, ew, t) t_1 = Float64(ew * tan(t)) return abs(fma(Float64(sin(t) / sqrt(Float64(1.0 + (Float64(t_1 / eh) ^ -2.0)))), ew, Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / t_1)))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(t$95$1 / eh), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \tan t\\
\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{1 + {\left(\frac{t\_1}{eh}\right)}^{-2}}}, ew, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t\_1}\right)\right)\right|
\end{array}
\end{array}
Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.9%
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
metadata-eval99.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (sin (atan (/ (/ eh (tan t)) ew))) (cos t)) eh (* (* (sin t) ew) (cos (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(atan(((eh / tan(t)) / ew))) * cos(t)), eh, ((sin(t) * ew) * cos(atan((eh / (ew * t)))))));
}
function code(eh, ew, t) return abs(fma(Float64(sin(atan(Float64(Float64(eh / tan(t)) / ew))) * cos(t)), eh, Float64(Float64(sin(t) * ew) * cos(atan(Float64(eh / Float64(ew * t))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right) \cdot \cos t, eh, \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\right|
\end{array}
Initial program 99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6498.7
Applied rewrites98.7%
Applied rewrites98.7%
Final simplification98.7%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin (atan (/ (/ eh ew) (tan t)))) (* (cos t) eh)) (/ (* (sin t) ew) (sqrt (+ (pow (/ eh (* ew t)) 2.0) 1.0))))))
double code(double eh, double ew, double t) {
return fabs(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((sin(t) * ew) / sqrt((pow((eh / (ew * t)), 2.0) + 1.0)))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((sin(t) * ew) / sqrt((((eh / (ew * t)) ** 2.0d0) + 1.0d0)))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(Math.atan(((eh / ew) / Math.tan(t)))) * (Math.cos(t) * eh)) + ((Math.sin(t) * ew) / Math.sqrt((Math.pow((eh / (ew * t)), 2.0) + 1.0)))));
}
def code(eh, ew, t): return math.fabs(((math.sin(math.atan(((eh / ew) / math.tan(t)))) * (math.cos(t) * eh)) + ((math.sin(t) * ew) / math.sqrt((math.pow((eh / (ew * t)), 2.0) + 1.0)))))
function code(eh, ew, t) return abs(Float64(Float64(sin(atan(Float64(Float64(eh / ew) / tan(t)))) * Float64(cos(t) * eh)) + Float64(Float64(sin(t) * ew) / sqrt(Float64((Float64(eh / Float64(ew * t)) ^ 2.0) + 1.0))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((sin(t) * ew) / sqrt((((eh / (ew * t)) ^ 2.0) + 1.0))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(N[Power[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(\cos t \cdot eh\right) + \frac{\sin t \cdot ew}{\sqrt{{\left(\frac{eh}{ew \cdot t}\right)}^{2} + 1}}\right|
\end{array}
Initial program 99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6498.7
Applied rewrites98.7%
Applied rewrites98.7%
Final simplification98.7%
(FPCore (eh ew t) :precision binary64 (fabs (fma (/ (sin t) (sqrt (+ (pow (/ eh (* ew t)) 2.0) 1.0))) ew (* (* (cos t) eh) (sin (atan (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(t) / sqrt((pow((eh / (ew * t)), 2.0) + 1.0))), ew, ((cos(t) * eh) * sin(atan((eh / (ew * tan(t))))))));
}
function code(eh, ew, t) return abs(fma(Float64(sin(t) / sqrt(Float64((Float64(eh / Float64(ew * t)) ^ 2.0) + 1.0))), ew, Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[N[(N[Power[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{{\left(\frac{eh}{ew \cdot t}\right)}^{2} + 1}}, ew, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|
\end{array}
Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6498.7
Applied rewrites98.7%
Final simplification98.7%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* (cos t) eh))) (fabs (fma t_1 (sin (atan (/ (/ t_1 ew) (sin t)))) (* (sin t) ew)))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
return fabs(fma(t_1, sin(atan(((t_1 / ew) / sin(t)))), (sin(t) * ew)));
}
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) return abs(fma(t_1, sin(atan(Float64(Float64(t_1 / ew) / sin(t)))), Float64(sin(t) * ew))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(N[(t$95$1 / ew), $MachinePrecision] / N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
\left|\mathsf{fma}\left(t\_1, \sin \tan^{-1} \left(\frac{\frac{t\_1}{ew}}{\sin t}\right), \sin t \cdot ew\right)\right|
\end{array}
\end{array}
Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.9%
Taylor expanded in eh around 0
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.9%
(FPCore (eh ew t) :precision binary64 (fabs (fma (sin t) ew (* (* (cos t) eh) (sin (atan (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs(fma(sin(t), ew, ((cos(t) * eh) * sin(atan((eh / (ew * tan(t))))))));
}
function code(eh, ew, t) return abs(fma(sin(t), ew, Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[t], $MachinePrecision] * ew + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\sin t, ew, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|
\end{array}
Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.9%
Taylor expanded in ew around inf
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 -2.8e+24)
t_1
(if (<= ew 1.8e+49)
(fabs
(fma
(/ (* (* t t) ew) eh)
ew
(* (* (cos t) eh) (sin (atan (/ eh (* ew (tan t))))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (ew <= -2.8e+24) {
tmp = t_1;
} else if (ew <= 1.8e+49) {
tmp = fabs(fma((((t * t) * ew) / eh), ew, ((cos(t) * eh) * sin(atan((eh / (ew * tan(t))))))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (ew <= -2.8e+24) tmp = t_1; elseif (ew <= 1.8e+49) tmp = abs(fma(Float64(Float64(Float64(t * t) * ew) / eh), ew, Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))); 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, -2.8e+24], t$95$1, If[LessEqual[ew, 1.8e+49], N[Abs[N[(N[(N[(N[(t * t), $MachinePrecision] * ew), $MachinePrecision] / eh), $MachinePrecision] * ew + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;ew \leq -2.8 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 1.8 \cdot 10^{+49}:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{\left(t \cdot t\right) \cdot ew}{eh}, ew, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -2.8000000000000002e24 or 1.79999999999999998e49 < ew Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.9%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6473.7
Applied rewrites73.7%
if -2.8000000000000002e24 < ew < 1.79999999999999998e49Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
Final simplification63.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin t) ew)))) (if (<= ew -4.4e+14) t_1 (if (<= ew 2.3e+55) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (ew <= -4.4e+14) {
tmp = t_1;
} else if (ew <= 2.3e+55) {
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 (ew <= (-4.4d+14)) then
tmp = t_1
else if (ew <= 2.3d+55) 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 (ew <= -4.4e+14) {
tmp = t_1;
} else if (ew <= 2.3e+55) {
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 ew <= -4.4e+14: tmp = t_1 elif ew <= 2.3e+55: 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 (ew <= -4.4e+14) tmp = t_1; elseif (ew <= 2.3e+55) 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 (ew <= -4.4e+14) tmp = t_1; elseif (ew <= 2.3e+55) 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[ew, -4.4e+14], t$95$1, If[LessEqual[ew, 2.3e+55], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;ew \leq -4.4 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 2.3 \cdot 10^{+55}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -4.4e14 or 2.29999999999999987e55 < ew Initial 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%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.9%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6472.7
Applied rewrites72.7%
if -4.4e14 < ew < 2.29999999999999987e55Initial 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.f6450.7
Applied rewrites50.7%
Taylor expanded in t around 0
Applied rewrites47.8%
Applied rewrites11.2%
Taylor expanded in eh around -inf
Applied rewrites50.9%
(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.9%
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.f6439.2
Applied rewrites39.2%
Taylor expanded in t around 0
Applied rewrites36.9%
Applied rewrites12.3%
Taylor expanded in eh around -inf
Applied rewrites39.6%
herbie shell --seed 2024249
(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))))))))