
(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 12 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 (/ eh (* (tan t) ew))))
(fabs
(fma
(/ ew (sqrt (+ 1.0 (pow t_1 2.0))))
(sin t)
(* (* (cos t) eh) (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (tan(t) * ew);
return fabs(fma((ew / sqrt((1.0 + pow(t_1, 2.0)))), sin(t), ((cos(t) * eh) * sin(atan(t_1)))));
}
function code(eh, ew, t) t_1 = Float64(eh / Float64(tan(t) * ew)) return abs(fma(Float64(ew / sqrt(Float64(1.0 + (t_1 ^ 2.0)))), sin(t), Float64(Float64(cos(t) * eh) * sin(atan(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(ew / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[t], $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{\tan t \cdot ew}\\
\left|\mathsf{fma}\left(\frac{ew}{\sqrt{1 + {t\_1}^{2}}}, \sin t, \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/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
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
pow2N/A
lower-pow.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (cos (atan (/ eh (* t ew)))) ew) (sin t) (* (* (cos t) eh) (sin (atan (/ eh (* (tan t) ew))))))))
double code(double eh, double ew, double t) {
return fabs(fma((cos(atan((eh / (t * ew)))) * ew), sin(t), ((cos(t) * eh) * sin(atan((eh / (tan(t) * ew)))))));
}
function code(eh, ew, t) return abs(fma(Float64(cos(atan(Float64(eh / Float64(t * ew)))) * ew), sin(t), Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(tan(t) * ew))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision] * N[Sin[t], $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(\cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) \cdot ew, \sin t, \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
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/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%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.4
Applied rewrites99.4%
Final simplification99.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh))
(t_2 (atan (/ eh (* t ew))))
(t_3 (fabs (+ (* (sin t_2) t_1) (* (* (sin t) ew) (cos t_2))))))
(if (<= ew -1.12e-125)
t_3
(if (<= ew 7.5e-134)
(fabs (* (sin (atan (* (/ (/ eh (sin t)) ew) (cos t)))) t_1))
t_3))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = atan((eh / (t * ew)));
double t_3 = fabs(((sin(t_2) * t_1) + ((sin(t) * ew) * cos(t_2))));
double tmp;
if (ew <= -1.12e-125) {
tmp = t_3;
} else if (ew <= 7.5e-134) {
tmp = fabs((sin(atan((((eh / sin(t)) / ew) * cos(t)))) * t_1));
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = cos(t) * eh
t_2 = atan((eh / (t * ew)))
t_3 = abs(((sin(t_2) * t_1) + ((sin(t) * ew) * cos(t_2))))
if (ew <= (-1.12d-125)) then
tmp = t_3
else if (ew <= 7.5d-134) then
tmp = abs((sin(atan((((eh / sin(t)) / ew) * cos(t)))) * t_1))
else
tmp = t_3
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.cos(t) * eh;
double t_2 = Math.atan((eh / (t * ew)));
double t_3 = Math.abs(((Math.sin(t_2) * t_1) + ((Math.sin(t) * ew) * Math.cos(t_2))));
double tmp;
if (ew <= -1.12e-125) {
tmp = t_3;
} else if (ew <= 7.5e-134) {
tmp = Math.abs((Math.sin(Math.atan((((eh / Math.sin(t)) / ew) * Math.cos(t)))) * t_1));
} else {
tmp = t_3;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.cos(t) * eh t_2 = math.atan((eh / (t * ew))) t_3 = math.fabs(((math.sin(t_2) * t_1) + ((math.sin(t) * ew) * math.cos(t_2)))) tmp = 0 if ew <= -1.12e-125: tmp = t_3 elif ew <= 7.5e-134: tmp = math.fabs((math.sin(math.atan((((eh / math.sin(t)) / ew) * math.cos(t)))) * t_1)) else: tmp = t_3 return tmp
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = atan(Float64(eh / Float64(t * ew))) t_3 = abs(Float64(Float64(sin(t_2) * t_1) + Float64(Float64(sin(t) * ew) * cos(t_2)))) tmp = 0.0 if (ew <= -1.12e-125) tmp = t_3; elseif (ew <= 7.5e-134) tmp = abs(Float64(sin(atan(Float64(Float64(Float64(eh / sin(t)) / ew) * cos(t)))) * t_1)); else tmp = t_3; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = cos(t) * eh; t_2 = atan((eh / (t * ew))); t_3 = abs(((sin(t_2) * t_1) + ((sin(t) * ew) * cos(t_2)))); tmp = 0.0; if (ew <= -1.12e-125) tmp = t_3; elseif (ew <= 7.5e-134) tmp = abs((sin(atan((((eh / sin(t)) / ew) * cos(t)))) * t_1)); else tmp = t_3; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(N[(N[Sin[t$95$2], $MachinePrecision] * t$95$1), $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.12e-125], t$95$3, If[LessEqual[ew, 7.5e-134], 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] * t$95$1), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\\
t_3 := \left|\sin t\_2 \cdot t\_1 + \left(\sin t \cdot ew\right) \cdot \cos t\_2\right|\\
\mathbf{if}\;ew \leq -1.12 \cdot 10^{-125}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;ew \leq 7.5 \cdot 10^{-134}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{eh}{\sin t}}{ew} \cdot \cos t\right) \cdot t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if ew < -1.11999999999999997e-125 or 7.50000000000000048e-134 < ew Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6493.5
Applied rewrites93.5%
if -1.11999999999999997e-125 < ew < 7.50000000000000048e-134Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites91.6%
Final simplification92.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(* (sin (atan (* (/ (/ eh (sin t)) ew) (cos t)))) (* (cos t) eh)))))
(if (<= eh -1.9e-83)
t_1
(if (<= eh 1.4e-112)
(fabs (* (* (sin t) ew) (cos (atan (/ eh (* t ew))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(atan((((eh / sin(t)) / ew) * cos(t)))) * (cos(t) * eh)));
double tmp;
if (eh <= -1.9e-83) {
tmp = t_1;
} else if (eh <= 1.4e-112) {
tmp = fabs(((sin(t) * ew) * cos(atan((eh / (t * ew))))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = abs((sin(atan((((eh / sin(t)) / ew) * cos(t)))) * (cos(t) * eh)))
if (eh <= (-1.9d-83)) then
tmp = t_1
else if (eh <= 1.4d-112) then
tmp = abs(((sin(t) * ew) * cos(atan((eh / (t * ew))))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((Math.sin(Math.atan((((eh / Math.sin(t)) / ew) * Math.cos(t)))) * (Math.cos(t) * eh)));
double tmp;
if (eh <= -1.9e-83) {
tmp = t_1;
} else if (eh <= 1.4e-112) {
tmp = Math.abs(((Math.sin(t) * ew) * Math.cos(Math.atan((eh / (t * ew))))));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(math.atan((((eh / math.sin(t)) / ew) * math.cos(t)))) * (math.cos(t) * eh))) tmp = 0 if eh <= -1.9e-83: tmp = t_1 elif eh <= 1.4e-112: tmp = math.fabs(((math.sin(t) * ew) * math.cos(math.atan((eh / (t * ew)))))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(atan(Float64(Float64(Float64(eh / sin(t)) / ew) * cos(t)))) * Float64(cos(t) * eh))) tmp = 0.0 if (eh <= -1.9e-83) tmp = t_1; elseif (eh <= 1.4e-112) tmp = abs(Float64(Float64(sin(t) * ew) * cos(atan(Float64(eh / Float64(t * ew)))))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((sin(atan((((eh / sin(t)) / ew) * cos(t)))) * (cos(t) * eh))); tmp = 0.0; if (eh <= -1.9e-83) tmp = t_1; elseif (eh <= 1.4e-112) tmp = abs(((sin(t) * ew) * cos(atan((eh / (t * ew)))))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[N[ArcTan[N[(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]}, If[LessEqual[eh, -1.9e-83], t$95$1, If[LessEqual[eh, 1.4e-112], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin \tan^{-1} \left(\frac{\frac{eh}{\sin t}}{ew} \cdot \cos t\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{if}\;eh \leq -1.9 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.4 \cdot 10^{-112}:\\
\;\;\;\;\left|\left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.89999999999999988e-83 or 1.40000000000000011e-112 < eh Initial program 99.9%
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 rewrites80.0%
if -1.89999999999999988e-83 < eh < 1.40000000000000011e-112Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.8%
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.f6481.7
Applied rewrites81.7%
Taylor expanded in t around 0
Applied rewrites81.7%
Final simplification80.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(*
(sin
(atan
(*
(/
(fma
(fma
(fma
-0.0021164021164021165
(/ (* t t) ew)
(/ -0.022222222222222223 ew))
(* t t)
(/ -0.3333333333333333 ew))
(* t t)
(/ 1.0 ew))
t)
eh)))
eh))))
(if (<= eh -7e-59)
t_1
(if (<= eh 5.4e-102)
(fabs (* (* (sin t) ew) (cos (atan (/ eh (* t ew))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(atan(((fma(fma(fma(-0.0021164021164021165, ((t * t) / ew), (-0.022222222222222223 / ew)), (t * t), (-0.3333333333333333 / ew)), (t * t), (1.0 / ew)) / t) * eh))) * eh));
double tmp;
if (eh <= -7e-59) {
tmp = t_1;
} else if (eh <= 5.4e-102) {
tmp = fabs(((sin(t) * ew) * cos(atan((eh / (t * ew))))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(atan(Float64(Float64(fma(fma(fma(-0.0021164021164021165, Float64(Float64(t * t) / ew), Float64(-0.022222222222222223 / ew)), Float64(t * t), Float64(-0.3333333333333333 / ew)), Float64(t * t), Float64(1.0 / ew)) / t) * eh))) * eh)) tmp = 0.0 if (eh <= -7e-59) tmp = t_1; elseif (eh <= 5.4e-102) tmp = abs(Float64(Float64(sin(t) * ew) * cos(atan(Float64(eh / Float64(t * ew)))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(-0.0021164021164021165 * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision] + N[(-0.022222222222222223 / ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(-0.3333333333333333 / ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(1.0 / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -7e-59], t$95$1, If[LessEqual[eh, 5.4e-102], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0021164021164021165, \frac{t \cdot t}{ew}, \frac{-0.022222222222222223}{ew}\right), t \cdot t, \frac{-0.3333333333333333}{ew}\right), t \cdot t, \frac{1}{ew}\right)}{t} \cdot eh\right) \cdot eh\right|\\
\mathbf{if}\;eh \leq -7 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 5.4 \cdot 10^{-102}:\\
\;\;\;\;\left|\left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -7.0000000000000002e-59 or 5.4e-102 < eh 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.f6451.4
Applied rewrites51.4%
Applied rewrites51.4%
Taylor expanded in t around 0
Applied rewrites48.9%
Taylor expanded in t around 0
Applied rewrites51.6%
if -7.0000000000000002e-59 < eh < 5.4e-102Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.8%
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.f6478.6
Applied rewrites78.6%
Taylor expanded in t around 0
Applied rewrites78.7%
Final simplification62.8%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(sin
(atan
(*
(/
(fma
(fma
(fma
-0.0021164021164021165
(/ (* t t) ew)
(/ -0.022222222222222223 ew))
(* t t)
(/ -0.3333333333333333 ew))
(* t t)
(/ 1.0 ew))
t)
eh)))
eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((fma(fma(fma(-0.0021164021164021165, ((t * t) / ew), (-0.022222222222222223 / ew)), (t * t), (-0.3333333333333333 / ew)), (t * t), (1.0 / ew)) / t) * eh))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(fma(fma(fma(-0.0021164021164021165, Float64(Float64(t * t) / ew), Float64(-0.022222222222222223 / ew)), Float64(t * t), Float64(-0.3333333333333333 / ew)), Float64(t * t), Float64(1.0 / ew)) / t) * eh))) * eh)) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(-0.0021164021164021165 * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision] + N[(-0.022222222222222223 / ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(-0.3333333333333333 / ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(1.0 / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0021164021164021165, \frac{t \cdot t}{ew}, \frac{-0.022222222222222223}{ew}\right), t \cdot t, \frac{-0.3333333333333333}{ew}\right), t \cdot t, \frac{1}{ew}\right)}{t} \cdot eh\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.f6437.2
Applied rewrites37.2%
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites35.3%
Taylor expanded in t around 0
Applied rewrites37.4%
Final simplification37.4%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(sin
(atan
(*
(/
(fma
(fma (* -0.022222222222222223 t) (/ t ew) (/ -0.3333333333333333 ew))
(* t t)
(/ 1.0 ew))
t)
eh)))
eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((fma(fma((-0.022222222222222223 * t), (t / ew), (-0.3333333333333333 / ew)), (t * t), (1.0 / ew)) / t) * eh))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(fma(fma(Float64(-0.022222222222222223 * t), Float64(t / ew), Float64(-0.3333333333333333 / ew)), Float64(t * t), Float64(1.0 / ew)) / t) * eh))) * eh)) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(-0.022222222222222223 * t), $MachinePrecision] * N[(t / ew), $MachinePrecision] + N[(-0.3333333333333333 / ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(1.0 / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.022222222222222223 \cdot t, \frac{t}{ew}, \frac{-0.3333333333333333}{ew}\right), t \cdot t, \frac{1}{ew}\right)}{t} \cdot eh\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.f6437.2
Applied rewrites37.2%
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites37.4%
Final simplification37.4%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(sin
(atan (* (* (- (/ (/ 1.0 (* t ew)) t) (/ 0.3333333333333333 ew)) t) eh)))
eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan((((((1.0 / (t * ew)) / t) - (0.3333333333333333 / ew)) * t) * eh))) * 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((((((1.0d0 / (t * ew)) / t) - (0.3333333333333333d0 / ew)) * t) * eh))) * eh))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.sin(Math.atan((((((1.0 / (t * ew)) / t) - (0.3333333333333333 / ew)) * t) * eh))) * eh));
}
def code(eh, ew, t): return math.fabs((math.sin(math.atan((((((1.0 / (t * ew)) / t) - (0.3333333333333333 / ew)) * t) * eh))) * eh))
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(Float64(Float64(Float64(1.0 / Float64(t * ew)) / t) - Float64(0.3333333333333333 / ew)) * t) * eh))) * eh)) end
function tmp = code(eh, ew, t) tmp = abs((sin(atan((((((1.0 / (t * ew)) / t) - (0.3333333333333333 / ew)) * t) * eh))) * eh)); end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(1.0 / N[(t * ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] - N[(0.3333333333333333 / ew), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\left(\left(\frac{\frac{1}{t \cdot ew}}{t} - \frac{0.3333333333333333}{ew}\right) \cdot t\right) \cdot eh\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.f6437.2
Applied rewrites37.2%
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites37.4%
Taylor expanded in t around inf
Applied rewrites37.4%
Final simplification37.4%
(FPCore (eh ew t)
:precision binary64
(fabs
(*
(sin
(atan (* (/ (fma (/ (* t t) ew) -0.3333333333333333 (/ 1.0 ew)) t) eh)))
eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((fma(((t * t) / ew), -0.3333333333333333, (1.0 / ew)) / t) * eh))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(fma(Float64(Float64(t * t) / ew), -0.3333333333333333, Float64(1.0 / ew)) / t) * eh))) * 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[(1.0 / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * eh), $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, \frac{1}{ew}\right)}{t} \cdot eh\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.f6437.2
Applied rewrites37.2%
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites37.4%
Final simplification37.4%
(FPCore (eh ew t) :precision binary64 (fabs (* (sin (atan (* (/ (/ (fma (* t t) -0.3333333333333333 1.0) t) ew) eh))) eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan((((fma((t * t), -0.3333333333333333, 1.0) / t) / ew) * eh))) * eh));
}
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(Float64(fma(Float64(t * t), -0.3333333333333333, 1.0) / t) / ew) * eh))) * eh)) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] / t), $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{\mathsf{fma}\left(t \cdot t, -0.3333333333333333, 1\right)}{t}}{ew} \cdot eh\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.f6437.2
Applied rewrites37.2%
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites37.4%
Taylor expanded in ew around 0
Applied rewrites37.4%
Final simplification37.4%
(FPCore (eh ew t) :precision binary64 (fabs (* (sin (atan (/ (/ eh t) ew))) eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan(((eh / t) / ew))) * 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 / t) / ew))) * eh))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.sin(Math.atan(((eh / t) / ew))) * eh));
}
def code(eh, ew, t): return math.fabs((math.sin(math.atan(((eh / t) / ew))) * eh))
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(Float64(eh / t) / ew))) * eh)) end
function tmp = code(eh, ew, t) tmp = abs((sin(atan(((eh / t) / ew))) * eh)); end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{eh}{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.f6437.2
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites35.3%
Applied rewrites35.4%
(FPCore (eh ew t) :precision binary64 (fabs (* (sin (atan (/ eh (* t ew)))) eh)))
double code(double eh, double ew, double t) {
return fabs((sin(atan((eh / (t * ew)))) * 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 / (t * ew)))) * eh))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.sin(Math.atan((eh / (t * ew)))) * eh));
}
def code(eh, ew, t): return math.fabs((math.sin(math.atan((eh / (t * ew)))) * eh))
function code(eh, ew, t) return abs(Float64(sin(atan(Float64(eh / Float64(t * ew)))) * eh)) end
function tmp = code(eh, ew, t) tmp = abs((sin(atan((eh / (t * ew)))) * eh)); end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{eh}{t \cdot 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.f6437.2
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites35.3%
Final simplification35.3%
herbie shell --seed 2024255
(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))))))))