
(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 18 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}
(FPCore (a1 a2 th) :precision binary64 (/ (* (cos th) (+ (* a2 a2) (* a1 a1))) (sqrt 2.0)))
double code(double a1, double a2, double th) {
return (cos(th) * ((a2 * a2) + (a1 * a1))) / sqrt(2.0);
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = (cos(th) * ((a2 * a2) + (a1 * a1))) / sqrt(2.0d0)
end function
public static double code(double a1, double a2, double th) {
return (Math.cos(th) * ((a2 * a2) + (a1 * a1))) / Math.sqrt(2.0);
}
def code(a1, a2, th): return (math.cos(th) * ((a2 * a2) + (a1 * a1))) / math.sqrt(2.0)
function code(a1, a2, th) return Float64(Float64(cos(th) * Float64(Float64(a2 * a2) + Float64(a1 * a1))) / sqrt(2.0)) end
function tmp = code(a1, a2, th) tmp = (cos(th) * ((a2 * a2) + (a1 * a1))) / sqrt(2.0); end
code[a1_, a2_, th_] := N[(N[(N[Cos[th], $MachinePrecision] * N[(N[(a2 * a2), $MachinePrecision] + N[(a1 * a1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos th \cdot \left(a2 \cdot a2 + a1 \cdot a1\right)}{\sqrt{2}}
\end{array}
Initial program 99.3%
distribute-lft-out99.3%
cos-neg99.3%
associate-*l/99.3%
cos-neg99.3%
fma-def99.3%
Simplified99.3%
fma-udef99.3%
+-commutative99.3%
Applied egg-rr99.3%
Final simplification99.3%
(FPCore (a1 a2 th) :precision binary64 (if (<= (cos th) 0.65) (* (cos th) (* (+ a2 a1) (+ a2 a1))) (* (+ (* a2 a2) (* a1 a1)) (sqrt 0.5))))
double code(double a1, double a2, double th) {
double tmp;
if (cos(th) <= 0.65) {
tmp = cos(th) * ((a2 + a1) * (a2 + a1));
} else {
tmp = ((a2 * a2) + (a1 * a1)) * sqrt(0.5);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (cos(th) <= 0.65d0) then
tmp = cos(th) * ((a2 + a1) * (a2 + a1))
else
tmp = ((a2 * a2) + (a1 * a1)) * sqrt(0.5d0)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (Math.cos(th) <= 0.65) {
tmp = Math.cos(th) * ((a2 + a1) * (a2 + a1));
} else {
tmp = ((a2 * a2) + (a1 * a1)) * Math.sqrt(0.5);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if math.cos(th) <= 0.65: tmp = math.cos(th) * ((a2 + a1) * (a2 + a1)) else: tmp = ((a2 * a2) + (a1 * a1)) * math.sqrt(0.5) return tmp
function code(a1, a2, th) tmp = 0.0 if (cos(th) <= 0.65) tmp = Float64(cos(th) * Float64(Float64(a2 + a1) * Float64(a2 + a1))); else tmp = Float64(Float64(Float64(a2 * a2) + Float64(a1 * a1)) * sqrt(0.5)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (cos(th) <= 0.65) tmp = cos(th) * ((a2 + a1) * (a2 + a1)); else tmp = ((a2 * a2) + (a1 * a1)) * sqrt(0.5); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[N[Cos[th], $MachinePrecision], 0.65], N[(N[Cos[th], $MachinePrecision] * N[(N[(a2 + a1), $MachinePrecision] * N[(a2 + a1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a2 * a2), $MachinePrecision] + N[(a1 * a1), $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos th \leq 0.65:\\
\;\;\;\;\cos th \cdot \left(\left(a2 + a1\right) \cdot \left(a2 + a1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a2 \cdot a2 + a1 \cdot a1\right) \cdot \sqrt{0.5}\\
\end{array}
\end{array}
if (cos.f64 th) < 0.650000000000000022Initial program 98.8%
+-commutative98.8%
distribute-lft-out98.8%
Simplified98.8%
clear-num98.7%
associate-/r/98.6%
pow1/298.6%
pow-flip98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in th around inf 98.8%
*-commutative98.8%
unpow298.8%
unpow298.8%
Simplified98.8%
Applied egg-rr49.1%
+-commutative49.1%
distribute-lft-in57.7%
Simplified57.7%
if 0.650000000000000022 < (cos.f64 th) Initial program 99.6%
+-commutative99.6%
distribute-lft-out99.6%
Simplified99.6%
Taylor expanded in th around 0 93.8%
expm1-log1p-u93.8%
expm1-udef93.8%
add-sqr-sqrt93.8%
sqrt-unprod93.8%
frac-times93.8%
metadata-eval93.8%
add-sqr-sqrt93.3%
metadata-eval93.3%
Applied egg-rr93.3%
expm1-def93.3%
expm1-log1p93.8%
Simplified93.8%
Final simplification79.1%
(FPCore (a1 a2 th) :precision binary64 (if (<= (cos th) 0.65) (* (cos th) (* (+ a2 a1) (+ a2 a1))) (/ (+ (* a2 a2) (* a1 a1)) (sqrt 2.0))))
double code(double a1, double a2, double th) {
double tmp;
if (cos(th) <= 0.65) {
tmp = cos(th) * ((a2 + a1) * (a2 + a1));
} else {
tmp = ((a2 * a2) + (a1 * a1)) / sqrt(2.0);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (cos(th) <= 0.65d0) then
tmp = cos(th) * ((a2 + a1) * (a2 + a1))
else
tmp = ((a2 * a2) + (a1 * a1)) / sqrt(2.0d0)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (Math.cos(th) <= 0.65) {
tmp = Math.cos(th) * ((a2 + a1) * (a2 + a1));
} else {
tmp = ((a2 * a2) + (a1 * a1)) / Math.sqrt(2.0);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if math.cos(th) <= 0.65: tmp = math.cos(th) * ((a2 + a1) * (a2 + a1)) else: tmp = ((a2 * a2) + (a1 * a1)) / math.sqrt(2.0) return tmp
function code(a1, a2, th) tmp = 0.0 if (cos(th) <= 0.65) tmp = Float64(cos(th) * Float64(Float64(a2 + a1) * Float64(a2 + a1))); else tmp = Float64(Float64(Float64(a2 * a2) + Float64(a1 * a1)) / sqrt(2.0)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (cos(th) <= 0.65) tmp = cos(th) * ((a2 + a1) * (a2 + a1)); else tmp = ((a2 * a2) + (a1 * a1)) / sqrt(2.0); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[N[Cos[th], $MachinePrecision], 0.65], N[(N[Cos[th], $MachinePrecision] * N[(N[(a2 + a1), $MachinePrecision] * N[(a2 + a1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a2 * a2), $MachinePrecision] + N[(a1 * a1), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos th \leq 0.65:\\
\;\;\;\;\cos th \cdot \left(\left(a2 + a1\right) \cdot \left(a2 + a1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a2 \cdot a2 + a1 \cdot a1}{\sqrt{2}}\\
\end{array}
\end{array}
if (cos.f64 th) < 0.650000000000000022Initial program 98.8%
+-commutative98.8%
distribute-lft-out98.8%
Simplified98.8%
clear-num98.7%
associate-/r/98.6%
pow1/298.6%
pow-flip98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in th around inf 98.8%
*-commutative98.8%
unpow298.8%
unpow298.8%
Simplified98.8%
Applied egg-rr49.1%
+-commutative49.1%
distribute-lft-in57.7%
Simplified57.7%
if 0.650000000000000022 < (cos.f64 th) Initial program 99.6%
distribute-lft-out99.6%
cos-neg99.6%
associate-*l/99.8%
cos-neg99.8%
fma-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 93.9%
unpow293.9%
unpow293.9%
+-commutative93.9%
Simplified93.9%
Final simplification79.2%
(FPCore (a1 a2 th) :precision binary64 (* (cos th) (* (+ (* a2 a2) (* a1 a1)) (sqrt 0.5))))
double code(double a1, double a2, double th) {
return cos(th) * (((a2 * a2) + (a1 * a1)) * sqrt(0.5));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = cos(th) * (((a2 * a2) + (a1 * a1)) * sqrt(0.5d0))
end function
public static double code(double a1, double a2, double th) {
return Math.cos(th) * (((a2 * a2) + (a1 * a1)) * Math.sqrt(0.5));
}
def code(a1, a2, th): return math.cos(th) * (((a2 * a2) + (a1 * a1)) * math.sqrt(0.5))
function code(a1, a2, th) return Float64(cos(th) * Float64(Float64(Float64(a2 * a2) + Float64(a1 * a1)) * sqrt(0.5))) end
function tmp = code(a1, a2, th) tmp = cos(th) * (((a2 * a2) + (a1 * a1)) * sqrt(0.5)); end
code[a1_, a2_, th_] := N[(N[Cos[th], $MachinePrecision] * N[(N[(N[(a2 * a2), $MachinePrecision] + N[(a1 * a1), $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos th \cdot \left(\left(a2 \cdot a2 + a1 \cdot a1\right) \cdot \sqrt{0.5}\right)
\end{array}
Initial program 99.3%
+-commutative99.3%
distribute-lft-out99.3%
Simplified99.3%
clear-num99.2%
associate-/r/99.2%
pow1/299.2%
pow-flip99.3%
metadata-eval99.3%
Applied egg-rr99.3%
Taylor expanded in th around inf 99.3%
*-commutative99.3%
unpow299.3%
unpow299.3%
Simplified99.3%
Final simplification99.3%
(FPCore (a1 a2 th) :precision binary64 (* a2 (* a2 (/ (cos th) (sqrt 2.0)))))
double code(double a1, double a2, double th) {
return a2 * (a2 * (cos(th) / sqrt(2.0)));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a2 * (a2 * (cos(th) / sqrt(2.0d0)))
end function
public static double code(double a1, double a2, double th) {
return a2 * (a2 * (Math.cos(th) / Math.sqrt(2.0)));
}
def code(a1, a2, th): return a2 * (a2 * (math.cos(th) / math.sqrt(2.0)))
function code(a1, a2, th) return Float64(a2 * Float64(a2 * Float64(cos(th) / sqrt(2.0)))) end
function tmp = code(a1, a2, th) tmp = a2 * (a2 * (cos(th) / sqrt(2.0))); end
code[a1_, a2_, th_] := N[(a2 * N[(a2 * N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a2 \cdot \left(a2 \cdot \frac{\cos th}{\sqrt{2}}\right)
\end{array}
Initial program 99.3%
+-commutative99.3%
distribute-lft-out99.3%
Simplified99.3%
Taylor expanded in a2 around inf 57.5%
unpow257.5%
associate-*r/57.5%
associate-*r*57.8%
Simplified57.8%
Final simplification57.8%
(FPCore (a1 a2 th) :precision binary64 (* (* (cos th) a2) (* a2 (sqrt 0.5))))
double code(double a1, double a2, double th) {
return (cos(th) * a2) * (a2 * sqrt(0.5));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = (cos(th) * a2) * (a2 * sqrt(0.5d0))
end function
public static double code(double a1, double a2, double th) {
return (Math.cos(th) * a2) * (a2 * Math.sqrt(0.5));
}
def code(a1, a2, th): return (math.cos(th) * a2) * (a2 * math.sqrt(0.5))
function code(a1, a2, th) return Float64(Float64(cos(th) * a2) * Float64(a2 * sqrt(0.5))) end
function tmp = code(a1, a2, th) tmp = (cos(th) * a2) * (a2 * sqrt(0.5)); end
code[a1_, a2_, th_] := N[(N[(N[Cos[th], $MachinePrecision] * a2), $MachinePrecision] * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos th \cdot a2\right) \cdot \left(a2 \cdot \sqrt{0.5}\right)
\end{array}
Initial program 99.3%
distribute-lft-out99.3%
cos-neg99.3%
associate-*l/99.3%
cos-neg99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 57.5%
unpow257.5%
*-commutative57.5%
Simplified57.5%
div-inv57.4%
associate-*r*57.4%
associate-*l*57.7%
add-sqr-sqrt57.7%
sqrt-unprod57.7%
frac-times57.7%
metadata-eval57.7%
add-sqr-sqrt57.8%
metadata-eval57.8%
Applied egg-rr57.8%
Final simplification57.8%
(FPCore (a1 a2 th)
:precision binary64
(if (<= th 1.55)
(/ (* a2 a2) (sqrt 2.0))
(if (or (<= th 7.5e+18) (not (<= th 1.25e+76)))
(* a2 (* a2 -0.5))
(* (* a2 a2) (/ 1.0 (sqrt 2.0))))))
double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = (a2 * a2) / sqrt(2.0);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = (a2 * a2) * (1.0 / sqrt(2.0));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 1.55d0) then
tmp = (a2 * a2) / sqrt(2.0d0)
else if ((th <= 7.5d+18) .or. (.not. (th <= 1.25d+76))) then
tmp = a2 * (a2 * (-0.5d0))
else
tmp = (a2 * a2) * (1.0d0 / sqrt(2.0d0))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = (a2 * a2) / Math.sqrt(2.0);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = (a2 * a2) * (1.0 / Math.sqrt(2.0));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if th <= 1.55: tmp = (a2 * a2) / math.sqrt(2.0) elif (th <= 7.5e+18) or not (th <= 1.25e+76): tmp = a2 * (a2 * -0.5) else: tmp = (a2 * a2) * (1.0 / math.sqrt(2.0)) return tmp
function code(a1, a2, th) tmp = 0.0 if (th <= 1.55) tmp = Float64(Float64(a2 * a2) / sqrt(2.0)); elseif ((th <= 7.5e+18) || !(th <= 1.25e+76)) tmp = Float64(a2 * Float64(a2 * -0.5)); else tmp = Float64(Float64(a2 * a2) * Float64(1.0 / sqrt(2.0))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (th <= 1.55) tmp = (a2 * a2) / sqrt(2.0); elseif ((th <= 7.5e+18) || ~((th <= 1.25e+76))) tmp = a2 * (a2 * -0.5); else tmp = (a2 * a2) * (1.0 / sqrt(2.0)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[th, 1.55], N[(N[(a2 * a2), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 7.5e+18], N[Not[LessEqual[th, 1.25e+76]], $MachinePrecision]], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(a2 * a2), $MachinePrecision] * N[(1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55:\\
\;\;\;\;\frac{a2 \cdot a2}{\sqrt{2}}\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+18} \lor \neg \left(th \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a2 \cdot a2\right) \cdot \frac{1}{\sqrt{2}}\\
\end{array}
\end{array}
if th < 1.55000000000000004Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.4%
Taylor expanded in a2 around inf 46.6%
unpow246.6%
Simplified46.6%
if 1.55000000000000004 < th < 7.5e18 or 1.24999999999999998e76 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 20.6%
Taylor expanded in a2 around inf 10.5%
unpow210.5%
Simplified10.5%
div-inv10.5%
add-sqr-sqrt10.5%
sqrt-unprod10.5%
frac-times10.5%
metadata-eval10.5%
add-sqr-sqrt10.5%
metadata-eval10.5%
Applied egg-rr10.5%
Applied egg-rr20.7%
*-lft-identity20.7%
*-inverses20.7%
associate-*l/20.7%
associate-/r/20.7%
*-inverses20.7%
metadata-eval20.7%
*-commutative20.7%
*-commutative20.7%
Simplified20.7%
if 7.5e18 < th < 1.24999999999999998e76Initial program 99.8%
+-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in th around 0 68.5%
Taylor expanded in a2 around inf 40.9%
unpow240.9%
Simplified40.9%
Final simplification41.5%
(FPCore (a1 a2 th)
:precision binary64
(if (<= th 1.55)
(/ (* a2 a2) (sqrt 2.0))
(if (or (<= th 7.5e+18) (not (<= th 1.25e+76)))
(* a2 (* a2 -0.5))
(/ 1.0 (/ (sqrt 2.0) (* a2 a2))))))
double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = (a2 * a2) / sqrt(2.0);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = 1.0 / (sqrt(2.0) / (a2 * a2));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 1.55d0) then
tmp = (a2 * a2) / sqrt(2.0d0)
else if ((th <= 7.5d+18) .or. (.not. (th <= 1.25d+76))) then
tmp = a2 * (a2 * (-0.5d0))
else
tmp = 1.0d0 / (sqrt(2.0d0) / (a2 * a2))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = (a2 * a2) / Math.sqrt(2.0);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = 1.0 / (Math.sqrt(2.0) / (a2 * a2));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if th <= 1.55: tmp = (a2 * a2) / math.sqrt(2.0) elif (th <= 7.5e+18) or not (th <= 1.25e+76): tmp = a2 * (a2 * -0.5) else: tmp = 1.0 / (math.sqrt(2.0) / (a2 * a2)) return tmp
function code(a1, a2, th) tmp = 0.0 if (th <= 1.55) tmp = Float64(Float64(a2 * a2) / sqrt(2.0)); elseif ((th <= 7.5e+18) || !(th <= 1.25e+76)) tmp = Float64(a2 * Float64(a2 * -0.5)); else tmp = Float64(1.0 / Float64(sqrt(2.0) / Float64(a2 * a2))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (th <= 1.55) tmp = (a2 * a2) / sqrt(2.0); elseif ((th <= 7.5e+18) || ~((th <= 1.25e+76))) tmp = a2 * (a2 * -0.5); else tmp = 1.0 / (sqrt(2.0) / (a2 * a2)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[th, 1.55], N[(N[(a2 * a2), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 7.5e+18], N[Not[LessEqual[th, 1.25e+76]], $MachinePrecision]], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[2.0], $MachinePrecision] / N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55:\\
\;\;\;\;\frac{a2 \cdot a2}{\sqrt{2}}\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+18} \lor \neg \left(th \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{2}}{a2 \cdot a2}}\\
\end{array}
\end{array}
if th < 1.55000000000000004Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.4%
Taylor expanded in a2 around inf 46.6%
unpow246.6%
Simplified46.6%
if 1.55000000000000004 < th < 7.5e18 or 1.24999999999999998e76 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 20.6%
Taylor expanded in a2 around inf 10.5%
unpow210.5%
Simplified10.5%
div-inv10.5%
add-sqr-sqrt10.5%
sqrt-unprod10.5%
frac-times10.5%
metadata-eval10.5%
add-sqr-sqrt10.5%
metadata-eval10.5%
Applied egg-rr10.5%
Applied egg-rr20.7%
*-lft-identity20.7%
*-inverses20.7%
associate-*l/20.7%
associate-/r/20.7%
*-inverses20.7%
metadata-eval20.7%
*-commutative20.7%
*-commutative20.7%
Simplified20.7%
if 7.5e18 < th < 1.24999999999999998e76Initial program 99.8%
+-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in th around 0 68.5%
Taylor expanded in a2 around inf 40.9%
unpow240.9%
associate-*r/40.9%
Simplified40.9%
associate-*r/40.9%
clear-num40.9%
Applied egg-rr40.9%
Final simplification41.5%
(FPCore (a1 a2 th)
:precision binary64
(if (<= th 1.55)
(* (+ (* a2 a2) (* a1 a1)) (sqrt 0.5))
(if (or (<= th 7.5e+18) (not (<= th 1.25e+76)))
(* a2 (* a2 -0.5))
(/ 1.0 (/ (sqrt 2.0) (* a2 a2))))))
double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = ((a2 * a2) + (a1 * a1)) * sqrt(0.5);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = 1.0 / (sqrt(2.0) / (a2 * a2));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 1.55d0) then
tmp = ((a2 * a2) + (a1 * a1)) * sqrt(0.5d0)
else if ((th <= 7.5d+18) .or. (.not. (th <= 1.25d+76))) then
tmp = a2 * (a2 * (-0.5d0))
else
tmp = 1.0d0 / (sqrt(2.0d0) / (a2 * a2))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = ((a2 * a2) + (a1 * a1)) * Math.sqrt(0.5);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = 1.0 / (Math.sqrt(2.0) / (a2 * a2));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if th <= 1.55: tmp = ((a2 * a2) + (a1 * a1)) * math.sqrt(0.5) elif (th <= 7.5e+18) or not (th <= 1.25e+76): tmp = a2 * (a2 * -0.5) else: tmp = 1.0 / (math.sqrt(2.0) / (a2 * a2)) return tmp
function code(a1, a2, th) tmp = 0.0 if (th <= 1.55) tmp = Float64(Float64(Float64(a2 * a2) + Float64(a1 * a1)) * sqrt(0.5)); elseif ((th <= 7.5e+18) || !(th <= 1.25e+76)) tmp = Float64(a2 * Float64(a2 * -0.5)); else tmp = Float64(1.0 / Float64(sqrt(2.0) / Float64(a2 * a2))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (th <= 1.55) tmp = ((a2 * a2) + (a1 * a1)) * sqrt(0.5); elseif ((th <= 7.5e+18) || ~((th <= 1.25e+76))) tmp = a2 * (a2 * -0.5); else tmp = 1.0 / (sqrt(2.0) / (a2 * a2)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[th, 1.55], N[(N[(N[(a2 * a2), $MachinePrecision] + N[(a1 * a1), $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 7.5e+18], N[Not[LessEqual[th, 1.25e+76]], $MachinePrecision]], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[2.0], $MachinePrecision] / N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55:\\
\;\;\;\;\left(a2 \cdot a2 + a1 \cdot a1\right) \cdot \sqrt{0.5}\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+18} \lor \neg \left(th \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{2}}{a2 \cdot a2}}\\
\end{array}
\end{array}
if th < 1.55000000000000004Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.4%
expm1-log1p-u73.4%
expm1-udef73.4%
add-sqr-sqrt73.4%
sqrt-unprod73.4%
frac-times73.4%
metadata-eval73.4%
add-sqr-sqrt73.0%
metadata-eval73.0%
Applied egg-rr73.0%
expm1-def73.0%
expm1-log1p73.4%
Simplified73.4%
if 1.55000000000000004 < th < 7.5e18 or 1.24999999999999998e76 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 20.6%
Taylor expanded in a2 around inf 10.5%
unpow210.5%
Simplified10.5%
div-inv10.5%
add-sqr-sqrt10.5%
sqrt-unprod10.5%
frac-times10.5%
metadata-eval10.5%
add-sqr-sqrt10.5%
metadata-eval10.5%
Applied egg-rr10.5%
Applied egg-rr20.7%
*-lft-identity20.7%
*-inverses20.7%
associate-*l/20.7%
associate-/r/20.7%
*-inverses20.7%
metadata-eval20.7%
*-commutative20.7%
*-commutative20.7%
Simplified20.7%
if 7.5e18 < th < 1.24999999999999998e76Initial program 99.8%
+-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in th around 0 68.5%
Taylor expanded in a2 around inf 40.9%
unpow240.9%
associate-*r/40.9%
Simplified40.9%
associate-*r/40.9%
clear-num40.9%
Applied egg-rr40.9%
Final simplification62.5%
(FPCore (a1 a2 th) :precision binary64 (if (or (<= th 1.55) (and (not (<= th 7.5e+18)) (<= th 1.25e+76))) (* a2 (/ a2 (sqrt 2.0))) (* a2 (* a2 -0.5))))
double code(double a1, double a2, double th) {
double tmp;
if ((th <= 1.55) || (!(th <= 7.5e+18) && (th <= 1.25e+76))) {
tmp = a2 * (a2 / sqrt(2.0));
} else {
tmp = a2 * (a2 * -0.5);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if ((th <= 1.55d0) .or. (.not. (th <= 7.5d+18)) .and. (th <= 1.25d+76)) then
tmp = a2 * (a2 / sqrt(2.0d0))
else
tmp = a2 * (a2 * (-0.5d0))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if ((th <= 1.55) || (!(th <= 7.5e+18) && (th <= 1.25e+76))) {
tmp = a2 * (a2 / Math.sqrt(2.0));
} else {
tmp = a2 * (a2 * -0.5);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if (th <= 1.55) or (not (th <= 7.5e+18) and (th <= 1.25e+76)): tmp = a2 * (a2 / math.sqrt(2.0)) else: tmp = a2 * (a2 * -0.5) return tmp
function code(a1, a2, th) tmp = 0.0 if ((th <= 1.55) || (!(th <= 7.5e+18) && (th <= 1.25e+76))) tmp = Float64(a2 * Float64(a2 / sqrt(2.0))); else tmp = Float64(a2 * Float64(a2 * -0.5)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if ((th <= 1.55) || (~((th <= 7.5e+18)) && (th <= 1.25e+76))) tmp = a2 * (a2 / sqrt(2.0)); else tmp = a2 * (a2 * -0.5); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[Or[LessEqual[th, 1.55], And[N[Not[LessEqual[th, 7.5e+18]], $MachinePrecision], LessEqual[th, 1.25e+76]]], N[(a2 * N[(a2 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55 \lor \neg \left(th \leq 7.5 \cdot 10^{+18}\right) \land th \leq 1.25 \cdot 10^{+76}:\\
\;\;\;\;a2 \cdot \frac{a2}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\end{array}
\end{array}
if th < 1.55000000000000004 or 7.5e18 < th < 1.24999999999999998e76Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.2%
Taylor expanded in a2 around inf 46.3%
unpow246.3%
associate-*r/46.3%
Simplified46.3%
if 1.55000000000000004 < th < 7.5e18 or 1.24999999999999998e76 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 20.6%
Taylor expanded in a2 around inf 10.5%
unpow210.5%
Simplified10.5%
div-inv10.5%
add-sqr-sqrt10.5%
sqrt-unprod10.5%
frac-times10.5%
metadata-eval10.5%
add-sqr-sqrt10.5%
metadata-eval10.5%
Applied egg-rr10.5%
Applied egg-rr20.7%
*-lft-identity20.7%
*-inverses20.7%
associate-*l/20.7%
associate-/r/20.7%
*-inverses20.7%
metadata-eval20.7%
*-commutative20.7%
*-commutative20.7%
Simplified20.7%
Final simplification41.5%
(FPCore (a1 a2 th)
:precision binary64
(if (<= th 1.55)
(* a2 (/ a2 (sqrt 2.0)))
(if (or (<= th 7.5e+18) (not (<= th 1.25e+76)))
(* a2 (* a2 -0.5))
(* a2 (* a2 (sqrt 0.5))))))
double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = a2 * (a2 / sqrt(2.0));
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = a2 * (a2 * sqrt(0.5));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 1.55d0) then
tmp = a2 * (a2 / sqrt(2.0d0))
else if ((th <= 7.5d+18) .or. (.not. (th <= 1.25d+76))) then
tmp = a2 * (a2 * (-0.5d0))
else
tmp = a2 * (a2 * sqrt(0.5d0))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = a2 * (a2 / Math.sqrt(2.0));
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = a2 * (a2 * Math.sqrt(0.5));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if th <= 1.55: tmp = a2 * (a2 / math.sqrt(2.0)) elif (th <= 7.5e+18) or not (th <= 1.25e+76): tmp = a2 * (a2 * -0.5) else: tmp = a2 * (a2 * math.sqrt(0.5)) return tmp
function code(a1, a2, th) tmp = 0.0 if (th <= 1.55) tmp = Float64(a2 * Float64(a2 / sqrt(2.0))); elseif ((th <= 7.5e+18) || !(th <= 1.25e+76)) tmp = Float64(a2 * Float64(a2 * -0.5)); else tmp = Float64(a2 * Float64(a2 * sqrt(0.5))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (th <= 1.55) tmp = a2 * (a2 / sqrt(2.0)); elseif ((th <= 7.5e+18) || ~((th <= 1.25e+76))) tmp = a2 * (a2 * -0.5); else tmp = a2 * (a2 * sqrt(0.5)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[th, 1.55], N[(a2 * N[(a2 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 7.5e+18], N[Not[LessEqual[th, 1.25e+76]], $MachinePrecision]], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55:\\
\;\;\;\;a2 \cdot \frac{a2}{\sqrt{2}}\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+18} \lor \neg \left(th \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if th < 1.55000000000000004Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.4%
Taylor expanded in a2 around inf 46.6%
unpow246.6%
associate-*r/46.5%
Simplified46.5%
if 1.55000000000000004 < th < 7.5e18 or 1.24999999999999998e76 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 20.6%
Taylor expanded in a2 around inf 10.5%
unpow210.5%
Simplified10.5%
div-inv10.5%
add-sqr-sqrt10.5%
sqrt-unprod10.5%
frac-times10.5%
metadata-eval10.5%
add-sqr-sqrt10.5%
metadata-eval10.5%
Applied egg-rr10.5%
Applied egg-rr20.7%
*-lft-identity20.7%
*-inverses20.7%
associate-*l/20.7%
associate-/r/20.7%
*-inverses20.7%
metadata-eval20.7%
*-commutative20.7%
*-commutative20.7%
Simplified20.7%
if 7.5e18 < th < 1.24999999999999998e76Initial program 99.8%
+-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in th around 0 68.5%
Taylor expanded in a2 around inf 40.9%
unpow240.9%
Simplified40.9%
*-un-lft-identity40.9%
associate-*l/40.9%
associate-*r*40.9%
add-sqr-sqrt40.9%
sqrt-unprod40.9%
frac-times40.9%
metadata-eval40.9%
add-sqr-sqrt40.9%
metadata-eval40.9%
Applied egg-rr40.9%
Final simplification41.5%
(FPCore (a1 a2 th)
:precision binary64
(if (<= th 1.55)
(* a2 (/ a2 (sqrt 2.0)))
(if (or (<= th 7.5e+18) (not (<= th 1.25e+76)))
(* a2 (* a2 -0.5))
(/ a2 (/ (sqrt 2.0) a2)))))
double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = a2 * (a2 / sqrt(2.0));
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = a2 / (sqrt(2.0) / a2);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 1.55d0) then
tmp = a2 * (a2 / sqrt(2.0d0))
else if ((th <= 7.5d+18) .or. (.not. (th <= 1.25d+76))) then
tmp = a2 * (a2 * (-0.5d0))
else
tmp = a2 / (sqrt(2.0d0) / a2)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = a2 * (a2 / Math.sqrt(2.0));
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = a2 / (Math.sqrt(2.0) / a2);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if th <= 1.55: tmp = a2 * (a2 / math.sqrt(2.0)) elif (th <= 7.5e+18) or not (th <= 1.25e+76): tmp = a2 * (a2 * -0.5) else: tmp = a2 / (math.sqrt(2.0) / a2) return tmp
function code(a1, a2, th) tmp = 0.0 if (th <= 1.55) tmp = Float64(a2 * Float64(a2 / sqrt(2.0))); elseif ((th <= 7.5e+18) || !(th <= 1.25e+76)) tmp = Float64(a2 * Float64(a2 * -0.5)); else tmp = Float64(a2 / Float64(sqrt(2.0) / a2)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (th <= 1.55) tmp = a2 * (a2 / sqrt(2.0)); elseif ((th <= 7.5e+18) || ~((th <= 1.25e+76))) tmp = a2 * (a2 * -0.5); else tmp = a2 / (sqrt(2.0) / a2); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[th, 1.55], N[(a2 * N[(a2 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 7.5e+18], N[Not[LessEqual[th, 1.25e+76]], $MachinePrecision]], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision], N[(a2 / N[(N[Sqrt[2.0], $MachinePrecision] / a2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55:\\
\;\;\;\;a2 \cdot \frac{a2}{\sqrt{2}}\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+18} \lor \neg \left(th \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{\frac{\sqrt{2}}{a2}}\\
\end{array}
\end{array}
if th < 1.55000000000000004Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.4%
Taylor expanded in a2 around inf 46.6%
unpow246.6%
associate-*r/46.5%
Simplified46.5%
if 1.55000000000000004 < th < 7.5e18 or 1.24999999999999998e76 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 20.6%
Taylor expanded in a2 around inf 10.5%
unpow210.5%
Simplified10.5%
div-inv10.5%
add-sqr-sqrt10.5%
sqrt-unprod10.5%
frac-times10.5%
metadata-eval10.5%
add-sqr-sqrt10.5%
metadata-eval10.5%
Applied egg-rr10.5%
Applied egg-rr20.7%
*-lft-identity20.7%
*-inverses20.7%
associate-*l/20.7%
associate-/r/20.7%
*-inverses20.7%
metadata-eval20.7%
*-commutative20.7%
*-commutative20.7%
Simplified20.7%
if 7.5e18 < th < 1.24999999999999998e76Initial program 99.8%
+-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in th around 0 68.5%
Taylor expanded in a2 around inf 40.9%
unpow240.9%
associate-*r/40.9%
Simplified40.9%
clear-num40.9%
un-div-inv40.9%
Applied egg-rr40.9%
Final simplification41.5%
(FPCore (a1 a2 th)
:precision binary64
(if (<= th 1.55)
(/ (* a2 a2) (sqrt 2.0))
(if (or (<= th 7.5e+18) (not (<= th 1.25e+76)))
(* a2 (* a2 -0.5))
(/ a2 (/ (sqrt 2.0) a2)))))
double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = (a2 * a2) / sqrt(2.0);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = a2 / (sqrt(2.0) / a2);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 1.55d0) then
tmp = (a2 * a2) / sqrt(2.0d0)
else if ((th <= 7.5d+18) .or. (.not. (th <= 1.25d+76))) then
tmp = a2 * (a2 * (-0.5d0))
else
tmp = a2 / (sqrt(2.0d0) / a2)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = (a2 * a2) / Math.sqrt(2.0);
} else if ((th <= 7.5e+18) || !(th <= 1.25e+76)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = a2 / (Math.sqrt(2.0) / a2);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if th <= 1.55: tmp = (a2 * a2) / math.sqrt(2.0) elif (th <= 7.5e+18) or not (th <= 1.25e+76): tmp = a2 * (a2 * -0.5) else: tmp = a2 / (math.sqrt(2.0) / a2) return tmp
function code(a1, a2, th) tmp = 0.0 if (th <= 1.55) tmp = Float64(Float64(a2 * a2) / sqrt(2.0)); elseif ((th <= 7.5e+18) || !(th <= 1.25e+76)) tmp = Float64(a2 * Float64(a2 * -0.5)); else tmp = Float64(a2 / Float64(sqrt(2.0) / a2)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (th <= 1.55) tmp = (a2 * a2) / sqrt(2.0); elseif ((th <= 7.5e+18) || ~((th <= 1.25e+76))) tmp = a2 * (a2 * -0.5); else tmp = a2 / (sqrt(2.0) / a2); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[th, 1.55], N[(N[(a2 * a2), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 7.5e+18], N[Not[LessEqual[th, 1.25e+76]], $MachinePrecision]], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision], N[(a2 / N[(N[Sqrt[2.0], $MachinePrecision] / a2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55:\\
\;\;\;\;\frac{a2 \cdot a2}{\sqrt{2}}\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+18} \lor \neg \left(th \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{\frac{\sqrt{2}}{a2}}\\
\end{array}
\end{array}
if th < 1.55000000000000004Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.4%
Taylor expanded in a2 around inf 46.6%
unpow246.6%
Simplified46.6%
if 1.55000000000000004 < th < 7.5e18 or 1.24999999999999998e76 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 20.6%
Taylor expanded in a2 around inf 10.5%
unpow210.5%
Simplified10.5%
div-inv10.5%
add-sqr-sqrt10.5%
sqrt-unprod10.5%
frac-times10.5%
metadata-eval10.5%
add-sqr-sqrt10.5%
metadata-eval10.5%
Applied egg-rr10.5%
Applied egg-rr20.7%
*-lft-identity20.7%
*-inverses20.7%
associate-*l/20.7%
associate-/r/20.7%
*-inverses20.7%
metadata-eval20.7%
*-commutative20.7%
*-commutative20.7%
Simplified20.7%
if 7.5e18 < th < 1.24999999999999998e76Initial program 99.8%
+-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in th around 0 68.5%
Taylor expanded in a2 around inf 40.9%
unpow240.9%
associate-*r/40.9%
Simplified40.9%
clear-num40.9%
un-div-inv40.9%
Applied egg-rr40.9%
Final simplification41.5%
(FPCore (a1 a2 th)
:precision binary64
(if (<= th 1.55)
(* a2 a2)
(if (or (<= th 7.5e+18) (not (<= th 4.4e+73)))
(* a2 (* a2 -0.5))
(* (* a2 -0.5) (- a2)))))
double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = a2 * a2;
} else if ((th <= 7.5e+18) || !(th <= 4.4e+73)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = (a2 * -0.5) * -a2;
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (th <= 1.55d0) then
tmp = a2 * a2
else if ((th <= 7.5d+18) .or. (.not. (th <= 4.4d+73))) then
tmp = a2 * (a2 * (-0.5d0))
else
tmp = (a2 * (-0.5d0)) * -a2
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (th <= 1.55) {
tmp = a2 * a2;
} else if ((th <= 7.5e+18) || !(th <= 4.4e+73)) {
tmp = a2 * (a2 * -0.5);
} else {
tmp = (a2 * -0.5) * -a2;
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if th <= 1.55: tmp = a2 * a2 elif (th <= 7.5e+18) or not (th <= 4.4e+73): tmp = a2 * (a2 * -0.5) else: tmp = (a2 * -0.5) * -a2 return tmp
function code(a1, a2, th) tmp = 0.0 if (th <= 1.55) tmp = Float64(a2 * a2); elseif ((th <= 7.5e+18) || !(th <= 4.4e+73)) tmp = Float64(a2 * Float64(a2 * -0.5)); else tmp = Float64(Float64(a2 * -0.5) * Float64(-a2)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (th <= 1.55) tmp = a2 * a2; elseif ((th <= 7.5e+18) || ~((th <= 4.4e+73))) tmp = a2 * (a2 * -0.5); else tmp = (a2 * -0.5) * -a2; end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[th, 1.55], N[(a2 * a2), $MachinePrecision], If[Or[LessEqual[th, 7.5e+18], N[Not[LessEqual[th, 4.4e+73]], $MachinePrecision]], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(a2 * -0.5), $MachinePrecision] * (-a2)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55:\\
\;\;\;\;a2 \cdot a2\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+18} \lor \neg \left(th \leq 4.4 \cdot 10^{+73}\right):\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a2 \cdot -0.5\right) \cdot \left(-a2\right)\\
\end{array}
\end{array}
if th < 1.55000000000000004Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.4%
Taylor expanded in a2 around inf 46.6%
unpow246.6%
associate-*r/46.5%
Simplified46.5%
frac-2neg46.5%
div-inv46.5%
Applied egg-rr46.5%
Applied egg-rr33.9%
if 1.55000000000000004 < th < 7.5e18 or 4.4e73 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 22.2%
Taylor expanded in a2 around inf 12.3%
unpow212.3%
Simplified12.3%
div-inv12.3%
add-sqr-sqrt12.3%
sqrt-unprod12.3%
frac-times12.3%
metadata-eval12.3%
add-sqr-sqrt12.3%
metadata-eval12.3%
Applied egg-rr12.3%
Applied egg-rr20.3%
*-lft-identity20.3%
*-inverses20.3%
associate-*l/20.3%
associate-/r/20.3%
*-inverses20.3%
metadata-eval20.3%
*-commutative20.3%
*-commutative20.3%
Simplified20.3%
if 7.5e18 < th < 4.4e73Initial program 99.8%
+-commutative99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in th around 0 64.0%
Taylor expanded in a2 around inf 32.5%
unpow232.5%
associate-*r/32.5%
Simplified32.5%
frac-2neg32.5%
div-inv32.5%
Applied egg-rr32.5%
Applied egg-rr32.5%
Final simplification31.3%
(FPCore (a1 a2 th) :precision binary64 (if (or (<= th 1.55) (and (not (<= th 7.5e+18)) (<= th 4.4e+73))) (* a2 a2) (* a2 (* a2 -0.5))))
double code(double a1, double a2, double th) {
double tmp;
if ((th <= 1.55) || (!(th <= 7.5e+18) && (th <= 4.4e+73))) {
tmp = a2 * a2;
} else {
tmp = a2 * (a2 * -0.5);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if ((th <= 1.55d0) .or. (.not. (th <= 7.5d+18)) .and. (th <= 4.4d+73)) then
tmp = a2 * a2
else
tmp = a2 * (a2 * (-0.5d0))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if ((th <= 1.55) || (!(th <= 7.5e+18) && (th <= 4.4e+73))) {
tmp = a2 * a2;
} else {
tmp = a2 * (a2 * -0.5);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if (th <= 1.55) or (not (th <= 7.5e+18) and (th <= 4.4e+73)): tmp = a2 * a2 else: tmp = a2 * (a2 * -0.5) return tmp
function code(a1, a2, th) tmp = 0.0 if ((th <= 1.55) || (!(th <= 7.5e+18) && (th <= 4.4e+73))) tmp = Float64(a2 * a2); else tmp = Float64(a2 * Float64(a2 * -0.5)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if ((th <= 1.55) || (~((th <= 7.5e+18)) && (th <= 4.4e+73))) tmp = a2 * a2; else tmp = a2 * (a2 * -0.5); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[Or[LessEqual[th, 1.55], And[N[Not[LessEqual[th, 7.5e+18]], $MachinePrecision], LessEqual[th, 4.4e+73]]], N[(a2 * a2), $MachinePrecision], N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.55 \lor \neg \left(th \leq 7.5 \cdot 10^{+18}\right) \land th \leq 4.4 \cdot 10^{+73}:\\
\;\;\;\;a2 \cdot a2\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \left(a2 \cdot -0.5\right)\\
\end{array}
\end{array}
if th < 1.55000000000000004 or 7.5e18 < th < 4.4e73Initial program 99.2%
+-commutative99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 73.1%
Taylor expanded in a2 around inf 46.1%
unpow246.1%
associate-*r/46.1%
Simplified46.1%
frac-2neg46.1%
div-inv46.0%
Applied egg-rr46.0%
Applied egg-rr33.9%
if 1.55000000000000004 < th < 7.5e18 or 4.4e73 < th Initial program 99.5%
+-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 22.2%
Taylor expanded in a2 around inf 12.3%
unpow212.3%
Simplified12.3%
div-inv12.3%
add-sqr-sqrt12.3%
sqrt-unprod12.3%
frac-times12.3%
metadata-eval12.3%
add-sqr-sqrt12.3%
metadata-eval12.3%
Applied egg-rr12.3%
Applied egg-rr20.3%
*-lft-identity20.3%
*-inverses20.3%
associate-*l/20.3%
associate-/r/20.3%
*-inverses20.3%
metadata-eval20.3%
*-commutative20.3%
*-commutative20.3%
Simplified20.3%
Final simplification31.3%
(FPCore (a1 a2 th) :precision binary64 (* a2 (* a2 -0.5)))
double code(double a1, double a2, double th) {
return a2 * (a2 * -0.5);
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a2 * (a2 * (-0.5d0))
end function
public static double code(double a1, double a2, double th) {
return a2 * (a2 * -0.5);
}
def code(a1, a2, th): return a2 * (a2 * -0.5)
function code(a1, a2, th) return Float64(a2 * Float64(a2 * -0.5)) end
function tmp = code(a1, a2, th) tmp = a2 * (a2 * -0.5); end
code[a1_, a2_, th_] := N[(a2 * N[(a2 * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a2 \cdot \left(a2 \cdot -0.5\right)
\end{array}
Initial program 99.3%
+-commutative99.3%
distribute-lft-out99.3%
Simplified99.3%
Taylor expanded in th around 0 63.3%
Taylor expanded in a2 around inf 39.6%
unpow239.6%
Simplified39.6%
div-inv39.6%
add-sqr-sqrt39.6%
sqrt-unprod39.6%
frac-times39.6%
metadata-eval39.6%
add-sqr-sqrt39.6%
metadata-eval39.6%
Applied egg-rr39.6%
Applied egg-rr14.6%
*-lft-identity14.6%
*-inverses14.6%
associate-*l/14.6%
associate-/r/14.6%
*-inverses14.6%
metadata-eval14.6%
*-commutative14.6%
*-commutative14.6%
Simplified14.6%
Final simplification14.6%
(FPCore (a1 a2 th) :precision binary64 a1)
double code(double a1, double a2, double th) {
return a1;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a1
end function
public static double code(double a1, double a2, double th) {
return a1;
}
def code(a1, a2, th): return a1
function code(a1, a2, th) return a1 end
function tmp = code(a1, a2, th) tmp = a1; end
code[a1_, a2_, th_] := a1
\begin{array}{l}
\\
a1
\end{array}
Initial program 99.3%
+-commutative99.3%
distribute-lft-out99.3%
Simplified99.3%
Taylor expanded in th around 0 63.3%
Taylor expanded in a2 around 0 37.6%
unpow237.6%
Simplified37.6%
Applied egg-rr4.6%
unpow14.6%
*-inverses4.6%
sqr-pow2.4%
fabs-sqr2.4%
sqr-pow3.7%
*-inverses3.7%
unpow13.7%
Simplified3.7%
Final simplification3.7%
(FPCore (a1 a2 th) :precision binary64 a2)
double code(double a1, double a2, double th) {
return a2;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a2
end function
public static double code(double a1, double a2, double th) {
return a2;
}
def code(a1, a2, th): return a2
function code(a1, a2, th) return a2 end
function tmp = code(a1, a2, th) tmp = a2; end
code[a1_, a2_, th_] := a2
\begin{array}{l}
\\
a2
\end{array}
Initial program 99.3%
+-commutative99.3%
distribute-lft-out99.3%
Simplified99.3%
Taylor expanded in th around 0 63.3%
Taylor expanded in a2 around inf 39.6%
unpow239.6%
Simplified39.6%
div-inv39.6%
add-sqr-sqrt39.6%
sqrt-unprod39.6%
frac-times39.6%
metadata-eval39.6%
add-sqr-sqrt39.6%
metadata-eval39.6%
Applied egg-rr39.6%
Applied egg-rr3.7%
Final simplification3.7%
herbie shell --seed 2023277
(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))))