
(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 9 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) (fma 3.0 y (+ -3.0 (/ 0.3333333333333333 x)))))
double code(double x, double y) {
return sqrt(x) * fma(3.0, y, (-3.0 + (0.3333333333333333 / x)));
}
function code(x, y) return Float64(sqrt(x) * fma(3.0, y, Float64(-3.0 + Float64(0.3333333333333333 / x)))) end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y + N[(-3.0 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \mathsf{fma}\left(3, y, -3 + \frac{0.3333333333333333}{x}\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.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(if (<= x 0.062)
(sqrt (/ 0.1111111111111111 x))
(if (or (<= x 1.5e+48)
(and (not (<= x 8.2e+120))
(or (<= x 1.16e+204) (not (<= x 2.35e+272)))))
(* (sqrt x) -3.0)
(* 3.0 (* (sqrt x) y)))))
double code(double x, double y) {
double tmp;
if (x <= 0.062) {
tmp = sqrt((0.1111111111111111 / x));
} else if ((x <= 1.5e+48) || (!(x <= 8.2e+120) && ((x <= 1.16e+204) || !(x <= 2.35e+272)))) {
tmp = sqrt(x) * -3.0;
} else {
tmp = 3.0 * (sqrt(x) * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 0.062d0) then
tmp = sqrt((0.1111111111111111d0 / x))
else if ((x <= 1.5d+48) .or. (.not. (x <= 8.2d+120)) .and. (x <= 1.16d+204) .or. (.not. (x <= 2.35d+272))) then
tmp = sqrt(x) * (-3.0d0)
else
tmp = 3.0d0 * (sqrt(x) * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.062) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if ((x <= 1.5e+48) || (!(x <= 8.2e+120) && ((x <= 1.16e+204) || !(x <= 2.35e+272)))) {
tmp = Math.sqrt(x) * -3.0;
} else {
tmp = 3.0 * (Math.sqrt(x) * y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.062: tmp = math.sqrt((0.1111111111111111 / x)) elif (x <= 1.5e+48) or (not (x <= 8.2e+120) and ((x <= 1.16e+204) or not (x <= 2.35e+272))): tmp = math.sqrt(x) * -3.0 else: tmp = 3.0 * (math.sqrt(x) * y) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.062) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif ((x <= 1.5e+48) || (!(x <= 8.2e+120) && ((x <= 1.16e+204) || !(x <= 2.35e+272)))) tmp = Float64(sqrt(x) * -3.0); else tmp = Float64(3.0 * Float64(sqrt(x) * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.062) tmp = sqrt((0.1111111111111111 / x)); elseif ((x <= 1.5e+48) || (~((x <= 8.2e+120)) && ((x <= 1.16e+204) || ~((x <= 2.35e+272))))) tmp = sqrt(x) * -3.0; else tmp = 3.0 * (sqrt(x) * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.062], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1.5e+48], And[N[Not[LessEqual[x, 8.2e+120]], $MachinePrecision], Or[LessEqual[x, 1.16e+204], N[Not[LessEqual[x, 2.35e+272]], $MachinePrecision]]]], N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.062:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+48} \lor \neg \left(x \leq 8.2 \cdot 10^{+120}\right) \land \left(x \leq 1.16 \cdot 10^{+204} \lor \neg \left(x \leq 2.35 \cdot 10^{+272}\right)\right):\\
\;\;\;\;\sqrt{x} \cdot -3\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot y\right)\\
\end{array}
\end{array}
if x < 0.062Initial program 99.2%
*-commutative99.2%
associate-*l*99.3%
associate--l+99.3%
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.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 68.9%
metadata-eval68.9%
sqrt-prod69.1%
div-inv69.2%
pow1/269.2%
Applied egg-rr69.2%
unpow1/269.2%
Simplified69.2%
if 0.062 < x < 1.5e48 or 8.2e120 < x < 1.16000000000000004e204 or 2.35e272 < x Initial program 99.6%
*-commutative99.6%
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.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 95.8%
Taylor expanded in y around 0 60.3%
*-commutative60.3%
Simplified60.3%
if 1.5e48 < x < 8.2e120 or 1.16000000000000004e204 < x < 2.35e272Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
associate--l+99.6%
distribute-lft-in99.5%
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 68.0%
Final simplification66.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (sqrt x) -3.0)))
(if (<= x 0.062)
(sqrt (/ 0.1111111111111111 x))
(if (<= x 6.5e+50)
t_0
(if (<= x 3.9e+120)
(* 3.0 (* (sqrt x) y))
(if (or (<= x 2e+204) (not (<= x 2.55e+272)))
t_0
(* y (* (sqrt x) 3.0))))))))
double code(double x, double y) {
double t_0 = sqrt(x) * -3.0;
double tmp;
if (x <= 0.062) {
tmp = sqrt((0.1111111111111111 / x));
} else if (x <= 6.5e+50) {
tmp = t_0;
} else if (x <= 3.9e+120) {
tmp = 3.0 * (sqrt(x) * y);
} else if ((x <= 2e+204) || !(x <= 2.55e+272)) {
tmp = t_0;
} 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) * (-3.0d0)
if (x <= 0.062d0) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (x <= 6.5d+50) then
tmp = t_0
else if (x <= 3.9d+120) then
tmp = 3.0d0 * (sqrt(x) * y)
else if ((x <= 2d+204) .or. (.not. (x <= 2.55d+272))) then
tmp = t_0
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) * -3.0;
double tmp;
if (x <= 0.062) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (x <= 6.5e+50) {
tmp = t_0;
} else if (x <= 3.9e+120) {
tmp = 3.0 * (Math.sqrt(x) * y);
} else if ((x <= 2e+204) || !(x <= 2.55e+272)) {
tmp = t_0;
} else {
tmp = y * (Math.sqrt(x) * 3.0);
}
return tmp;
}
def code(x, y): t_0 = math.sqrt(x) * -3.0 tmp = 0 if x <= 0.062: tmp = math.sqrt((0.1111111111111111 / x)) elif x <= 6.5e+50: tmp = t_0 elif x <= 3.9e+120: tmp = 3.0 * (math.sqrt(x) * y) elif (x <= 2e+204) or not (x <= 2.55e+272): tmp = t_0 else: tmp = y * (math.sqrt(x) * 3.0) return tmp
function code(x, y) t_0 = Float64(sqrt(x) * -3.0) tmp = 0.0 if (x <= 0.062) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (x <= 6.5e+50) tmp = t_0; elseif (x <= 3.9e+120) tmp = Float64(3.0 * Float64(sqrt(x) * y)); elseif ((x <= 2e+204) || !(x <= 2.55e+272)) tmp = t_0; else tmp = Float64(y * Float64(sqrt(x) * 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = sqrt(x) * -3.0; tmp = 0.0; if (x <= 0.062) tmp = sqrt((0.1111111111111111 / x)); elseif (x <= 6.5e+50) tmp = t_0; elseif (x <= 3.9e+120) tmp = 3.0 * (sqrt(x) * y); elseif ((x <= 2e+204) || ~((x <= 2.55e+272))) tmp = t_0; else tmp = y * (sqrt(x) * 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, 0.062], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 6.5e+50], t$95$0, If[LessEqual[x, 3.9e+120], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 2e+204], N[Not[LessEqual[x, 2.55e+272]], $MachinePrecision]], t$95$0, N[(y * N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x} \cdot -3\\
\mathbf{if}\;x \leq 0.062:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+120}:\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot y\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+204} \lor \neg \left(x \leq 2.55 \cdot 10^{+272}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\sqrt{x} \cdot 3\right)\\
\end{array}
\end{array}
if x < 0.062Initial program 99.2%
*-commutative99.2%
associate-*l*99.3%
associate--l+99.3%
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.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 68.9%
metadata-eval68.9%
sqrt-prod69.1%
div-inv69.2%
pow1/269.2%
Applied egg-rr69.2%
unpow1/269.2%
Simplified69.2%
if 0.062 < x < 6.5000000000000003e50 or 3.8999999999999998e120 < x < 1.99999999999999998e204 or 2.54999999999999993e272 < x Initial program 99.6%
*-commutative99.6%
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.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 95.8%
Taylor expanded in y around 0 60.3%
*-commutative60.3%
Simplified60.3%
if 6.5000000000000003e50 < x < 3.8999999999999998e120Initial program 99.5%
*-commutative99.5%
associate-*l*99.5%
associate--l+99.5%
distribute-lft-in99.4%
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 63.4%
if 1.99999999999999998e204 < x < 2.54999999999999993e272Initial program 99.6%
*-commutative99.6%
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.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 93.1%
+-commutative93.1%
*-commutative93.1%
distribute-lft-out93.1%
+-commutative93.1%
sub-neg93.1%
metadata-eval93.1%
associate-*r/93.1%
metadata-eval93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in y around inf 72.2%
*-commutative72.2%
Simplified72.2%
Final simplification66.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (sqrt x) -3.0)))
(if (<= x 0.062)
(sqrt (/ 0.1111111111111111 x))
(if (<= x 3e+46)
t_0
(if (<= x 1.15e+121)
(* 3.0 (* (sqrt x) y))
(if (or (<= x 1.75e+204) (not (<= x 1.75e+272)))
t_0
(* (sqrt x) (* 3.0 y))))))))
double code(double x, double y) {
double t_0 = sqrt(x) * -3.0;
double tmp;
if (x <= 0.062) {
tmp = sqrt((0.1111111111111111 / x));
} else if (x <= 3e+46) {
tmp = t_0;
} else if (x <= 1.15e+121) {
tmp = 3.0 * (sqrt(x) * y);
} else if ((x <= 1.75e+204) || !(x <= 1.75e+272)) {
tmp = t_0;
} else {
tmp = sqrt(x) * (3.0 * y);
}
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 <= 0.062d0) then
tmp = sqrt((0.1111111111111111d0 / x))
else if (x <= 3d+46) then
tmp = t_0
else if (x <= 1.15d+121) then
tmp = 3.0d0 * (sqrt(x) * y)
else if ((x <= 1.75d+204) .or. (.not. (x <= 1.75d+272))) then
tmp = t_0
else
tmp = sqrt(x) * (3.0d0 * y)
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 <= 0.062) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else if (x <= 3e+46) {
tmp = t_0;
} else if (x <= 1.15e+121) {
tmp = 3.0 * (Math.sqrt(x) * y);
} else if ((x <= 1.75e+204) || !(x <= 1.75e+272)) {
tmp = t_0;
} else {
tmp = Math.sqrt(x) * (3.0 * y);
}
return tmp;
}
def code(x, y): t_0 = math.sqrt(x) * -3.0 tmp = 0 if x <= 0.062: tmp = math.sqrt((0.1111111111111111 / x)) elif x <= 3e+46: tmp = t_0 elif x <= 1.15e+121: tmp = 3.0 * (math.sqrt(x) * y) elif (x <= 1.75e+204) or not (x <= 1.75e+272): tmp = t_0 else: tmp = math.sqrt(x) * (3.0 * y) return tmp
function code(x, y) t_0 = Float64(sqrt(x) * -3.0) tmp = 0.0 if (x <= 0.062) tmp = sqrt(Float64(0.1111111111111111 / x)); elseif (x <= 3e+46) tmp = t_0; elseif (x <= 1.15e+121) tmp = Float64(3.0 * Float64(sqrt(x) * y)); elseif ((x <= 1.75e+204) || !(x <= 1.75e+272)) tmp = t_0; else tmp = Float64(sqrt(x) * Float64(3.0 * y)); end return tmp end
function tmp_2 = code(x, y) t_0 = sqrt(x) * -3.0; tmp = 0.0; if (x <= 0.062) tmp = sqrt((0.1111111111111111 / x)); elseif (x <= 3e+46) tmp = t_0; elseif (x <= 1.15e+121) tmp = 3.0 * (sqrt(x) * y); elseif ((x <= 1.75e+204) || ~((x <= 1.75e+272))) tmp = t_0; else tmp = sqrt(x) * (3.0 * y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sqrt[x], $MachinePrecision] * -3.0), $MachinePrecision]}, If[LessEqual[x, 0.062], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3e+46], t$95$0, If[LessEqual[x, 1.15e+121], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 1.75e+204], N[Not[LessEqual[x, 1.75e+272]], $MachinePrecision]], t$95$0, N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x} \cdot -3\\
\mathbf{if}\;x \leq 0.062:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+121}:\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot y\right)\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+204} \lor \neg \left(x \leq 1.75 \cdot 10^{+272}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\end{array}
\end{array}
if x < 0.062Initial program 99.2%
*-commutative99.2%
associate-*l*99.3%
associate--l+99.3%
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.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 68.9%
metadata-eval68.9%
sqrt-prod69.1%
div-inv69.2%
pow1/269.2%
Applied egg-rr69.2%
unpow1/269.2%
Simplified69.2%
if 0.062 < x < 3.00000000000000023e46 or 1.1499999999999999e121 < x < 1.74999999999999995e204 or 1.75000000000000011e272 < x Initial program 99.6%
*-commutative99.6%
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.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 95.8%
Taylor expanded in y around 0 60.3%
*-commutative60.3%
Simplified60.3%
if 3.00000000000000023e46 < x < 1.1499999999999999e121Initial program 99.5%
*-commutative99.5%
associate-*l*99.5%
associate--l+99.5%
distribute-lft-in99.4%
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 63.4%
if 1.74999999999999995e204 < x < 1.75000000000000011e272Initial program 99.6%
*-commutative99.6%
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.7%
associate-*r/99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 72.2%
*-commutative72.2%
associate-*l*72.3%
*-commutative72.3%
Simplified72.3%
Final simplification66.5%
(FPCore (x y)
:precision binary64
(if (<= y -1.05e+18)
(* y (* (sqrt x) 3.0))
(if (<= y 1.25e+19)
(* (sqrt x) (- (* 0.3333333333333333 (/ 1.0 x)) 3.0))
(* (sqrt x) (* 3.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.05e+18) {
tmp = y * (sqrt(x) * 3.0);
} else if (y <= 1.25e+19) {
tmp = sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0);
} else {
tmp = sqrt(x) * (3.0 * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.05d+18)) then
tmp = y * (sqrt(x) * 3.0d0)
else if (y <= 1.25d+19) then
tmp = sqrt(x) * ((0.3333333333333333d0 * (1.0d0 / x)) - 3.0d0)
else
tmp = sqrt(x) * (3.0d0 * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.05e+18) {
tmp = y * (Math.sqrt(x) * 3.0);
} else if (y <= 1.25e+19) {
tmp = Math.sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0);
} else {
tmp = Math.sqrt(x) * (3.0 * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.05e+18: tmp = y * (math.sqrt(x) * 3.0) elif y <= 1.25e+19: tmp = math.sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0) else: tmp = math.sqrt(x) * (3.0 * y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.05e+18) tmp = Float64(y * Float64(sqrt(x) * 3.0)); elseif (y <= 1.25e+19) tmp = Float64(sqrt(x) * Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 3.0)); else tmp = Float64(sqrt(x) * Float64(3.0 * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.05e+18) tmp = y * (sqrt(x) * 3.0); elseif (y <= 1.25e+19) tmp = sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0); else tmp = sqrt(x) * (3.0 * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.05e+18], N[(y * N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+19], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+18}:\\
\;\;\;\;y \cdot \left(\sqrt{x} \cdot 3\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+19}:\\
\;\;\;\;\sqrt{x} \cdot \left(0.3333333333333333 \cdot \frac{1}{x} - 3\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\end{array}
\end{array}
if y < -1.05e18Initial program 99.6%
*-commutative99.6%
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.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
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 y around inf 80.0%
*-commutative80.0%
Simplified80.0%
if -1.05e18 < y < 1.25e19Initial program 99.3%
*-commutative99.3%
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 95.7%
if 1.25e19 < y Initial 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.6%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 79.9%
*-commutative79.9%
associate-*l*80.0%
*-commutative80.0%
Simplified80.0%
Final simplification88.3%
(FPCore (x y)
:precision binary64
(if (<= y -1.02e+18)
(* y (* (sqrt x) 3.0))
(if (<= y 1.4e+20)
(* (sqrt x) (+ -3.0 (/ 0.3333333333333333 x)))
(* (sqrt x) (* 3.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.02e+18) {
tmp = y * (sqrt(x) * 3.0);
} else if (y <= 1.4e+20) {
tmp = sqrt(x) * (-3.0 + (0.3333333333333333 / x));
} else {
tmp = sqrt(x) * (3.0 * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.02d+18)) then
tmp = y * (sqrt(x) * 3.0d0)
else if (y <= 1.4d+20) then
tmp = sqrt(x) * ((-3.0d0) + (0.3333333333333333d0 / x))
else
tmp = sqrt(x) * (3.0d0 * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.02e+18) {
tmp = y * (Math.sqrt(x) * 3.0);
} else if (y <= 1.4e+20) {
tmp = Math.sqrt(x) * (-3.0 + (0.3333333333333333 / x));
} else {
tmp = Math.sqrt(x) * (3.0 * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.02e+18: tmp = y * (math.sqrt(x) * 3.0) elif y <= 1.4e+20: tmp = math.sqrt(x) * (-3.0 + (0.3333333333333333 / x)) else: tmp = math.sqrt(x) * (3.0 * y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.02e+18) tmp = Float64(y * Float64(sqrt(x) * 3.0)); elseif (y <= 1.4e+20) tmp = Float64(sqrt(x) * Float64(-3.0 + Float64(0.3333333333333333 / x))); else tmp = Float64(sqrt(x) * Float64(3.0 * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.02e+18) tmp = y * (sqrt(x) * 3.0); elseif (y <= 1.4e+20) tmp = sqrt(x) * (-3.0 + (0.3333333333333333 / x)); else tmp = sqrt(x) * (3.0 * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.02e+18], N[(y * N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+20], N[(N[Sqrt[x], $MachinePrecision] * N[(-3.0 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+18}:\\
\;\;\;\;y \cdot \left(\sqrt{x} \cdot 3\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+20}:\\
\;\;\;\;\sqrt{x} \cdot \left(-3 + \frac{0.3333333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\end{array}
\end{array}
if y < -1.02e18Initial program 99.6%
*-commutative99.6%
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.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
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 y around inf 80.0%
*-commutative80.0%
Simplified80.0%
if -1.02e18 < y < 1.4e20Initial program 99.3%
*-commutative99.3%
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 95.7%
sub-neg95.7%
metadata-eval95.7%
associate-*r/95.7%
metadata-eval95.7%
+-commutative95.7%
Simplified95.7%
if 1.4e20 < y Initial 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.6%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 79.9%
*-commutative79.9%
associate-*l*80.0%
*-commutative80.0%
Simplified80.0%
Final simplification88.3%
(FPCore (x y) :precision binary64 (* (sqrt x) (+ (+ -3.0 (/ 0.3333333333333333 x)) (* 3.0 y))))
double code(double x, double y) {
return sqrt(x) * ((-3.0 + (0.3333333333333333 / x)) + (3.0 * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * (((-3.0d0) + (0.3333333333333333d0 / x)) + (3.0d0 * y))
end function
public static double code(double x, double y) {
return Math.sqrt(x) * ((-3.0 + (0.3333333333333333 / x)) + (3.0 * y));
}
def code(x, y): return math.sqrt(x) * ((-3.0 + (0.3333333333333333 / x)) + (3.0 * y))
function code(x, y) return Float64(sqrt(x) * Float64(Float64(-3.0 + Float64(0.3333333333333333 / x)) + Float64(3.0 * y))) end
function tmp = code(x, y) tmp = sqrt(x) * ((-3.0 + (0.3333333333333333 / x)) + (3.0 * y)); end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(N[(-3.0 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] + N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \left(\left(-3 + \frac{0.3333333333333333}{x}\right) + 3 \cdot y\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.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
fma-undefine99.5%
+-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (<= x 0.062) (sqrt (/ 0.1111111111111111 x)) (* (sqrt x) -3.0)))
double code(double x, double y) {
double tmp;
if (x <= 0.062) {
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.062d0) 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.062) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else {
tmp = Math.sqrt(x) * -3.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.062: 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.062) 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.062) tmp = sqrt((0.1111111111111111 / x)); else tmp = sqrt(x) * -3.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.062], 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.062:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot -3\\
\end{array}
\end{array}
if x < 0.062Initial program 99.2%
*-commutative99.2%
associate-*l*99.3%
associate--l+99.3%
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.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 68.9%
metadata-eval68.9%
sqrt-prod69.1%
div-inv69.2%
pow1/269.2%
Applied egg-rr69.2%
unpow1/269.2%
Simplified69.2%
if 0.062 < 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 48.4%
*-commutative48.4%
Simplified48.4%
Final simplification58.9%
(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.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.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 35.7%
metadata-eval35.7%
sqrt-prod35.8%
div-inv35.8%
pow1/235.8%
Applied egg-rr35.8%
unpow1/235.8%
Simplified35.8%
Final simplification35.8%
(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 2024066
(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)))