
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (/ (cos th) (sqrt 2.0)))) (+ (* t_1 (* a1 a1)) (* t_1 (* a2 a2)))))
double code(double a1, double a2, double th) {
double t_1 = cos(th) / sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
t_1 = cos(th) / sqrt(2.0d0)
code = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
end function
public static double code(double a1, double a2, double th) {
double t_1 = Math.cos(th) / Math.sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
def code(a1, a2, th): t_1 = math.cos(th) / math.sqrt(2.0) return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
function code(a1, a2, th) t_1 = Float64(cos(th) / sqrt(2.0)) return Float64(Float64(t_1 * Float64(a1 * a1)) + Float64(t_1 * Float64(a2 * a2))) end
function tmp = code(a1, a2, th) t_1 = cos(th) / sqrt(2.0); tmp = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2)); end
code[a1_, a2_, th_] := Block[{t$95$1 = N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$1 * N[(a1 * a1), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\cos th}{\sqrt{2}}\\
t\_1 \cdot \left(a1 \cdot a1\right) + t\_1 \cdot \left(a2 \cdot a2\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (/ (cos th) (sqrt 2.0)))) (+ (* t_1 (* a1 a1)) (* t_1 (* a2 a2)))))
double code(double a1, double a2, double th) {
double t_1 = cos(th) / sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
t_1 = cos(th) / sqrt(2.0d0)
code = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
end function
public static double code(double a1, double a2, double th) {
double t_1 = Math.cos(th) / Math.sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
def code(a1, a2, th): t_1 = math.cos(th) / math.sqrt(2.0) return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
function code(a1, a2, th) t_1 = Float64(cos(th) / sqrt(2.0)) return Float64(Float64(t_1 * Float64(a1 * a1)) + Float64(t_1 * Float64(a2 * a2))) end
function tmp = code(a1, a2, th) t_1 = cos(th) / sqrt(2.0); tmp = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2)); end
code[a1_, a2_, th_] := Block[{t$95$1 = N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$1 * N[(a1 * a1), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\cos th}{\sqrt{2}}\\
t\_1 \cdot \left(a1 \cdot a1\right) + t\_1 \cdot \left(a2 \cdot a2\right)
\end{array}
\end{array}
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (+ (* (/ (cos th) (sqrt 2.0)) (* a1_m a1_m)) (* (* (cos th) (pow 2.0 -0.5)) (* a2 a2))))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return ((cos(th) / sqrt(2.0)) * (a1_m * a1_m)) + ((cos(th) * pow(2.0, -0.5)) * (a2 * a2));
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = ((cos(th) / sqrt(2.0d0)) * (a1_m * a1_m)) + ((cos(th) * (2.0d0 ** (-0.5d0))) * (a2 * a2))
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return ((Math.cos(th) / Math.sqrt(2.0)) * (a1_m * a1_m)) + ((Math.cos(th) * Math.pow(2.0, -0.5)) * (a2 * a2));
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return ((math.cos(th) / math.sqrt(2.0)) * (a1_m * a1_m)) + ((math.cos(th) * math.pow(2.0, -0.5)) * (a2 * a2))
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(Float64(Float64(cos(th) / sqrt(2.0)) * Float64(a1_m * a1_m)) + Float64(Float64(cos(th) * (2.0 ^ -0.5)) * Float64(a2 * a2))) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = ((cos(th) / sqrt(2.0)) * (a1_m * a1_m)) + ((cos(th) * (2.0 ^ -0.5)) * (a2 * a2));
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(N[(N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(a1$95$m * a1$95$m), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[th], $MachinePrecision] * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision] * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\frac{\cos th}{\sqrt{2}} \cdot \left(a1\_m \cdot a1\_m\right) + \left(\cos th \cdot {2}^{-0.5}\right) \cdot \left(a2 \cdot a2\right)
\end{array}
Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Final simplification99.6%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (/ (* (cos th) (+ (* a1_m a1_m) (* a2 a2))) (sqrt 2.0)))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return (cos(th) * ((a1_m * a1_m) + (a2 * a2))) / sqrt(2.0);
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = (cos(th) * ((a1_m * a1_m) + (a2 * a2))) / sqrt(2.0d0)
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return (Math.cos(th) * ((a1_m * a1_m) + (a2 * a2))) / Math.sqrt(2.0);
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return (math.cos(th) * ((a1_m * a1_m) + (a2 * a2))) / math.sqrt(2.0)
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(Float64(cos(th) * Float64(Float64(a1_m * a1_m) + Float64(a2 * a2))) / sqrt(2.0)) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = (cos(th) * ((a1_m * a1_m) + (a2 * a2))) / sqrt(2.0);
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(N[(N[Cos[th], $MachinePrecision] * N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\frac{\cos th \cdot \left(a1\_m \cdot a1\_m + a2 \cdot a2\right)}{\sqrt{2}}
\end{array}
Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.5%
Simplified99.5%
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Applied egg-rr99.6%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (* (cos th) (/ (+ (* a1_m a1_m) (* a2 a2)) (sqrt 2.0))))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return cos(th) * (((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0));
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = cos(th) * (((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0d0))
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return Math.cos(th) * (((a1_m * a1_m) + (a2 * a2)) / Math.sqrt(2.0));
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return math.cos(th) * (((a1_m * a1_m) + (a2 * a2)) / math.sqrt(2.0))
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(cos(th) * Float64(Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)) / sqrt(2.0))) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = cos(th) * (((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0));
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(N[Cos[th], $MachinePrecision] * N[(N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\cos th \cdot \frac{a1\_m \cdot a1\_m + a2 \cdot a2}{\sqrt{2}}
\end{array}
Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.5%
Simplified99.5%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (* a2 (* (* (cos th) a2) (sqrt 0.5))))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return a2 * ((cos(th) * a2) * sqrt(0.5));
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a2 * ((cos(th) * a2) * sqrt(0.5d0))
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return a2 * ((Math.cos(th) * a2) * Math.sqrt(0.5));
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return a2 * ((math.cos(th) * a2) * math.sqrt(0.5))
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(a2 * Float64(Float64(cos(th) * a2) * sqrt(0.5))) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = a2 * ((cos(th) * a2) * sqrt(0.5));
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(a2 * N[(N[(N[Cos[th], $MachinePrecision] * a2), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
a2 \cdot \left(\left(\cos th \cdot a2\right) \cdot \sqrt{0.5}\right)
\end{array}
Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6455.0%
Simplified55.0%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sqrt-lowering-sqrt.f6455.0%
Applied egg-rr55.0%
Final simplification55.0%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (* (* a2 a2) (* (cos th) (sqrt 0.5))))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return (a2 * a2) * (cos(th) * sqrt(0.5));
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = (a2 * a2) * (cos(th) * sqrt(0.5d0))
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return (a2 * a2) * (Math.cos(th) * Math.sqrt(0.5));
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return (a2 * a2) * (math.cos(th) * math.sqrt(0.5))
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(Float64(a2 * a2) * Float64(cos(th) * sqrt(0.5))) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = (a2 * a2) * (cos(th) * sqrt(0.5));
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(N[(a2 * a2), $MachinePrecision] * N[(N[Cos[th], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\left(a2 \cdot a2\right) \cdot \left(\cos th \cdot \sqrt{0.5}\right)
\end{array}
Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6455.0%
Simplified55.0%
Final simplification55.0%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (* (cos th) (* (* a2 a2) (sqrt 0.5))))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return cos(th) * ((a2 * a2) * sqrt(0.5));
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = cos(th) * ((a2 * a2) * sqrt(0.5d0))
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return Math.cos(th) * ((a2 * a2) * Math.sqrt(0.5));
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return math.cos(th) * ((a2 * a2) * math.sqrt(0.5))
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(cos(th) * Float64(Float64(a2 * a2) * sqrt(0.5))) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = cos(th) * ((a2 * a2) * sqrt(0.5));
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(N[Cos[th], $MachinePrecision] * N[(N[(a2 * a2), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\cos th \cdot \left(\left(a2 \cdot a2\right) \cdot \sqrt{0.5}\right)
\end{array}
Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.5%
Simplified99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
unpow2N/A
*-lowering-*.f6455.0%
Simplified55.0%
Final simplification55.0%
a1_m = (fabs.f64 a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
(FPCore (a1_m a2 th)
:precision binary64
(let* ((t_1 (+ (* a1_m a1_m) (* a2 a2))))
(if (<= th 910.0)
(/
(*
t_1
(+
1.0
(*
th
(*
th
(+
-0.5
(*
(* th th)
(+ 0.041666666666666664 (* th (* th -0.001388888888888889)))))))))
(sqrt 2.0))
(if (<= th 4.8e+141)
(/ -1.0 (/ (- 0.0 (sqrt 2.0)) t_1))
(* a2 (* a2 (sqrt 0.5)))))))a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
double t_1 = (a1_m * a1_m) + (a2 * a2);
double tmp;
if (th <= 910.0) {
tmp = (t_1 * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + (th * (th * -0.001388888888888889))))))))) / sqrt(2.0);
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - sqrt(2.0)) / t_1);
} else {
tmp = a2 * (a2 * sqrt(0.5));
}
return tmp;
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = (a1_m * a1_m) + (a2 * a2)
if (th <= 910.0d0) then
tmp = (t_1 * (1.0d0 + (th * (th * ((-0.5d0) + ((th * th) * (0.041666666666666664d0 + (th * (th * (-0.001388888888888889d0)))))))))) / sqrt(2.0d0)
else if (th <= 4.8d+141) then
tmp = (-1.0d0) / ((0.0d0 - sqrt(2.0d0)) / t_1)
else
tmp = a2 * (a2 * sqrt(0.5d0))
end if
code = tmp
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
double t_1 = (a1_m * a1_m) + (a2 * a2);
double tmp;
if (th <= 910.0) {
tmp = (t_1 * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + (th * (th * -0.001388888888888889))))))))) / Math.sqrt(2.0);
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - Math.sqrt(2.0)) / t_1);
} else {
tmp = a2 * (a2 * Math.sqrt(0.5));
}
return tmp;
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): t_1 = (a1_m * a1_m) + (a2 * a2) tmp = 0 if th <= 910.0: tmp = (t_1 * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + (th * (th * -0.001388888888888889))))))))) / math.sqrt(2.0) elif th <= 4.8e+141: tmp = -1.0 / ((0.0 - math.sqrt(2.0)) / t_1) else: tmp = a2 * (a2 * math.sqrt(0.5)) return tmp
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) t_1 = Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)) tmp = 0.0 if (th <= 910.0) tmp = Float64(Float64(t_1 * Float64(1.0 + Float64(th * Float64(th * Float64(-0.5 + Float64(Float64(th * th) * Float64(0.041666666666666664 + Float64(th * Float64(th * -0.001388888888888889))))))))) / sqrt(2.0)); elseif (th <= 4.8e+141) tmp = Float64(-1.0 / Float64(Float64(0.0 - sqrt(2.0)) / t_1)); else tmp = Float64(a2 * Float64(a2 * sqrt(0.5))); end return tmp end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp_2 = code(a1_m, a2, th)
t_1 = (a1_m * a1_m) + (a2 * a2);
tmp = 0.0;
if (th <= 910.0)
tmp = (t_1 * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + (th * (th * -0.001388888888888889))))))))) / sqrt(2.0);
elseif (th <= 4.8e+141)
tmp = -1.0 / ((0.0 - sqrt(2.0)) / t_1);
else
tmp = a2 * (a2 * sqrt(0.5));
end
tmp_2 = tmp;
end
a1_m = N[Abs[a1], $MachinePrecision]
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
code[a1$95$m_, a2_, th_] := Block[{t$95$1 = N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[th, 910.0], N[(N[(t$95$1 * N[(1.0 + N[(th * N[(th * N[(-0.5 + N[(N[(th * th), $MachinePrecision] * N[(0.041666666666666664 + N[(th * N[(th * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 4.8e+141], N[(-1.0 / N[(N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\begin{array}{l}
t_1 := a1\_m \cdot a1\_m + a2 \cdot a2\\
\mathbf{if}\;th \leq 910:\\
\;\;\;\;\frac{t\_1 \cdot \left(1 + th \cdot \left(th \cdot \left(-0.5 + \left(th \cdot th\right) \cdot \left(0.041666666666666664 + th \cdot \left(th \cdot -0.001388888888888889\right)\right)\right)\right)\right)}{\sqrt{2}}\\
\mathbf{elif}\;th \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{-1}{\frac{0 - \sqrt{2}}{t\_1}}\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if th < 910Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
Taylor expanded in th around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6469.5%
Simplified69.5%
associate-*r/N/A
/-lowering-/.f64N/A
Applied egg-rr69.5%
if 910 < th < 4.79999999999999995e141Initial program 99.4%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.4%
Simplified99.4%
Taylor expanded in th around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6417.4%
Simplified17.4%
clear-numN/A
frac-2negN/A
metadata-evalN/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.9%
Applied egg-rr34.9%
if 4.79999999999999995e141 < th Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6451.6%
Simplified51.6%
Taylor expanded in th around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6418.7%
Simplified18.7%
Final simplification53.8%
a1_m = (fabs.f64 a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
(FPCore (a1_m a2 th)
:precision binary64
(let* ((t_1 (+ (* a1_m a1_m) (* a2 a2))))
(if (<= th 910.0)
(*
(/ t_1 (sqrt 2.0))
(+
1.0
(*
th
(*
th
(+
-0.5
(*
(* th th)
(+ 0.041666666666666664 (* (* th th) -0.001388888888888889))))))))
(if (<= th 4.8e+141)
(/ -1.0 (/ (- 0.0 (sqrt 2.0)) t_1))
(* a2 (* a2 (sqrt 0.5)))))))a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
double t_1 = (a1_m * a1_m) + (a2 * a2);
double tmp;
if (th <= 910.0) {
tmp = (t_1 / sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889)))))));
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - sqrt(2.0)) / t_1);
} else {
tmp = a2 * (a2 * sqrt(0.5));
}
return tmp;
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = (a1_m * a1_m) + (a2 * a2)
if (th <= 910.0d0) then
tmp = (t_1 / sqrt(2.0d0)) * (1.0d0 + (th * (th * ((-0.5d0) + ((th * th) * (0.041666666666666664d0 + ((th * th) * (-0.001388888888888889d0))))))))
else if (th <= 4.8d+141) then
tmp = (-1.0d0) / ((0.0d0 - sqrt(2.0d0)) / t_1)
else
tmp = a2 * (a2 * sqrt(0.5d0))
end if
code = tmp
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
double t_1 = (a1_m * a1_m) + (a2 * a2);
double tmp;
if (th <= 910.0) {
tmp = (t_1 / Math.sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889)))))));
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - Math.sqrt(2.0)) / t_1);
} else {
tmp = a2 * (a2 * Math.sqrt(0.5));
}
return tmp;
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): t_1 = (a1_m * a1_m) + (a2 * a2) tmp = 0 if th <= 910.0: tmp = (t_1 / math.sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889))))))) elif th <= 4.8e+141: tmp = -1.0 / ((0.0 - math.sqrt(2.0)) / t_1) else: tmp = a2 * (a2 * math.sqrt(0.5)) return tmp
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) t_1 = Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)) tmp = 0.0 if (th <= 910.0) tmp = Float64(Float64(t_1 / sqrt(2.0)) * Float64(1.0 + Float64(th * Float64(th * Float64(-0.5 + Float64(Float64(th * th) * Float64(0.041666666666666664 + Float64(Float64(th * th) * -0.001388888888888889)))))))); elseif (th <= 4.8e+141) tmp = Float64(-1.0 / Float64(Float64(0.0 - sqrt(2.0)) / t_1)); else tmp = Float64(a2 * Float64(a2 * sqrt(0.5))); end return tmp end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp_2 = code(a1_m, a2, th)
t_1 = (a1_m * a1_m) + (a2 * a2);
tmp = 0.0;
if (th <= 910.0)
tmp = (t_1 / sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889)))))));
elseif (th <= 4.8e+141)
tmp = -1.0 / ((0.0 - sqrt(2.0)) / t_1);
else
tmp = a2 * (a2 * sqrt(0.5));
end
tmp_2 = tmp;
end
a1_m = N[Abs[a1], $MachinePrecision]
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
code[a1$95$m_, a2_, th_] := Block[{t$95$1 = N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[th, 910.0], N[(N[(t$95$1 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(th * N[(th * N[(-0.5 + N[(N[(th * th), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(th * th), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 4.8e+141], N[(-1.0 / N[(N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\begin{array}{l}
t_1 := a1\_m \cdot a1\_m + a2 \cdot a2\\
\mathbf{if}\;th \leq 910:\\
\;\;\;\;\frac{t\_1}{\sqrt{2}} \cdot \left(1 + th \cdot \left(th \cdot \left(-0.5 + \left(th \cdot th\right) \cdot \left(0.041666666666666664 + \left(th \cdot th\right) \cdot -0.001388888888888889\right)\right)\right)\right)\\
\mathbf{elif}\;th \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{-1}{\frac{0 - \sqrt{2}}{t\_1}}\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if th < 910Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
Taylor expanded in th around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6469.5%
Simplified69.5%
if 910 < th < 4.79999999999999995e141Initial program 99.4%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.4%
Simplified99.4%
Taylor expanded in th around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6417.4%
Simplified17.4%
clear-numN/A
frac-2negN/A
metadata-evalN/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.9%
Applied egg-rr34.9%
if 4.79999999999999995e141 < th Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6451.6%
Simplified51.6%
Taylor expanded in th around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6418.7%
Simplified18.7%
Final simplification53.8%
a1_m = (fabs.f64 a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
(FPCore (a1_m a2 th)
:precision binary64
(if (<= th 910.0)
(*
(+
1.0
(*
th
(*
th
(+
-0.5
(*
(* th th)
(+ 0.041666666666666664 (* (* th th) -0.001388888888888889)))))))
(/ (* a2 a2) (sqrt 2.0)))
(if (<= th 4.8e+141)
(/ -1.0 (/ (- 0.0 (sqrt 2.0)) (+ (* a1_m a1_m) (* a2 a2))))
(* a2 (* a2 (sqrt 0.5))))))a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
double tmp;
if (th <= 910.0) {
tmp = (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889))))))) * ((a2 * a2) / sqrt(2.0));
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - sqrt(2.0)) / ((a1_m * a1_m) + (a2 * a2)));
} else {
tmp = a2 * (a2 * sqrt(0.5));
}
return tmp;
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 910.0d0) then
tmp = (1.0d0 + (th * (th * ((-0.5d0) + ((th * th) * (0.041666666666666664d0 + ((th * th) * (-0.001388888888888889d0)))))))) * ((a2 * a2) / sqrt(2.0d0))
else if (th <= 4.8d+141) then
tmp = (-1.0d0) / ((0.0d0 - sqrt(2.0d0)) / ((a1_m * a1_m) + (a2 * a2)))
else
tmp = a2 * (a2 * sqrt(0.5d0))
end if
code = tmp
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
double tmp;
if (th <= 910.0) {
tmp = (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889))))))) * ((a2 * a2) / Math.sqrt(2.0));
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - Math.sqrt(2.0)) / ((a1_m * a1_m) + (a2 * a2)));
} else {
tmp = a2 * (a2 * Math.sqrt(0.5));
}
return tmp;
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): tmp = 0 if th <= 910.0: tmp = (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889))))))) * ((a2 * a2) / math.sqrt(2.0)) elif th <= 4.8e+141: tmp = -1.0 / ((0.0 - math.sqrt(2.0)) / ((a1_m * a1_m) + (a2 * a2))) else: tmp = a2 * (a2 * math.sqrt(0.5)) return tmp
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) tmp = 0.0 if (th <= 910.0) tmp = Float64(Float64(1.0 + Float64(th * Float64(th * Float64(-0.5 + Float64(Float64(th * th) * Float64(0.041666666666666664 + Float64(Float64(th * th) * -0.001388888888888889))))))) * Float64(Float64(a2 * a2) / sqrt(2.0))); elseif (th <= 4.8e+141) tmp = Float64(-1.0 / Float64(Float64(0.0 - sqrt(2.0)) / Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)))); else tmp = Float64(a2 * Float64(a2 * sqrt(0.5))); end return tmp end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp_2 = code(a1_m, a2, th)
tmp = 0.0;
if (th <= 910.0)
tmp = (1.0 + (th * (th * (-0.5 + ((th * th) * (0.041666666666666664 + ((th * th) * -0.001388888888888889))))))) * ((a2 * a2) / sqrt(2.0));
elseif (th <= 4.8e+141)
tmp = -1.0 / ((0.0 - sqrt(2.0)) / ((a1_m * a1_m) + (a2 * a2)));
else
tmp = a2 * (a2 * sqrt(0.5));
end
tmp_2 = tmp;
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := If[LessEqual[th, 910.0], N[(N[(1.0 + N[(th * N[(th * N[(-0.5 + N[(N[(th * th), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(th * th), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a2 * a2), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 4.8e+141], N[(-1.0 / N[(N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\begin{array}{l}
\mathbf{if}\;th \leq 910:\\
\;\;\;\;\left(1 + th \cdot \left(th \cdot \left(-0.5 + \left(th \cdot th\right) \cdot \left(0.041666666666666664 + \left(th \cdot th\right) \cdot -0.001388888888888889\right)\right)\right)\right) \cdot \frac{a2 \cdot a2}{\sqrt{2}}\\
\mathbf{elif}\;th \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{-1}{\frac{0 - \sqrt{2}}{a1\_m \cdot a1\_m + a2 \cdot a2}}\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if th < 910Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
Taylor expanded in th around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6469.5%
Simplified69.5%
Taylor expanded in a1 around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6443.5%
Simplified43.5%
if 910 < th < 4.79999999999999995e141Initial program 99.4%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.4%
Simplified99.4%
Taylor expanded in th around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6417.4%
Simplified17.4%
clear-numN/A
frac-2negN/A
metadata-evalN/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.9%
Applied egg-rr34.9%
if 4.79999999999999995e141 < th Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6451.6%
Simplified51.6%
Taylor expanded in th around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6418.7%
Simplified18.7%
Final simplification35.7%
a1_m = (fabs.f64 a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
(FPCore (a1_m a2 th)
:precision binary64
(let* ((t_1 (+ (* a1_m a1_m) (* a2 a2))))
(if (<= th 196.0)
(*
(/ t_1 (sqrt 2.0))
(+ 1.0 (* th (* th (+ -0.5 (* (* th th) 0.041666666666666664))))))
(if (<= th 4.8e+141)
(/ -1.0 (/ (- 0.0 (sqrt 2.0)) t_1))
(* a2 (* a2 (sqrt 0.5)))))))a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
double t_1 = (a1_m * a1_m) + (a2 * a2);
double tmp;
if (th <= 196.0) {
tmp = (t_1 / sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * 0.041666666666666664)))));
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - sqrt(2.0)) / t_1);
} else {
tmp = a2 * (a2 * sqrt(0.5));
}
return tmp;
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = (a1_m * a1_m) + (a2 * a2)
if (th <= 196.0d0) then
tmp = (t_1 / sqrt(2.0d0)) * (1.0d0 + (th * (th * ((-0.5d0) + ((th * th) * 0.041666666666666664d0)))))
else if (th <= 4.8d+141) then
tmp = (-1.0d0) / ((0.0d0 - sqrt(2.0d0)) / t_1)
else
tmp = a2 * (a2 * sqrt(0.5d0))
end if
code = tmp
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
double t_1 = (a1_m * a1_m) + (a2 * a2);
double tmp;
if (th <= 196.0) {
tmp = (t_1 / Math.sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * 0.041666666666666664)))));
} else if (th <= 4.8e+141) {
tmp = -1.0 / ((0.0 - Math.sqrt(2.0)) / t_1);
} else {
tmp = a2 * (a2 * Math.sqrt(0.5));
}
return tmp;
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): t_1 = (a1_m * a1_m) + (a2 * a2) tmp = 0 if th <= 196.0: tmp = (t_1 / math.sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * 0.041666666666666664))))) elif th <= 4.8e+141: tmp = -1.0 / ((0.0 - math.sqrt(2.0)) / t_1) else: tmp = a2 * (a2 * math.sqrt(0.5)) return tmp
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) t_1 = Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)) tmp = 0.0 if (th <= 196.0) tmp = Float64(Float64(t_1 / sqrt(2.0)) * Float64(1.0 + Float64(th * Float64(th * Float64(-0.5 + Float64(Float64(th * th) * 0.041666666666666664)))))); elseif (th <= 4.8e+141) tmp = Float64(-1.0 / Float64(Float64(0.0 - sqrt(2.0)) / t_1)); else tmp = Float64(a2 * Float64(a2 * sqrt(0.5))); end return tmp end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp_2 = code(a1_m, a2, th)
t_1 = (a1_m * a1_m) + (a2 * a2);
tmp = 0.0;
if (th <= 196.0)
tmp = (t_1 / sqrt(2.0)) * (1.0 + (th * (th * (-0.5 + ((th * th) * 0.041666666666666664)))));
elseif (th <= 4.8e+141)
tmp = -1.0 / ((0.0 - sqrt(2.0)) / t_1);
else
tmp = a2 * (a2 * sqrt(0.5));
end
tmp_2 = tmp;
end
a1_m = N[Abs[a1], $MachinePrecision]
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
code[a1$95$m_, a2_, th_] := Block[{t$95$1 = N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[th, 196.0], N[(N[(t$95$1 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(th * N[(th * N[(-0.5 + N[(N[(th * th), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 4.8e+141], N[(-1.0 / N[(N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\begin{array}{l}
t_1 := a1\_m \cdot a1\_m + a2 \cdot a2\\
\mathbf{if}\;th \leq 196:\\
\;\;\;\;\frac{t\_1}{\sqrt{2}} \cdot \left(1 + th \cdot \left(th \cdot \left(-0.5 + \left(th \cdot th\right) \cdot 0.041666666666666664\right)\right)\right)\\
\mathbf{elif}\;th \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{-1}{\frac{0 - \sqrt{2}}{t\_1}}\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if th < 196Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
Taylor expanded in th around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6471.1%
Simplified71.1%
if 196 < th < 4.79999999999999995e141Initial program 99.4%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.3%
Simplified99.3%
Taylor expanded in th around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6417.2%
Simplified17.2%
clear-numN/A
frac-2negN/A
metadata-evalN/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.3%
Applied egg-rr34.3%
if 4.79999999999999995e141 < th Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6451.6%
Simplified51.6%
Taylor expanded in th around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6418.7%
Simplified18.7%
Final simplification54.7%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (if (<= th 4.8e+141) (* (/ (+ (* a1_m a1_m) (* a2 a2)) (sqrt 2.0)) (+ 1.0 (* -0.5 (* th th)))) (* a2 (* a2 (sqrt 0.5)))))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
double tmp;
if (th <= 4.8e+141) {
tmp = (((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0)) * (1.0 + (-0.5 * (th * th)));
} else {
tmp = a2 * (a2 * sqrt(0.5));
}
return tmp;
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 4.8d+141) then
tmp = (((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0d0)) * (1.0d0 + ((-0.5d0) * (th * th)))
else
tmp = a2 * (a2 * sqrt(0.5d0))
end if
code = tmp
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
double tmp;
if (th <= 4.8e+141) {
tmp = (((a1_m * a1_m) + (a2 * a2)) / Math.sqrt(2.0)) * (1.0 + (-0.5 * (th * th)));
} else {
tmp = a2 * (a2 * Math.sqrt(0.5));
}
return tmp;
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): tmp = 0 if th <= 4.8e+141: tmp = (((a1_m * a1_m) + (a2 * a2)) / math.sqrt(2.0)) * (1.0 + (-0.5 * (th * th))) else: tmp = a2 * (a2 * math.sqrt(0.5)) return tmp
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) tmp = 0.0 if (th <= 4.8e+141) tmp = Float64(Float64(Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)) / sqrt(2.0)) * Float64(1.0 + Float64(-0.5 * Float64(th * th)))); else tmp = Float64(a2 * Float64(a2 * sqrt(0.5))); end return tmp end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp_2 = code(a1_m, a2, th)
tmp = 0.0;
if (th <= 4.8e+141)
tmp = (((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0)) * (1.0 + (-0.5 * (th * th)));
else
tmp = a2 * (a2 * sqrt(0.5));
end
tmp_2 = tmp;
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := If[LessEqual[th, 4.8e+141], N[(N[(N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\begin{array}{l}
\mathbf{if}\;th \leq 4.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{a1\_m \cdot a1\_m + a2 \cdot a2}{\sqrt{2}} \cdot \left(1 + -0.5 \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if th < 4.79999999999999995e141Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
Taylor expanded in th around 0
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-lft-identityN/A
associate-*l/N/A
distribute-lft-outN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
Simplified62.5%
if 4.79999999999999995e141 < th Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6451.6%
Simplified51.6%
Taylor expanded in th around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6418.7%
Simplified18.7%
Final simplification56.0%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (/ (+ (* a1_m a1_m) (* a2 a2)) (sqrt 2.0)))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return ((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0);
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = ((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0d0)
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return ((a1_m * a1_m) + (a2 * a2)) / Math.sqrt(2.0);
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return ((a1_m * a1_m) + (a2 * a2)) / math.sqrt(2.0)
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)) / sqrt(2.0)) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = ((a1_m * a1_m) + (a2 * a2)) / sqrt(2.0);
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\frac{a1\_m \cdot a1\_m + a2 \cdot a2}{\sqrt{2}}
\end{array}
Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.5%
Simplified99.5%
Taylor expanded in th around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6460.4%
Simplified60.4%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (* (+ (* a1_m a1_m) (* a2 a2)) (sqrt 0.5)))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return ((a1_m * a1_m) + (a2 * a2)) * sqrt(0.5);
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = ((a1_m * a1_m) + (a2 * a2)) * sqrt(0.5d0)
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return ((a1_m * a1_m) + (a2 * a2)) * Math.sqrt(0.5);
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return ((a1_m * a1_m) + (a2 * a2)) * math.sqrt(0.5)
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(Float64(Float64(a1_m * a1_m) + Float64(a2 * a2)) * sqrt(0.5)) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = ((a1_m * a1_m) + (a2 * a2)) * sqrt(0.5);
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(N[(N[(a1$95$m * a1$95$m), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
\left(a1\_m \cdot a1\_m + a2 \cdot a2\right) \cdot \sqrt{0.5}
\end{array}
Initial program 99.5%
distribute-lft-outN/A
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.5%
Simplified99.5%
associate-*r/N/A
associate-*l/N/A
clear-numN/A
associate-/r/N/A
associate-*l*N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.5%
Applied egg-rr99.5%
Taylor expanded in th around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6460.4%
Simplified60.4%
Final simplification60.4%
a1_m = (fabs.f64 a1) NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. (FPCore (a1_m a2 th) :precision binary64 (* a2 (* a2 (sqrt 0.5))))
a1_m = fabs(a1);
assert(a1_m < a2 && a2 < th);
double code(double a1_m, double a2, double th) {
return a2 * (a2 * sqrt(0.5));
}
a1_m = abs(a1)
NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function.
real(8) function code(a1_m, a2, th)
real(8), intent (in) :: a1_m
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a2 * (a2 * sqrt(0.5d0))
end function
a1_m = Math.abs(a1);
assert a1_m < a2 && a2 < th;
public static double code(double a1_m, double a2, double th) {
return a2 * (a2 * Math.sqrt(0.5));
}
a1_m = math.fabs(a1) [a1_m, a2, th] = sort([a1_m, a2, th]) def code(a1_m, a2, th): return a2 * (a2 * math.sqrt(0.5))
a1_m = abs(a1) a1_m, a2, th = sort([a1_m, a2, th]) function code(a1_m, a2, th) return Float64(a2 * Float64(a2 * sqrt(0.5))) end
a1_m = abs(a1);
a1_m, a2, th = num2cell(sort([a1_m, a2, th])){:}
function tmp = code(a1_m, a2, th)
tmp = a2 * (a2 * sqrt(0.5));
end
a1_m = N[Abs[a1], $MachinePrecision] NOTE: a1_m, a2, and th should be sorted in increasing order before calling this function. code[a1$95$m_, a2_, th_] := N[(a2 * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a1_m = \left|a1\right|
\\
[a1_m, a2, th] = \mathsf{sort}([a1_m, a2, th])\\
\\
a2 \cdot \left(a2 \cdot \sqrt{0.5}\right)
\end{array}
Initial program 99.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cos-lowering-cos.f6499.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f6455.0%
Simplified55.0%
Taylor expanded in th around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6437.4%
Simplified37.4%
herbie shell --seed 2024163
(FPCore (a1 a2 th)
:name "Migdal et al, Equation (64)"
:precision binary64
(+ (* (/ (cos th) (sqrt 2.0)) (* a1 a1)) (* (/ (cos th) (sqrt 2.0)) (* a2 a2))))