
(FPCore (x y) :precision binary64 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y): return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y) return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) end
function tmp = code(x, y) tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
double code(double x, double y) {
return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (3.0d0 * sqrt(x)) * ((y + (1.0d0 / (x * 9.0d0))) - 1.0d0)
end function
public static double code(double x, double y) {
return (3.0 * Math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
def code(x, y): return (3.0 * math.sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0)
function code(x, y) return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0)) end
function tmp = code(x, y) tmp = (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0); end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\end{array}
(FPCore (x y) :precision binary64 (* (sqrt (* x 9.0)) (+ (+ y (/ 1.0 (* x 9.0))) -1.0)))
double code(double x, double y) {
return sqrt((x * 9.0)) * ((y + (1.0 / (x * 9.0))) + -1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt((x * 9.0d0)) * ((y + (1.0d0 / (x * 9.0d0))) + (-1.0d0))
end function
public static double code(double x, double y) {
return Math.sqrt((x * 9.0)) * ((y + (1.0 / (x * 9.0))) + -1.0);
}
def code(x, y): return math.sqrt((x * 9.0)) * ((y + (1.0 / (x * 9.0))) + -1.0)
function code(x, y) return Float64(sqrt(Float64(x * 9.0)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) + -1.0)) end
function tmp = code(x, y) tmp = sqrt((x * 9.0)) * ((y + (1.0 / (x * 9.0))) + -1.0); end
code[x_, y_] := N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x \cdot 9} \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) + -1\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
metadata-eval99.4%
sqrt-prod99.6%
pow1/299.6%
Applied egg-rr99.6%
unpow1/299.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (sqrt x) -3.0)))
(if (<= x 1.68e-15)
(* (sqrt x) (/ 0.3333333333333333 x))
(if (<= x 3.1e+119)
(* (sqrt (* x 9.0)) y)
(if (<= x 7.6e+202)
t_0
(if (<= x 2.6e+209)
(* 3.0 (* y (sqrt x)))
(if (or (<= x 1.25e+232) (not (<= x 1e+283)))
t_0
(* (sqrt x) (* y 3.0)))))))))
double code(double x, double y) {
double t_0 = sqrt(x) * -3.0;
double tmp;
if (x <= 1.68e-15) {
tmp = sqrt(x) * (0.3333333333333333 / x);
} else if (x <= 3.1e+119) {
tmp = sqrt((x * 9.0)) * y;
} else if (x <= 7.6e+202) {
tmp = t_0;
} else if (x <= 2.6e+209) {
tmp = 3.0 * (y * sqrt(x));
} else if ((x <= 1.25e+232) || !(x <= 1e+283)) {
tmp = t_0;
} else {
tmp = sqrt(x) * (y * 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(x) * (-3.0d0)
if (x <= 1.68d-15) then
tmp = sqrt(x) * (0.3333333333333333d0 / x)
else if (x <= 3.1d+119) then
tmp = sqrt((x * 9.0d0)) * y
else if (x <= 7.6d+202) then
tmp = t_0
else if (x <= 2.6d+209) then
tmp = 3.0d0 * (y * sqrt(x))
else if ((x <= 1.25d+232) .or. (.not. (x <= 1d+283))) then
tmp = t_0
else
tmp = sqrt(x) * (y * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sqrt(x) * -3.0;
double tmp;
if (x <= 1.68e-15) {
tmp = Math.sqrt(x) * (0.3333333333333333 / x);
} else if (x <= 3.1e+119) {
tmp = Math.sqrt((x * 9.0)) * y;
} else if (x <= 7.6e+202) {
tmp = t_0;
} else if (x <= 2.6e+209) {
tmp = 3.0 * (y * Math.sqrt(x));
} else if ((x <= 1.25e+232) || !(x <= 1e+283)) {
tmp = t_0;
} else {
tmp = Math.sqrt(x) * (y * 3.0);
}
return tmp;
}
def code(x, y): t_0 = math.sqrt(x) * -3.0 tmp = 0 if x <= 1.68e-15: tmp = math.sqrt(x) * (0.3333333333333333 / x) elif x <= 3.1e+119: tmp = math.sqrt((x * 9.0)) * y elif x <= 7.6e+202: tmp = t_0 elif x <= 2.6e+209: tmp = 3.0 * (y * math.sqrt(x)) elif (x <= 1.25e+232) or not (x <= 1e+283): tmp = t_0 else: tmp = math.sqrt(x) * (y * 3.0) return tmp
function code(x, y) t_0 = Float64(sqrt(x) * -3.0) tmp = 0.0 if (x <= 1.68e-15) tmp = Float64(sqrt(x) * Float64(0.3333333333333333 / x)); elseif (x <= 3.1e+119) tmp = Float64(sqrt(Float64(x * 9.0)) * y); elseif (x <= 7.6e+202) tmp = t_0; elseif (x <= 2.6e+209) tmp = Float64(3.0 * Float64(y * sqrt(x))); elseif ((x <= 1.25e+232) || !(x <= 1e+283)) tmp = t_0; else tmp = Float64(sqrt(x) * Float64(y * 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = sqrt(x) * -3.0; tmp = 0.0; if (x <= 1.68e-15) tmp = sqrt(x) * (0.3333333333333333 / x); elseif (x <= 3.1e+119) tmp = sqrt((x * 9.0)) * y; elseif (x <= 7.6e+202) tmp = t_0; elseif (x <= 2.6e+209) tmp = 3.0 * (y * sqrt(x)); elseif ((x <= 1.25e+232) || ~((x <= 1e+283))) tmp = t_0; else tmp = sqrt(x) * (y * 3.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]}, If[LessEqual[x, 1.68e-15], N[(N[Sqrt[x], $MachinePrecision] * N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.1e+119], N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision], If[LessEqual[x, 7.6e+202], t$95$0, If[LessEqual[x, 2.6e+209], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 1.25e+232], N[Not[LessEqual[x, 1e+283]], $MachinePrecision]], t$95$0, N[(N[Sqrt[x], $MachinePrecision] * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x} \cdot -3\\
\mathbf{if}\;x \leq 1.68 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{x} \cdot \frac{0.3333333333333333}{x}\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{x \cdot 9} \cdot y\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{+202}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+209}:\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+232} \lor \neg \left(x \leq 10^{+283}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(y \cdot 3\right)\\
\end{array}
\end{array}
if x < 1.6800000000000001e-15Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.2%
sub-neg99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
metadata-eval99.2%
*-commutative99.2%
associate-/r*99.2%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 79.3%
if 1.6800000000000001e-15 < x < 3.09999999999999995e119Initial program 99.5%
*-commutative99.5%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.5%
fma-define99.5%
sub-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-/r*99.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around inf 52.8%
pow152.8%
*-commutative52.8%
*-commutative52.8%
associate-*l*52.9%
metadata-eval52.9%
sqrt-prod53.0%
Applied egg-rr53.0%
unpow153.0%
Simplified53.0%
if 3.09999999999999995e119 < x < 7.6000000000000001e202 or 2.6e209 < x < 1.24999999999999997e232 or 9.99999999999999955e282 < x Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 99.6%
Taylor expanded in y around 0 70.8%
*-commutative70.8%
Simplified70.8%
if 7.6000000000000001e202 < x < 2.6e209Initial program 100.0%
*-commutative100.0%
associate-*l*99.7%
associate--l+99.7%
distribute-lft-in99.7%
fma-define100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if 1.24999999999999997e232 < x < 9.99999999999999955e282Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
associate--l+99.7%
distribute-lft-in99.7%
fma-define99.6%
sub-neg99.6%
+-commutative99.6%
distribute-lft-in99.6%
metadata-eval99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 61.7%
*-commutative61.7%
associate-*l*61.7%
*-commutative61.7%
Simplified61.7%
Final simplification70.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (sqrt (* x 9.0)) y)))
(if (<= y -5.2e+104)
t_0
(if (<= y 180000000.0)
(* (sqrt x) (+ (/ 0.3333333333333333 x) -3.0))
(if (<= y 7.4e+80)
t_0
(if (<= y 9.9e+126)
(/ (* (sqrt x) 0.3333333333333333) x)
(* y (* (sqrt x) 3.0))))))))
double code(double x, double y) {
double t_0 = sqrt((x * 9.0)) * y;
double tmp;
if (y <= -5.2e+104) {
tmp = t_0;
} else if (y <= 180000000.0) {
tmp = sqrt(x) * ((0.3333333333333333 / x) + -3.0);
} else if (y <= 7.4e+80) {
tmp = t_0;
} else if (y <= 9.9e+126) {
tmp = (sqrt(x) * 0.3333333333333333) / x;
} else {
tmp = y * (sqrt(x) * 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((x * 9.0d0)) * y
if (y <= (-5.2d+104)) then
tmp = t_0
else if (y <= 180000000.0d0) then
tmp = sqrt(x) * ((0.3333333333333333d0 / x) + (-3.0d0))
else if (y <= 7.4d+80) then
tmp = t_0
else if (y <= 9.9d+126) then
tmp = (sqrt(x) * 0.3333333333333333d0) / x
else
tmp = y * (sqrt(x) * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sqrt((x * 9.0)) * y;
double tmp;
if (y <= -5.2e+104) {
tmp = t_0;
} else if (y <= 180000000.0) {
tmp = Math.sqrt(x) * ((0.3333333333333333 / x) + -3.0);
} else if (y <= 7.4e+80) {
tmp = t_0;
} else if (y <= 9.9e+126) {
tmp = (Math.sqrt(x) * 0.3333333333333333) / x;
} else {
tmp = y * (Math.sqrt(x) * 3.0);
}
return tmp;
}
def code(x, y): t_0 = math.sqrt((x * 9.0)) * y tmp = 0 if y <= -5.2e+104: tmp = t_0 elif y <= 180000000.0: tmp = math.sqrt(x) * ((0.3333333333333333 / x) + -3.0) elif y <= 7.4e+80: tmp = t_0 elif y <= 9.9e+126: tmp = (math.sqrt(x) * 0.3333333333333333) / x else: tmp = y * (math.sqrt(x) * 3.0) return tmp
function code(x, y) t_0 = Float64(sqrt(Float64(x * 9.0)) * y) tmp = 0.0 if (y <= -5.2e+104) tmp = t_0; elseif (y <= 180000000.0) tmp = Float64(sqrt(x) * Float64(Float64(0.3333333333333333 / x) + -3.0)); elseif (y <= 7.4e+80) tmp = t_0; elseif (y <= 9.9e+126) tmp = Float64(Float64(sqrt(x) * 0.3333333333333333) / x); else tmp = Float64(y * Float64(sqrt(x) * 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = sqrt((x * 9.0)) * y; tmp = 0.0; if (y <= -5.2e+104) tmp = t_0; elseif (y <= 180000000.0) tmp = sqrt(x) * ((0.3333333333333333 / x) + -3.0); elseif (y <= 7.4e+80) tmp = t_0; elseif (y <= 9.9e+126) tmp = (sqrt(x) * 0.3333333333333333) / x; else tmp = y * (sqrt(x) * 3.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -5.2e+104], t$95$0, If[LessEqual[y, 180000000.0], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(0.3333333333333333 / x), $MachinePrecision] + -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.4e+80], t$95$0, If[LessEqual[y, 9.9e+126], N[(N[(N[Sqrt[x], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x \cdot 9} \cdot y\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 180000000:\\
\;\;\;\;\sqrt{x} \cdot \left(\frac{0.3333333333333333}{x} + -3\right)\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+80}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 9.9 \cdot 10^{+126}:\\
\;\;\;\;\frac{\sqrt{x} \cdot 0.3333333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\sqrt{x} \cdot 3\right)\\
\end{array}
\end{array}
if y < -5.20000000000000001e104 or 1.8e8 < y < 7.39999999999999992e80Initial program 99.5%
*-commutative99.5%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.2%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 77.1%
pow177.1%
*-commutative77.1%
*-commutative77.1%
associate-*l*77.2%
metadata-eval77.2%
sqrt-prod77.3%
Applied egg-rr77.3%
unpow177.3%
Simplified77.3%
if -5.20000000000000001e104 < y < 1.8e8Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around 0 91.8%
sub-neg91.8%
associate-*r/91.8%
metadata-eval91.8%
metadata-eval91.8%
Simplified91.8%
if 7.39999999999999992e80 < y < 9.8999999999999998e126Initial program 99.3%
sub-neg99.3%
+-commutative99.3%
associate-+l+99.3%
*-commutative99.3%
associate-/r*99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 75.3%
associate-*r/75.3%
*-commutative75.3%
associate-*l*75.5%
metadata-eval75.5%
Applied egg-rr75.5%
if 9.8999999999999998e126 < y Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
associate-+l+99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 92.8%
Final simplification88.4%
(FPCore (x y) :precision binary64 (if (or (<= y -920000000.0) (not (<= y 1.0))) (* 3.0 (* y (sqrt x))) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if ((y <= -920000000.0) || !(y <= 1.0)) {
tmp = 3.0 * (y * sqrt(x));
} else {
tmp = sqrt(x) * -3.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-920000000.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = 3.0d0 * (y * sqrt(x))
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -920000000.0) || !(y <= 1.0)) {
tmp = 3.0 * (y * Math.sqrt(x));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -920000000.0) or not (y <= 1.0): tmp = 3.0 * (y * math.sqrt(x)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -920000000.0) || !(y <= 1.0)) tmp = Float64(3.0 * Float64(y * sqrt(x))); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -920000000.0) || ~((y <= 1.0))) tmp = 3.0 * (y * sqrt(x)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -920000000.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -920000000 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if y < -9.2e8 or 1 < y Initial program 99.5%
*-commutative99.5%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 69.1%
if -9.2e8 < y < 1Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
associate-+l+99.4%
*-commutative99.4%
associate-/r*99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 55.7%
Taylor expanded in y around 0 53.3%
*-commutative53.3%
Simplified53.3%
Final simplification61.1%
(FPCore (x y) :precision binary64 (if (or (<= y -920000000.0) (not (<= y 1.0))) (* (sqrt (* x 9.0)) y) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if ((y <= -920000000.0) || !(y <= 1.0)) {
tmp = sqrt((x * 9.0)) * y;
} else {
tmp = sqrt(x) * -3.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-920000000.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = sqrt((x * 9.0d0)) * y
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -920000000.0) || !(y <= 1.0)) {
tmp = Math.sqrt((x * 9.0)) * y;
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -920000000.0) or not (y <= 1.0): tmp = math.sqrt((x * 9.0)) * y else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -920000000.0) || !(y <= 1.0)) tmp = Float64(sqrt(Float64(x * 9.0)) * y); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -920000000.0) || ~((y <= 1.0))) tmp = sqrt((x * 9.0)) * y; else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -920000000.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -920000000 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;\sqrt{x \cdot 9} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if y < -9.2e8 or 1 < y Initial program 99.5%
*-commutative99.5%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 69.1%
pow169.1%
*-commutative69.1%
*-commutative69.1%
associate-*l*69.2%
metadata-eval69.2%
sqrt-prod69.2%
Applied egg-rr69.2%
unpow169.2%
Simplified69.2%
if -9.2e8 < y < 1Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
associate-+l+99.4%
*-commutative99.4%
associate-/r*99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 55.7%
Taylor expanded in y around 0 53.3%
*-commutative53.3%
Simplified53.3%
Final simplification61.1%
(FPCore (x y) :precision binary64 (if (<= x 2.2e-14) (* (sqrt x) (/ 0.3333333333333333 x)) (* (sqrt x) (- (* y 3.0) 3.0))))
double code(double x, double y) {
double tmp;
if (x <= 2.2e-14) {
tmp = sqrt(x) * (0.3333333333333333 / x);
} else {
tmp = sqrt(x) * ((y * 3.0) - 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 2.2d-14) then
tmp = sqrt(x) * (0.3333333333333333d0 / x)
else
tmp = sqrt(x) * ((y * 3.0d0) - 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 2.2e-14) {
tmp = Math.sqrt(x) * (0.3333333333333333 / x);
} else {
tmp = Math.sqrt(x) * ((y * 3.0) - 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.2e-14: tmp = math.sqrt(x) * (0.3333333333333333 / x) else: tmp = math.sqrt(x) * ((y * 3.0) - 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= 2.2e-14) tmp = Float64(sqrt(x) * Float64(0.3333333333333333 / x)); else tmp = Float64(sqrt(x) * Float64(Float64(y * 3.0) - 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 2.2e-14) tmp = sqrt(x) * (0.3333333333333333 / x); else tmp = sqrt(x) * ((y * 3.0) - 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.2e-14], N[(N[Sqrt[x], $MachinePrecision] * N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(y * 3.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2 \cdot 10^{-14}:\\
\;\;\;\;\sqrt{x} \cdot \frac{0.3333333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(y \cdot 3 - 3\right)\\
\end{array}
\end{array}
if x < 2.2000000000000001e-14Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.2%
sub-neg99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
metadata-eval99.2%
*-commutative99.2%
associate-/r*99.2%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 79.3%
if 2.2000000000000001e-14 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.5%
associate--l+99.5%
distribute-lft-in99.6%
fma-define99.6%
sub-neg99.6%
+-commutative99.6%
distribute-lft-in99.6%
metadata-eval99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 96.3%
Final simplification88.7%
(FPCore (x y) :precision binary64 (if (<= x 6.9e-15) (* (sqrt x) (/ 0.3333333333333333 x)) (* (sqrt (* x 9.0)) (+ y -1.0))))
double code(double x, double y) {
double tmp;
if (x <= 6.9e-15) {
tmp = sqrt(x) * (0.3333333333333333 / x);
} else {
tmp = sqrt((x * 9.0)) * (y + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 6.9d-15) then
tmp = sqrt(x) * (0.3333333333333333d0 / x)
else
tmp = sqrt((x * 9.0d0)) * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 6.9e-15) {
tmp = Math.sqrt(x) * (0.3333333333333333 / x);
} else {
tmp = Math.sqrt((x * 9.0)) * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6.9e-15: tmp = math.sqrt(x) * (0.3333333333333333 / x) else: tmp = math.sqrt((x * 9.0)) * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= 6.9e-15) tmp = Float64(sqrt(x) * Float64(0.3333333333333333 / x)); else tmp = Float64(sqrt(Float64(x * 9.0)) * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6.9e-15) tmp = sqrt(x) * (0.3333333333333333 / x); else tmp = sqrt((x * 9.0)) * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6.9e-15], N[(N[Sqrt[x], $MachinePrecision] * N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.9 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{x} \cdot \frac{0.3333333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x \cdot 9} \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if x < 6.9000000000000001e-15Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
fma-define99.2%
sub-neg99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
metadata-eval99.2%
*-commutative99.2%
associate-/r*99.2%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 79.3%
if 6.9000000000000001e-15 < x Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 96.3%
*-commutative99.6%
metadata-eval99.6%
sqrt-prod99.8%
pow1/299.8%
Applied egg-rr96.5%
unpow1/299.8%
Simplified96.5%
Final simplification88.8%
(FPCore (x y) :precision binary64 (if (<= x 7e-17) (* 3.0 (* (/ 0.1111111111111111 x) (sqrt x))) (* (sqrt (* x 9.0)) (+ y -1.0))))
double code(double x, double y) {
double tmp;
if (x <= 7e-17) {
tmp = 3.0 * ((0.1111111111111111 / x) * sqrt(x));
} else {
tmp = sqrt((x * 9.0)) * (y + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 7d-17) then
tmp = 3.0d0 * ((0.1111111111111111d0 / x) * sqrt(x))
else
tmp = sqrt((x * 9.0d0)) * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 7e-17) {
tmp = 3.0 * ((0.1111111111111111 / x) * Math.sqrt(x));
} else {
tmp = Math.sqrt((x * 9.0)) * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 7e-17: tmp = 3.0 * ((0.1111111111111111 / x) * math.sqrt(x)) else: tmp = math.sqrt((x * 9.0)) * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= 7e-17) tmp = Float64(3.0 * Float64(Float64(0.1111111111111111 / x) * sqrt(x))); else tmp = Float64(sqrt(Float64(x * 9.0)) * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 7e-17) tmp = 3.0 * ((0.1111111111111111 / x) * sqrt(x)); else tmp = sqrt((x * 9.0)) * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 7e-17], N[(3.0 * N[(N[(0.1111111111111111 / x), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-17}:\\
\;\;\;\;3 \cdot \left(\frac{0.1111111111111111}{x} \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x \cdot 9} \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if x < 7.0000000000000003e-17Initial program 99.3%
sub-neg99.3%
+-commutative99.3%
associate-+l+99.3%
*-commutative99.3%
associate-/r*99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
add-cbrt-cube50.2%
pow350.2%
*-commutative50.2%
associate-*l*50.2%
associate-+r+50.2%
+-commutative50.2%
associate-+l+50.2%
metadata-eval50.2%
sub-neg50.2%
associate-+r-50.2%
+-commutative50.2%
associate--l+50.2%
Applied egg-rr50.2%
rem-cbrt-cube99.3%
associate-*r*99.3%
*-commutative99.3%
associate-+r-99.3%
+-commutative99.3%
associate-+r-99.3%
clear-num99.2%
div-inv99.3%
metadata-eval99.3%
associate--l+99.3%
*-commutative99.3%
*-commutative99.3%
associate-*r*99.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 79.3%
if 7.0000000000000003e-17 < x Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 96.3%
*-commutative99.6%
metadata-eval99.6%
sqrt-prod99.8%
pow1/299.8%
Applied egg-rr96.5%
unpow1/299.8%
Simplified96.5%
Final simplification88.9%
(FPCore (x y) :precision binary64 (* (sqrt x) (+ (+ (/ 0.3333333333333333 x) -3.0) (* y 3.0))))
double code(double x, double y) {
return sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (y * 3.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * (((0.3333333333333333d0 / x) + (-3.0d0)) + (y * 3.0d0))
end function
public static double code(double x, double y) {
return Math.sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (y * 3.0));
}
def code(x, y): return math.sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (y * 3.0))
function code(x, y) return Float64(sqrt(x) * Float64(Float64(Float64(0.3333333333333333 / x) + -3.0) + Float64(y * 3.0))) end
function tmp = code(x, y) tmp = sqrt(x) * (((0.3333333333333333 / x) + -3.0) + (y * 3.0)); end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -3.0), $MachinePrecision] + N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \left(\left(\frac{0.3333333333333333}{x} + -3\right) + y \cdot 3\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.4%
associate--l+99.4%
distribute-lft-in99.4%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
fma-undefine99.5%
+-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y) :precision binary64 (* (sqrt (* x 9.0)) (+ (/ 0.1111111111111111 x) (+ y -1.0))))
double code(double x, double y) {
return sqrt((x * 9.0)) * ((0.1111111111111111 / x) + (y + -1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt((x * 9.0d0)) * ((0.1111111111111111d0 / x) + (y + (-1.0d0)))
end function
public static double code(double x, double y) {
return Math.sqrt((x * 9.0)) * ((0.1111111111111111 / x) + (y + -1.0));
}
def code(x, y): return math.sqrt((x * 9.0)) * ((0.1111111111111111 / x) + (y + -1.0))
function code(x, y) return Float64(sqrt(Float64(x * 9.0)) * Float64(Float64(0.1111111111111111 / x) + Float64(y + -1.0))) end
function tmp = code(x, y) tmp = sqrt((x * 9.0)) * ((0.1111111111111111 / x) + (y + -1.0)); end
code[x_, y_] := N[(N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.1111111111111111 / x), $MachinePrecision] + N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x \cdot 9} \cdot \left(\frac{0.1111111111111111}{x} + \left(y + -1\right)\right)
\end{array}
Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
associate-+l+99.4%
*-commutative99.4%
associate-/r*99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
*-commutative99.4%
metadata-eval99.4%
sqrt-prod99.6%
pow1/299.6%
Applied egg-rr99.6%
unpow1/299.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y) :precision binary64 (sqrt (* x 9.0)))
double code(double x, double y) {
return sqrt((x * 9.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt((x * 9.0d0))
end function
public static double code(double x, double y) {
return Math.sqrt((x * 9.0));
}
def code(x, y): return math.sqrt((x * 9.0))
function code(x, y) return sqrt(Float64(x * 9.0)) end
function tmp = code(x, y) tmp = sqrt((x * 9.0)); end
code[x_, y_] := N[Sqrt[N[(x * 9.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x \cdot 9}
\end{array}
Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
associate-+l+99.4%
*-commutative99.4%
associate-/r*99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 62.6%
Taylor expanded in y around 0 28.4%
*-commutative28.4%
Simplified28.4%
add-sqr-sqrt0.0%
sqrt-unprod3.2%
swap-sqr3.2%
add-sqr-sqrt3.2%
metadata-eval3.2%
pow1/23.2%
Applied egg-rr3.2%
unpow1/23.2%
Simplified3.2%
Final simplification3.2%
(FPCore (x y) :precision binary64 (* (sqrt x) -3.0))
double code(double x, double y) {
return sqrt(x) * -3.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * (-3.0d0)
end function
public static double code(double x, double y) {
return Math.sqrt(x) * -3.0;
}
def code(x, y): return math.sqrt(x) * -3.0
function code(x, y) return Float64(sqrt(x) * -3.0) end
function tmp = code(x, y) tmp = sqrt(x) * -3.0; end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot -3
\end{array}
Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
associate-+l+99.4%
*-commutative99.4%
associate-/r*99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 62.6%
Taylor expanded in y around 0 28.4%
*-commutative28.4%
Simplified28.4%
Final simplification28.4%
(FPCore (x y) :precision binary64 (* 3.0 (+ (* y (sqrt x)) (* (- (/ 1.0 (* x 9.0)) 1.0) (sqrt x)))))
double code(double x, double y) {
return 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 3.0d0 * ((y * sqrt(x)) + (((1.0d0 / (x * 9.0d0)) - 1.0d0) * sqrt(x)))
end function
public static double code(double x, double y) {
return 3.0 * ((y * Math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * Math.sqrt(x)));
}
def code(x, y): return 3.0 * ((y * math.sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * math.sqrt(x)))
function code(x, y) return Float64(3.0 * Float64(Float64(y * sqrt(x)) + Float64(Float64(Float64(1.0 / Float64(x * 9.0)) - 1.0) * sqrt(x)))) end
function tmp = code(x, y) tmp = 3.0 * ((y * sqrt(x)) + (((1.0 / (x * 9.0)) - 1.0) * sqrt(x))); end
code[x_, y_] := N[(3.0 * N[(N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 \cdot \left(y \cdot \sqrt{x} + \left(\frac{1}{x \cdot 9} - 1\right) \cdot \sqrt{x}\right)
\end{array}
herbie shell --seed 2024039
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(* 3.0 (+ (* y (sqrt x)) (* (- (/ 1.0 (* x 9.0)) 1.0) (sqrt x))))
(* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))