
(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 13 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 (atan (/ (/ eh (tan t)) ew))) (cos t))
eh
(*
(pow (sqrt (+ (pow (/ eh (* (tan t) ew)) 2.0) 1.0)) -1.0)
(* (sin t) ew)))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(atan(((eh / tan(t)) / ew))) * cos(t)), eh, (pow(sqrt((pow((eh / (tan(t) * ew)), 2.0) + 1.0)), -1.0) * (sin(t) * ew))));
}
function code(eh, ew, t) return abs(fma(Float64(sin(atan(Float64(Float64(eh / tan(t)) / ew))) * cos(t)), eh, Float64((sqrt(Float64((Float64(eh / Float64(tan(t) * ew)) ^ 2.0) + 1.0)) ^ -1.0) * Float64(sin(t) * ew)))) 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[Power[N[Sqrt[N[(N[Power[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * ew), $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(\sqrt{{\left(\frac{eh}{\tan t \cdot ew}\right)}^{2} + 1}\right)}^{-1} \cdot \left(\sin t \cdot ew\right)\right)\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/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-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-tan.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) t)) (t_2 (atan (/ (/ eh ew) (tan t)))))
(if (<=
(fabs (+ (* (* eh (cos t)) (sin t_2)) (* (* ew (sin t)) (cos t_2))))
1e-51)
(fabs (* (/ t_1 (sqrt (+ (pow t_1 2.0) 1.0))) eh))
(fabs (* (sin (atan (* (/ (* t eh) ew) -0.3333333333333333))) eh)))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / t;
double t_2 = atan(((eh / ew) / tan(t)));
double tmp;
if (fabs((((eh * cos(t)) * sin(t_2)) + ((ew * sin(t)) * cos(t_2)))) <= 1e-51) {
tmp = fabs(((t_1 / sqrt((pow(t_1, 2.0) + 1.0))) * eh));
} else {
tmp = fabs((sin(atan((((t * eh) / ew) * -0.3333333333333333))) * eh));
}
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) :: t_2
real(8) :: tmp
t_1 = (eh / ew) / t
t_2 = atan(((eh / ew) / tan(t)))
if (abs((((eh * cos(t)) * sin(t_2)) + ((ew * sin(t)) * cos(t_2)))) <= 1d-51) then
tmp = abs(((t_1 / sqrt(((t_1 ** 2.0d0) + 1.0d0))) * eh))
else
tmp = abs((sin(atan((((t * eh) / ew) * (-0.3333333333333333d0)))) * eh))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / t;
double t_2 = Math.atan(((eh / ew) / Math.tan(t)));
double tmp;
if (Math.abs((((eh * Math.cos(t)) * Math.sin(t_2)) + ((ew * Math.sin(t)) * Math.cos(t_2)))) <= 1e-51) {
tmp = Math.abs(((t_1 / Math.sqrt((Math.pow(t_1, 2.0) + 1.0))) * eh));
} else {
tmp = Math.abs((Math.sin(Math.atan((((t * eh) / ew) * -0.3333333333333333))) * eh));
}
return tmp;
}
def code(eh, ew, t): t_1 = (eh / ew) / t t_2 = math.atan(((eh / ew) / math.tan(t))) tmp = 0 if math.fabs((((eh * math.cos(t)) * math.sin(t_2)) + ((ew * math.sin(t)) * math.cos(t_2)))) <= 1e-51: tmp = math.fabs(((t_1 / math.sqrt((math.pow(t_1, 2.0) + 1.0))) * eh)) else: tmp = math.fabs((math.sin(math.atan((((t * eh) / ew) * -0.3333333333333333))) * eh)) return tmp
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / t) t_2 = atan(Float64(Float64(eh / ew) / tan(t))) tmp = 0.0 if (abs(Float64(Float64(Float64(eh * cos(t)) * sin(t_2)) + Float64(Float64(ew * sin(t)) * cos(t_2)))) <= 1e-51) tmp = abs(Float64(Float64(t_1 / sqrt(Float64((t_1 ^ 2.0) + 1.0))) * eh)); else tmp = abs(Float64(sin(atan(Float64(Float64(Float64(t * eh) / ew) * -0.3333333333333333))) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = (eh / ew) / t; t_2 = atan(((eh / ew) / tan(t))); tmp = 0.0; if (abs((((eh * cos(t)) * sin(t_2)) + ((ew * sin(t)) * cos(t_2)))) <= 1e-51) tmp = abs(((t_1 / sqrt(((t_1 ^ 2.0) + 1.0))) * eh)); else tmp = abs((sin(atan((((t * eh) / ew) * -0.3333333333333333))) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1e-51], N[Abs[N[(N[(t$95$1 / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{t}\\
t_2 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;\left|\left(eh \cdot \cos t\right) \cdot \sin t\_2 + \left(ew \cdot \sin t\right) \cdot \cos t\_2\right| \leq 10^{-51}:\\
\;\;\;\;\left|\frac{t\_1}{\sqrt{{t\_1}^{2} + 1}} \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{t \cdot eh}{ew} \cdot -0.3333333333333333\right) \cdot eh\right|\\
\end{array}
\end{array}
if (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))) < 1e-51Initial 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.f6442.3
Applied rewrites42.3%
Taylor expanded in t around 0
Applied rewrites42.5%
Taylor expanded in t around 0
Applied rewrites41.0%
Applied rewrites29.3%
if 1e-51 < (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))) 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.f6442.6
Applied rewrites42.6%
Taylor expanded in t around 0
Applied rewrites28.9%
Taylor expanded in t around 0
Applied rewrites41.0%
Taylor expanded in t around inf
Applied rewrites28.2%
Final simplification28.5%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (/ (* (sin t) ew) (sqrt (+ (pow (/ eh (* ew t)) 2.0) 1.0))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((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((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((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((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + ((Math.sin(t) * ew) / Math.sqrt((Math.pow((eh / (ew * t)), 2.0) + 1.0)))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + ((math.sin(t) * ew) / math.sqrt((math.pow((eh / (ew * t)), 2.0) + 1.0)))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + 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((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((sin(t) * ew) / sqrt((((eh / (ew * t)) ^ 2.0) + 1.0))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $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|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{\sin t \cdot ew}{\sqrt{{\left(\frac{eh}{ew \cdot t}\right)}^{2} + 1}}\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
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 rewrites99.1%
Final simplification99.1%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -680000000.0) (not (<= ew 0.00036)))
(fabs (* (cos (atan (* (/ (/ eh (sin t)) ew) (cos t)))) (* (sin t) ew)))
(fabs
(*
(* (cos t) eh)
(sin
(atan
(*
(/ (cos t) ew)
(/ (fma 0.16666666666666666 (* (* t t) eh) eh) t))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -680000000.0) || !(ew <= 0.00036)) {
tmp = fabs((cos(atan((((eh / sin(t)) / ew) * cos(t)))) * (sin(t) * ew)));
} else {
tmp = fabs(((cos(t) * eh) * sin(atan(((cos(t) / ew) * (fma(0.16666666666666666, ((t * t) * eh), eh) / t))))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((ew <= -680000000.0) || !(ew <= 0.00036)) tmp = abs(Float64(cos(atan(Float64(Float64(Float64(eh / sin(t)) / ew) * cos(t)))) * Float64(sin(t) * ew))); else tmp = abs(Float64(Float64(cos(t) * eh) * sin(atan(Float64(Float64(cos(t) / ew) * Float64(fma(0.16666666666666666, Float64(Float64(t * t) * eh), eh) / t)))))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -680000000.0], N[Not[LessEqual[ew, 0.00036]], $MachinePrecision]], N[Abs[N[(N[Cos[N[ArcTan[N[(N[(N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(N[(0.16666666666666666 * N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] + eh), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -680000000 \lor \neg \left(ew \leq 0.00036\right):\\
\;\;\;\;\left|\cos \tan^{-1} \left(\frac{\frac{eh}{\sin t}}{ew} \cdot \cos t\right) \cdot \left(\sin t \cdot ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{\mathsf{fma}\left(0.16666666666666666, \left(t \cdot t\right) \cdot eh, eh\right)}{t}\right)\right|\\
\end{array}
\end{array}
if ew < -6.8e8 or 3.60000000000000023e-4 < ew Initial program 99.8%
Taylor expanded in eh around 0
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.2%
if -6.8e8 < ew < 3.60000000000000023e-4Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around inf
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.1
Applied rewrites83.1%
Taylor expanded in t around 0
Applied rewrites83.2%
Final simplification79.0%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (sin (atan (/ (/ eh (tan t)) ew))) (cos t)) eh (* (sin t) ew))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(atan(((eh / tan(t)) / ew))) * cos(t)), eh, (sin(t) * ew)));
}
function code(eh, ew, t) return abs(fma(Float64(sin(atan(Float64(Float64(eh / tan(t)) / ew))) * cos(t)), eh, Float64(sin(t) * ew))) 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[Sin[t], $MachinePrecision] * ew), $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, \sin t \cdot ew\right)\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/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-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6498.8
Applied rewrites98.8%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(* (cos t) eh)
(sin
(atan
(* (/ (cos t) ew) (/ (fma 0.16666666666666666 (* (* t t) eh) eh) t)))))))
double code(double eh, double ew, double t) {
return fabs(((cos(t) * eh) * sin(atan(((cos(t) / ew) * (fma(0.16666666666666666, ((t * t) * eh), eh) / t))))));
}
function code(eh, ew, t) return abs(Float64(Float64(cos(t) * eh) * sin(atan(Float64(Float64(cos(t) / ew) * Float64(fma(0.16666666666666666, Float64(Float64(t * t) * eh), eh) / t)))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(N[(0.16666666666666666 * N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] + eh), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{\mathsf{fma}\left(0.16666666666666666, \left(t \cdot t\right) \cdot eh, eh\right)}{t}\right)\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around inf
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.f6460.6
Applied rewrites60.6%
Taylor expanded in t around 0
Applied rewrites60.8%
Final simplification60.8%
(FPCore (eh ew t) :precision binary64 (fabs (* (* (sin (atan (/ (/ eh ew) (tan t)))) (cos t)) eh)))
double code(double eh, double ew, double t) {
return fabs(((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(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(Math.atan(((eh / ew) / Math.tan(t)))) * Math.cos(t)) * eh));
}
def code(eh, ew, t): return math.fabs(((math.sin(math.atan(((eh / ew) / math.tan(t)))) * math.cos(t)) * eh))
function code(eh, ew, t) return abs(Float64(Float64(sin(atan(Float64(Float64(eh / ew) / tan(t)))) * cos(t)) * eh)) end
function tmp = code(eh, ew, t) tmp = abs(((sin(atan(((eh / ew) / tan(t)))) * cos(t)) * eh)); 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[Cos[t], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \cos t\right) \cdot eh\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around inf
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.f6460.6
Applied rewrites60.6%
Applied rewrites60.6%
Final simplification60.6%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(sin
(atan (/ (* (fma (/ (* t t) ew) -0.3333333333333333 (pow ew -1.0)) eh) t)))
eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((fma(((t * t) / ew), -0.3333333333333333, pow(ew, -1.0)) * eh) / t))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(fma(Float64(Float64(t * t) / ew), -0.3333333333333333, (ew ^ -1.0)) * eh) / t))) * eh)) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision] * -0.3333333333333333 + N[Power[ew, -1.0], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{t \cdot t}{ew}, -0.3333333333333333, {ew}^{-1}\right) \cdot eh}{t}\right) \cdot 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.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
Applied rewrites32.8%
Taylor expanded in t around 0
Applied rewrites41.0%
Taylor expanded in eh around 0
Applied rewrites42.7%
Final simplification42.7%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(sin
(atan
(/
(/
(fma
(fma
(-
(fma
(fma
(* eh 0.022222222222222223)
-0.3333333333333333
(* eh 0.009523809523809525))
(* t t)
(* eh 0.022222222222222223)))
(* t t)
(* -0.3333333333333333 eh))
(* t t)
eh)
t)
ew)))
eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((fma(fma(-fma(fma((eh * 0.022222222222222223), -0.3333333333333333, (eh * 0.009523809523809525)), (t * t), (eh * 0.022222222222222223)), (t * t), (-0.3333333333333333 * eh)), (t * t), eh) / t) / ew))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(fma(fma(Float64(-fma(fma(Float64(eh * 0.022222222222222223), -0.3333333333333333, Float64(eh * 0.009523809523809525)), Float64(t * t), Float64(eh * 0.022222222222222223))), Float64(t * t), Float64(-0.3333333333333333 * eh)), Float64(t * t), eh) / t) / ew))) * eh)) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[((-N[(N[(N[(eh * 0.022222222222222223), $MachinePrecision] * -0.3333333333333333 + N[(eh * 0.009523809523809525), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(eh * 0.022222222222222223), $MachinePrecision]), $MachinePrecision]) * N[(t * t), $MachinePrecision] + N[(-0.3333333333333333 * eh), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + eh), $MachinePrecision] / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-\mathsf{fma}\left(\mathsf{fma}\left(eh \cdot 0.022222222222222223, -0.3333333333333333, eh \cdot 0.009523809523809525\right), t \cdot t, eh \cdot 0.022222222222222223\right), t \cdot t, -0.3333333333333333 \cdot eh\right), t \cdot t, eh\right)}{t}}{ew}\right) \cdot 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.f6442.5
Applied rewrites42.5%
Applied rewrites42.5%
Taylor expanded in t around 0
Applied rewrites42.7%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(sin
(atan
(/
(/
(fma
(fma (* eh -0.022222222222222223) (* t t) (* -0.3333333333333333 eh))
(* t t)
eh)
t)
ew)))
eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((fma(fma((eh * -0.022222222222222223), (t * t), (-0.3333333333333333 * eh)), (t * t), eh) / t) / ew))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(fma(fma(Float64(eh * -0.022222222222222223), Float64(t * t), Float64(-0.3333333333333333 * eh)), Float64(t * t), eh) / t) / ew))) * eh)) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(eh * -0.022222222222222223), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(-0.3333333333333333 * eh), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + eh), $MachinePrecision] / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(eh \cdot -0.022222222222222223, t \cdot t, -0.3333333333333333 \cdot eh\right), t \cdot t, eh\right)}{t}}{ew}\right) \cdot 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.f6442.5
Applied rewrites42.5%
Applied rewrites42.5%
Taylor expanded in t around 0
Applied rewrites42.7%
(FPCore (eh ew t) :precision binary64 (fabs (* (sin (atan (/ (/ (* eh (fma (* 0.3333333333333333 t) t -1.0)) (- ew)) t))) eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan((((eh * fma((0.3333333333333333 * t), t, -1.0)) / -ew) / t))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(Float64(eh * fma(Float64(0.3333333333333333 * t), t, -1.0)) / Float64(-ew)) / t))) * eh)) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(eh * N[(N[(0.3333333333333333 * t), $MachinePrecision] * t + -1.0), $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{eh \cdot \mathsf{fma}\left(0.3333333333333333 \cdot t, t, -1\right)}{-ew}}{t}\right) \cdot 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.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
Applied rewrites32.8%
Taylor expanded in ew around -inf
Applied rewrites42.7%
(FPCore (eh ew t) :precision binary64 (fabs (* (sin (atan (/ (/ eh ew) t))) eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((eh / ew) / 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(atan(((eh / ew) / t))) * eh))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.sin(Math.atan(((eh / ew) / t))) * eh));
}
def code(eh, ew, t): return math.fabs((math.sin(math.atan(((eh / ew) / t))) * eh))
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(eh / ew) / t))) * eh)) end
function tmp = code(eh, ew, t) tmp = abs((sin(atan(((eh / ew) / t))) * eh)); end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) \cdot 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.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
Applied rewrites32.8%
Taylor expanded in t around 0
Applied rewrites41.0%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (/ (/ eh ew) t))) (fabs (* (/ t_1 (sqrt (+ (pow t_1 2.0) 1.0))) eh))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / t;
return fabs(((t_1 / sqrt((pow(t_1, 2.0) + 1.0))) * 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) / t
code = abs(((t_1 / sqrt(((t_1 ** 2.0d0) + 1.0d0))) * eh))
end function
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / t;
return Math.abs(((t_1 / Math.sqrt((Math.pow(t_1, 2.0) + 1.0))) * eh));
}
def code(eh, ew, t): t_1 = (eh / ew) / t return math.fabs(((t_1 / math.sqrt((math.pow(t_1, 2.0) + 1.0))) * eh))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / t) return abs(Float64(Float64(t_1 / sqrt(Float64((t_1 ^ 2.0) + 1.0))) * eh)) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / t; tmp = abs(((t_1 / sqrt(((t_1 ^ 2.0) + 1.0))) * eh)); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]}, N[Abs[N[(N[(t$95$1 / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{t}\\
\left|\frac{t\_1}{\sqrt{{t\_1}^{2} + 1}} \cdot eh\right|
\end{array}
\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.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
Applied rewrites32.8%
Taylor expanded in t around 0
Applied rewrites41.0%
Applied rewrites15.0%
herbie shell --seed 2024309
(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))))))))