
(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 8 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)) (+ (/ 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%
+-commutative99.4%
associate--l+99.4%
*-commutative99.4%
associate-/r*99.4%
metadata-eval99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
*-commutative99.4%
metadata-eval99.4%
sqrt-prod99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= x 2.9e-36)
(sqrt (/ 0.1111111111111111 x))
(if (or (<= x 1.4e+38) (and (not (<= x 1.3e+70)) (<= x 1.55e+94)))
(* 3.0 (* y (sqrt x)))
(* (sqrt x) -3.0))))
double code(double x, double y) {
double tmp;
if (x <= 2.9e-36) {
tmp = sqrt((0.1111111111111111 / x));
} else if ((x <= 1.4e+38) || (!(x <= 1.3e+70) && (x <= 1.55e+94))) {
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 (x <= 2.9d-36) then
tmp = sqrt((0.1111111111111111d0 / x))
else if ((x <= 1.4d+38) .or. (.not. (x <= 1.3d+70)) .and. (x <= 1.55d+94)) 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 (x <= 2.9e-36) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if ((x <= 1.4e+38) || (!(x <= 1.3e+70) && (x <= 1.55e+94))) {
tmp = 3.0 * (y * Math.sqrt(x));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.9e-36: tmp = math.sqrt((0.1111111111111111 / x)) elif (x <= 1.4e+38) or (not (x <= 1.3e+70) and (x <= 1.55e+94)): tmp = 3.0 * (y * math.sqrt(x)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 2.9e-36) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif ((x <= 1.4e+38) || (!(x <= 1.3e+70) && (x <= 1.55e+94))) 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 (x <= 2.9e-36) tmp = sqrt((0.1111111111111111 / x)); elseif ((x <= 1.4e+38) || (~((x <= 1.3e+70)) && (x <= 1.55e+94))) tmp = 3.0 * (y * sqrt(x)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.9e-36], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1.4e+38], And[N[Not[LessEqual[x, 1.3e+70]], $MachinePrecision], LessEqual[x, 1.55e+94]]], 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}\;x \leq 2.9 \cdot 10^{-36}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+38} \lor \neg \left(x \leq 1.3 \cdot 10^{+70}\right) \land x \leq 1.55 \cdot 10^{+94}:\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 2.90000000000000013e-36Initial program 99.3%
*-commutative99.3%
associate-*l*98.5%
associate--l+98.5%
distribute-lft-in98.5%
fma-define98.4%
sub-neg98.4%
+-commutative98.4%
distribute-lft-in98.4%
metadata-eval98.4%
metadata-eval98.4%
*-commutative98.4%
associate-/r*98.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in x around 0 81.4%
metadata-eval81.4%
sqrt-prod81.7%
div-inv81.8%
pow1/281.8%
Applied egg-rr81.8%
unpow1/281.8%
Simplified81.8%
if 2.90000000000000013e-36 < x < 1.4e38 or 1.3e70 < x < 1.54999999999999996e94Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
associate--l+99.3%
distribute-lft-in99.3%
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.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around inf 56.9%
if 1.4e38 < x < 1.3e70 or 1.54999999999999996e94 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
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 99.6%
Taylor expanded in y around 0 64.3%
*-commutative64.3%
Simplified64.3%
Final simplification69.9%
(FPCore (x y)
:precision binary64
(if (<= x 8.2e-36)
(sqrt (/ 0.1111111111111111 x))
(if (<= x 2e+38)
(* y (* (sqrt x) 3.0))
(if (or (<= x 6.5e+69) (not (<= x 3.9e+93)))
(* (sqrt x) -3.0)
(* 3.0 (* y (sqrt x)))))))
double code(double x, double y) {
double tmp;
if (x <= 8.2e-36) {
tmp = sqrt((0.1111111111111111 / x));
} else if (x <= 2e+38) {
tmp = y * (sqrt(x) * 3.0);
} else if ((x <= 6.5e+69) || !(x <= 3.9e+93)) {
tmp = sqrt(x) * -3.0;
} else {
tmp = 3.0 * (y * sqrt(x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 8.2d-36) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (x <= 2d+38) then
tmp = y * (sqrt(x) * 3.0d0)
else if ((x <= 6.5d+69) .or. (.not. (x <= 3.9d+93))) then
tmp = sqrt(x) * (-3.0d0)
else
tmp = 3.0d0 * (y * sqrt(x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 8.2e-36) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (x <= 2e+38) {
tmp = y * (Math.sqrt(x) * 3.0);
} else if ((x <= 6.5e+69) || !(x <= 3.9e+93)) {
tmp = Math.sqrt(x) * -3.0;
} else {
tmp = 3.0 * (y * Math.sqrt(x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 8.2e-36: tmp = math.sqrt((0.1111111111111111 / x)) elif x <= 2e+38: tmp = y * (math.sqrt(x) * 3.0) elif (x <= 6.5e+69) or not (x <= 3.9e+93): tmp = math.sqrt(x) * -3.0 else: tmp = 3.0 * (y * math.sqrt(x)) return tmp
function code(x, y) tmp = 0.0 if (x <= 8.2e-36) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (x <= 2e+38) tmp = Float64(y * Float64(sqrt(x) * 3.0)); elseif ((x <= 6.5e+69) || !(x <= 3.9e+93)) tmp = Float64(sqrt(x) * -3.0); else tmp = Float64(3.0 * Float64(y * sqrt(x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 8.2e-36) tmp = sqrt((0.1111111111111111 / x)); elseif (x <= 2e+38) tmp = y * (sqrt(x) * 3.0); elseif ((x <= 6.5e+69) || ~((x <= 3.9e+93))) tmp = sqrt(x) * -3.0; else tmp = 3.0 * (y * sqrt(x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 8.2e-36], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2e+38], N[(y * N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 6.5e+69], N[Not[LessEqual[x, 3.9e+93]], $MachinePrecision]], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.2 \cdot 10^{-36}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+38}:\\
\;\;\;\;y \cdot \left(\sqrt{x} \cdot 3\right)\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+69} \lor \neg \left(x \leq 3.9 \cdot 10^{+93}\right):\\
\;\;\;\;\sqrt{x} \cdot -3\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\end{array}
\end{array}
if x < 8.20000000000000025e-36Initial program 99.3%
*-commutative99.3%
associate-*l*98.5%
associate--l+98.5%
distribute-lft-in98.5%
fma-define98.4%
sub-neg98.4%
+-commutative98.4%
distribute-lft-in98.4%
metadata-eval98.4%
metadata-eval98.4%
*-commutative98.4%
associate-/r*98.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in x around 0 81.4%
metadata-eval81.4%
sqrt-prod81.7%
div-inv81.8%
pow1/281.8%
Applied egg-rr81.8%
unpow1/281.8%
Simplified81.8%
if 8.20000000000000025e-36 < x < 1.99999999999999995e38Initial program 99.3%
*-commutative99.3%
associate-*l*99.2%
associate--l+99.2%
distribute-lft-in99.3%
fma-define99.3%
sub-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 99.5%
+-commutative99.5%
*-commutative99.5%
distribute-lft-out99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
associate-*r/99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around 0 62.6%
Taylor expanded in x around inf 51.6%
if 1.99999999999999995e38 < x < 6.5000000000000001e69 or 3.9000000000000002e93 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
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 99.6%
Taylor expanded in y around 0 64.3%
*-commutative64.3%
Simplified64.3%
if 6.5000000000000001e69 < x < 3.9000000000000002e93Initial program 99.5%
*-commutative99.5%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.6%
fma-define99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 75.7%
Final simplification69.9%
(FPCore (x y)
:precision binary64
(if (<= x 1.65e-36)
(sqrt (/ 0.1111111111111111 x))
(if (<= x 3.7e-15)
(* 3.0 (* y (sqrt x)))
(if (<= x 0.04)
(* (sqrt x) (+ -3.0 (/ 0.3333333333333333 x)))
(* (sqrt x) (- (* y 3.0) 3.0))))))
double code(double x, double y) {
double tmp;
if (x <= 1.65e-36) {
tmp = sqrt((0.1111111111111111 / x));
} else if (x <= 3.7e-15) {
tmp = 3.0 * (y * sqrt(x));
} else if (x <= 0.04) {
tmp = sqrt(x) * (-3.0 + (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 <= 1.65d-36) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (x <= 3.7d-15) then
tmp = 3.0d0 * (y * sqrt(x))
else if (x <= 0.04d0) then
tmp = sqrt(x) * ((-3.0d0) + (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 <= 1.65e-36) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (x <= 3.7e-15) {
tmp = 3.0 * (y * Math.sqrt(x));
} else if (x <= 0.04) {
tmp = Math.sqrt(x) * (-3.0 + (0.3333333333333333 / x));
} else {
tmp = Math.sqrt(x) * ((y * 3.0) - 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.65e-36: tmp = math.sqrt((0.1111111111111111 / x)) elif x <= 3.7e-15: tmp = 3.0 * (y * math.sqrt(x)) elif x <= 0.04: tmp = math.sqrt(x) * (-3.0 + (0.3333333333333333 / x)) else: tmp = math.sqrt(x) * ((y * 3.0) - 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= 1.65e-36) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (x <= 3.7e-15) tmp = Float64(3.0 * Float64(y * sqrt(x))); elseif (x <= 0.04) tmp = Float64(sqrt(x) * Float64(-3.0 + 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 <= 1.65e-36) tmp = sqrt((0.1111111111111111 / x)); elseif (x <= 3.7e-15) tmp = 3.0 * (y * sqrt(x)); elseif (x <= 0.04) tmp = sqrt(x) * (-3.0 + (0.3333333333333333 / x)); else tmp = sqrt(x) * ((y * 3.0) - 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.65e-36], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3.7e-15], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.04], N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 + N[(0.3333333333333333 / x), $MachinePrecision]), $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 1.65 \cdot 10^{-36}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-15}:\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{elif}\;x \leq 0.04:\\
\;\;\;\;\sqrt{x} \cdot \left(-3 + \frac{0.3333333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(y \cdot 3 - 3\right)\\
\end{array}
\end{array}
if x < 1.64999999999999995e-36Initial program 99.3%
*-commutative99.3%
associate-*l*98.5%
associate--l+98.5%
distribute-lft-in98.5%
fma-define98.4%
sub-neg98.4%
+-commutative98.4%
distribute-lft-in98.4%
metadata-eval98.4%
metadata-eval98.4%
*-commutative98.4%
associate-/r*98.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in x around 0 81.4%
metadata-eval81.4%
sqrt-prod81.7%
div-inv81.8%
pow1/281.8%
Applied egg-rr81.8%
unpow1/281.8%
Simplified81.8%
if 1.64999999999999995e-36 < x < 3.70000000000000017e-15Initial program 99.0%
*-commutative99.0%
associate-*l*98.5%
associate--l+98.5%
distribute-lft-in98.7%
fma-define98.7%
sub-neg98.7%
+-commutative98.7%
distribute-lft-in98.7%
metadata-eval98.7%
metadata-eval98.7%
*-commutative98.7%
associate-/r*98.8%
associate-*r/99.1%
metadata-eval99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in y around inf 70.5%
if 3.70000000000000017e-15 < x < 0.0400000000000000008Initial program 99.0%
*-commutative99.0%
associate-*l*99.7%
associate--l+99.7%
distribute-lft-in99.7%
fma-define99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
associate-/r*99.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around 0 83.1%
sub-neg83.1%
metadata-eval83.1%
associate-*r/83.3%
metadata-eval83.3%
+-commutative83.3%
Simplified83.3%
if 0.0400000000000000008 < x Initial program 99.5%
*-commutative99.5%
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 97.4%
Final simplification89.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.26e+19) (not (<= y 1.0))) (* y (* (sqrt x) (+ 3.0 (/ 0.3333333333333333 (* x y))))) (* (sqrt x) (+ -3.0 (/ 0.3333333333333333 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.26e+19) || !(y <= 1.0)) {
tmp = y * (sqrt(x) * (3.0 + (0.3333333333333333 / (x * y))));
} else {
tmp = sqrt(x) * (-3.0 + (0.3333333333333333 / x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.26d+19)) .or. (.not. (y <= 1.0d0))) then
tmp = y * (sqrt(x) * (3.0d0 + (0.3333333333333333d0 / (x * y))))
else
tmp = sqrt(x) * ((-3.0d0) + (0.3333333333333333d0 / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.26e+19) || !(y <= 1.0)) {
tmp = y * (Math.sqrt(x) * (3.0 + (0.3333333333333333 / (x * y))));
} else {
tmp = Math.sqrt(x) * (-3.0 + (0.3333333333333333 / x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.26e+19) or not (y <= 1.0): tmp = y * (math.sqrt(x) * (3.0 + (0.3333333333333333 / (x * y)))) else: tmp = math.sqrt(x) * (-3.0 + (0.3333333333333333 / x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.26e+19) || !(y <= 1.0)) tmp = Float64(y * Float64(sqrt(x) * Float64(3.0 + Float64(0.3333333333333333 / Float64(x * y))))); else tmp = Float64(sqrt(x) * Float64(-3.0 + Float64(0.3333333333333333 / x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.26e+19) || ~((y <= 1.0))) tmp = y * (sqrt(x) * (3.0 + (0.3333333333333333 / (x * y)))); else tmp = sqrt(x) * (-3.0 + (0.3333333333333333 / x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.26e+19], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 + N[(0.3333333333333333 / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.26 \cdot 10^{+19} \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(\sqrt{x} \cdot \left(3 + \frac{0.3333333333333333}{x \cdot y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(-3 + \frac{0.3333333333333333}{x}\right)\\
\end{array}
\end{array}
if y < -1.26e19 or 1 < y Initial program 99.4%
*-commutative99.4%
associate-*l*98.6%
associate--l+98.6%
distribute-lft-in98.6%
fma-define98.6%
sub-neg98.6%
+-commutative98.6%
distribute-lft-in98.6%
metadata-eval98.6%
metadata-eval98.6%
*-commutative98.6%
associate-/r*98.6%
associate-*r/98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in y around inf 99.3%
+-commutative99.3%
*-commutative99.3%
distribute-lft-out99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 99.4%
if -1.26e19 < y < 1Initial program 99.4%
*-commutative99.4%
associate-*l*99.5%
associate--l+99.5%
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 0 97.8%
sub-neg97.8%
metadata-eval97.8%
associate-*r/97.8%
metadata-eval97.8%
+-commutative97.8%
Simplified97.8%
Final simplification98.5%
(FPCore (x y) :precision binary64 (if (or (<= y -6.8e+57) (not (<= y 5e+16))) (* 3.0 (* y (sqrt x))) (* (sqrt x) (+ -3.0 (/ 0.3333333333333333 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -6.8e+57) || !(y <= 5e+16)) {
tmp = 3.0 * (y * sqrt(x));
} else {
tmp = sqrt(x) * (-3.0 + (0.3333333333333333 / x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-6.8d+57)) .or. (.not. (y <= 5d+16))) then
tmp = 3.0d0 * (y * sqrt(x))
else
tmp = sqrt(x) * ((-3.0d0) + (0.3333333333333333d0 / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -6.8e+57) || !(y <= 5e+16)) {
tmp = 3.0 * (y * Math.sqrt(x));
} else {
tmp = Math.sqrt(x) * (-3.0 + (0.3333333333333333 / x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -6.8e+57) or not (y <= 5e+16): tmp = 3.0 * (y * math.sqrt(x)) else: tmp = math.sqrt(x) * (-3.0 + (0.3333333333333333 / x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -6.8e+57) || !(y <= 5e+16)) tmp = Float64(3.0 * Float64(y * sqrt(x))); else tmp = Float64(sqrt(x) * Float64(-3.0 + Float64(0.3333333333333333 / x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -6.8e+57) || ~((y <= 5e+16))) tmp = 3.0 * (y * sqrt(x)); else tmp = sqrt(x) * (-3.0 + (0.3333333333333333 / x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -6.8e+57], N[Not[LessEqual[y, 5e+16]], $MachinePrecision]], N[(3.0 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+57} \lor \neg \left(y \leq 5 \cdot 10^{+16}\right):\\
\;\;\;\;3 \cdot \left(y \cdot \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(-3 + \frac{0.3333333333333333}{x}\right)\\
\end{array}
\end{array}
if y < -6.79999999999999984e57 or 5e16 < y Initial program 99.4%
*-commutative99.4%
associate-*l*98.5%
associate--l+98.5%
distribute-lft-in98.5%
fma-define98.6%
sub-neg98.6%
+-commutative98.6%
distribute-lft-in98.6%
metadata-eval98.6%
metadata-eval98.6%
*-commutative98.6%
associate-/r*98.5%
associate-*r/98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in y around inf 74.5%
if -6.79999999999999984e57 < y < 5e16Initial program 99.4%
*-commutative99.4%
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 0 96.3%
sub-neg96.3%
metadata-eval96.3%
associate-*r/96.4%
metadata-eval96.4%
+-commutative96.4%
Simplified96.4%
Final simplification87.2%
(FPCore (x y) :precision binary64 (if (<= x 0.112) (sqrt (/ 0.1111111111111111 x)) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if (x <= 0.112) {
tmp = sqrt((0.1111111111111111 / 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 (x <= 0.112d0) then
tmp = sqrt((0.1111111111111111d0 / x))
else
tmp = sqrt(x) * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.112) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.112: tmp = math.sqrt((0.1111111111111111 / x)) else: tmp = math.sqrt(x) * -3.0 return tmp
function code(x, y) tmp = 0.0 if (x <= 0.112) tmp = sqrt(Float64(0.1111111111111111 / x)); else tmp = Float64(sqrt(x) * -3.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.112) tmp = sqrt((0.1111111111111111 / x)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.112], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 99.2%
*-commutative99.2%
associate-*l*98.5%
associate--l+98.5%
distribute-lft-in98.5%
fma-define98.5%
sub-neg98.5%
+-commutative98.5%
distribute-lft-in98.5%
metadata-eval98.5%
metadata-eval98.5%
*-commutative98.5%
associate-/r*98.5%
associate-*r/98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in x around 0 74.3%
metadata-eval74.3%
sqrt-prod74.5%
div-inv74.6%
pow1/274.6%
Applied egg-rr74.6%
unpow1/274.6%
Simplified74.6%
if 0.112000000000000002 < x Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
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 97.4%
Taylor expanded in y around 0 56.6%
*-commutative56.6%
Simplified56.6%
Final simplification65.2%
(FPCore (x y) :precision binary64 (sqrt (/ 0.1111111111111111 x)))
double code(double x, double y) {
return sqrt((0.1111111111111111 / x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt((0.1111111111111111d0 / x))
end function
public static double code(double x, double y) {
return Math.sqrt((0.1111111111111111 / x));
}
def code(x, y): return math.sqrt((0.1111111111111111 / x))
function code(x, y) return sqrt(Float64(0.1111111111111111 / x)) end
function tmp = code(x, y) tmp = sqrt((0.1111111111111111 / x)); end
code[x_, y_] := N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{0.1111111111111111}{x}}
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.1%
associate--l+99.1%
distribute-lft-in99.1%
fma-define99.1%
sub-neg99.1%
+-commutative99.1%
distribute-lft-in99.1%
metadata-eval99.1%
metadata-eval99.1%
*-commutative99.1%
associate-/r*99.1%
associate-*r/99.1%
metadata-eval99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around 0 36.3%
metadata-eval36.3%
sqrt-prod36.4%
div-inv36.5%
pow1/236.5%
Applied egg-rr36.5%
unpow1/236.5%
Simplified36.5%
Final simplification36.5%
(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 2024112
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:alt
(* 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)))