
(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 8 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 (* ew (sin t)) (cos t_1) (* (* (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((ew * sin(t)), cos(t_1), ((cos(t) * eh) * sin(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(tan(t) * ew))) return abs(fma(Float64(ew * sin(t)), cos(t_1), Float64(Float64(cos(t) * eh) * sin(t_1)))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision] + 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{eh}{\tan t \cdot ew}\right)\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \cos t\_1, \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
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* ew (sin t)) (/ 1.0 (sqrt (+ (pow (/ (/ eh (tan t)) ew) 2.0) 1.0))) (* (* (cos t) eh) (sin (atan (/ eh (* (tan t) ew))))))))
double code(double eh, double ew, double t) {
return fabs(fma((ew * sin(t)), (1.0 / sqrt((pow(((eh / tan(t)) / ew), 2.0) + 1.0))), ((cos(t) * eh) * sin(atan((eh / (tan(t) * ew)))))));
}
function code(eh, ew, t) return abs(fma(Float64(ew * sin(t)), Float64(1.0 / sqrt(Float64((Float64(Float64(eh / tan(t)) / ew) ^ 2.0) + 1.0))), Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(tan(t) * ew))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[Power[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\sqrt{{\left(\frac{\frac{eh}{\tan t}}{ew}\right)}^{2} + 1}}, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f6499.9
Applied rewrites99.9%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-tan.f64N/A
lift-tan.f64N/A
associate-/l/N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(fabs
(fma
(* ew (sin t))
(cos (atan (/ (/ eh (tan t)) ew)))
(*
(sin (atan (/ (/ (fma (* (* t t) eh) -0.3333333333333333 eh) t) ew)))
(* (cos t) eh)))))
double code(double eh, double ew, double t) {
return fabs(fma((ew * sin(t)), cos(atan(((eh / tan(t)) / ew))), (sin(atan(((fma(((t * t) * eh), -0.3333333333333333, eh) / t) / ew))) * (cos(t) * eh))));
}
function code(eh, ew, t) return abs(fma(Float64(ew * sin(t)), cos(atan(Float64(Float64(eh / tan(t)) / ew))), Float64(sin(atan(Float64(Float64(fma(Float64(Float64(t * t) * eh), -0.3333333333333333, eh) / t) / ew))) * Float64(cos(t) * eh)))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] * -0.3333333333333333 + eh), $MachinePrecision] / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right), \sin \tan^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{t}}{ew}\right) \cdot \left(\cos t \cdot eh\right)\right)\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.1
Applied rewrites99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* ew (sin t)) (cos (atan (/ eh (* ew t)))) (* (* (cos t) eh) (sin (atan (/ eh (* (tan t) ew))))))))
double code(double eh, double ew, double t) {
return fabs(fma((ew * sin(t)), cos(atan((eh / (ew * t)))), ((cos(t) * eh) * sin(atan((eh / (tan(t) * ew)))))));
}
function code(eh, ew, t) return abs(fma(Float64(ew * sin(t)), cos(atan(Float64(eh / Float64(ew * t)))), Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(tan(t) * ew))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right), \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.1
Applied rewrites99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ eh (* ew t))))) (fabs (+ (* (sin t_1) (* (cos t) eh)) (* (cos t_1) (* ew (sin t)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * t)));
return fabs(((sin(t_1) * (cos(t) * eh)) + (cos(t_1) * (ew * sin(t)))));
}
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 * t)))
code = abs(((sin(t_1) * (cos(t) * eh)) + (cos(t_1) * (ew * sin(t)))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan((eh / (ew * t)));
return Math.abs(((Math.sin(t_1) * (Math.cos(t) * eh)) + (Math.cos(t_1) * (ew * Math.sin(t)))));
}
def code(eh, ew, t): t_1 = math.atan((eh / (ew * t))) return math.fabs(((math.sin(t_1) * (math.cos(t) * eh)) + (math.cos(t_1) * (ew * math.sin(t)))))
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * t))) return abs(Float64(Float64(sin(t_1) * Float64(cos(t) * eh)) + Float64(cos(t_1) * Float64(ew * sin(t))))) end
function tmp = code(eh, ew, t) t_1 = atan((eh / (ew * t))); tmp = abs(((sin(t_1) * (cos(t) * eh)) + (cos(t_1) * (ew * sin(t))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $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[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
\left|\sin t\_1 \cdot \left(\cos t \cdot eh\right) + \cos t\_1 \cdot \left(ew \cdot \sin t\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6490.7
Applied rewrites90.7%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6490.8
Applied rewrites90.8%
Final simplification90.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (cos (atan (/ eh (* ew t)))) (* ew (sin t))))))
(if (<= ew -3.4e+131)
t_1
(if (<= ew 5.3e+66)
(fabs (* (sin (atan (* (/ (/ eh (sin t)) ew) (cos t)))) (* (cos t) eh)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((cos(atan((eh / (ew * t)))) * (ew * sin(t))));
double tmp;
if (ew <= -3.4e+131) {
tmp = t_1;
} else if (ew <= 5.3e+66) {
tmp = fabs((sin(atan((((eh / sin(t)) / ew) * cos(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((cos(atan((eh / (ew * t)))) * (ew * sin(t))))
if (ew <= (-3.4d+131)) then
tmp = t_1
else if (ew <= 5.3d+66) then
tmp = abs((sin(atan((((eh / sin(t)) / ew) * cos(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.cos(Math.atan((eh / (ew * t)))) * (ew * Math.sin(t))));
double tmp;
if (ew <= -3.4e+131) {
tmp = t_1;
} else if (ew <= 5.3e+66) {
tmp = Math.abs((Math.sin(Math.atan((((eh / Math.sin(t)) / ew) * Math.cos(t)))) * (Math.cos(t) * eh)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.cos(math.atan((eh / (ew * t)))) * (ew * math.sin(t)))) tmp = 0 if ew <= -3.4e+131: tmp = t_1 elif ew <= 5.3e+66: tmp = math.fabs((math.sin(math.atan((((eh / math.sin(t)) / ew) * math.cos(t)))) * (math.cos(t) * eh))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(cos(atan(Float64(eh / Float64(ew * t)))) * Float64(ew * sin(t)))) tmp = 0.0 if (ew <= -3.4e+131) tmp = t_1; elseif (ew <= 5.3e+66) tmp = abs(Float64(sin(atan(Float64(Float64(Float64(eh / sin(t)) / ew) * cos(t)))) * Float64(cos(t) * eh))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((cos(atan((eh / (ew * t)))) * (ew * sin(t)))); tmp = 0.0; if (ew <= -3.4e+131) tmp = t_1; elseif (ew <= 5.3e+66) tmp = abs((sin(atan((((eh / sin(t)) / ew) * cos(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[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.4e+131], t$95$1, If[LessEqual[ew, 5.3e+66], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * N[Cos[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|\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(ew \cdot \sin t\right)\right|\\
\mathbf{if}\;ew \leq -3.4 \cdot 10^{+131}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 5.3 \cdot 10^{+66}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{eh}{\sin t}}{ew} \cdot \cos t\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -3.39999999999999986e131 or 5.2999999999999997e66 < ew Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in ew around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.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.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6479.2
Applied rewrites79.2%
Taylor expanded in t around 0
Applied rewrites79.3%
if -3.39999999999999986e131 < ew < 5.2999999999999997e66Initial 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 rewrites79.3%
Final simplification79.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (cos (atan (/ eh (* ew t)))) (* ew (sin t)))))) (if (<= t -1.25e-83) t_1 (if (<= t 4.55e-23) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((cos(atan((eh / (ew * t)))) * (ew * sin(t))));
double tmp;
if (t <= -1.25e-83) {
tmp = t_1;
} else if (t <= 4.55e-23) {
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((cos(atan((eh / (ew * t)))) * (ew * sin(t))))
if (t <= (-1.25d-83)) then
tmp = t_1
else if (t <= 4.55d-23) 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.cos(Math.atan((eh / (ew * t)))) * (ew * Math.sin(t))));
double tmp;
if (t <= -1.25e-83) {
tmp = t_1;
} else if (t <= 4.55e-23) {
tmp = Math.abs(-eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.cos(math.atan((eh / (ew * t)))) * (ew * math.sin(t)))) tmp = 0 if t <= -1.25e-83: tmp = t_1 elif t <= 4.55e-23: tmp = math.fabs(-eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(cos(atan(Float64(eh / Float64(ew * t)))) * Float64(ew * sin(t)))) tmp = 0.0 if (t <= -1.25e-83) tmp = t_1; elseif (t <= 4.55e-23) tmp = abs(Float64(-eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((cos(atan((eh / (ew * t)))) * (ew * sin(t)))); tmp = 0.0; if (t <= -1.25e-83) tmp = t_1; elseif (t <= 4.55e-23) tmp = abs(-eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.25e-83], t$95$1, If[LessEqual[t, 4.55e-23], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(ew \cdot \sin t\right)\right|\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.55 \cdot 10^{-23}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.25e-83 or 4.55e-23 < t Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in ew around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.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.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6454.6
Applied rewrites54.6%
Taylor expanded in t around 0
Applied rewrites54.8%
if -1.25e-83 < t < 4.55e-23Initial 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.f6480.1
Applied rewrites80.1%
Taylor expanded in t around 0
Applied rewrites80.1%
Applied rewrites27.1%
Taylor expanded in eh around -inf
Applied rewrites80.3%
Final simplification66.0%
(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.f6443.3
Applied rewrites43.3%
Taylor expanded in t around 0
Applied rewrites41.9%
Applied rewrites14.9%
Taylor expanded in eh around -inf
Applied rewrites43.8%
herbie shell --seed 2024264
(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))))))))