
(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) (- (+ (* 3.0 y) (/ 1.0 (* x 3.0))) 3.0)))
double code(double x, double y) {
return sqrt(x) * (((3.0 * y) + (1.0 / (x * 3.0))) - 3.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * (((3.0d0 * y) + (1.0d0 / (x * 3.0d0))) - 3.0d0)
end function
public static double code(double x, double y) {
return Math.sqrt(x) * (((3.0 * y) + (1.0 / (x * 3.0))) - 3.0);
}
def code(x, y): return math.sqrt(x) * (((3.0 * y) + (1.0 / (x * 3.0))) - 3.0)
function code(x, y) return Float64(sqrt(x) * Float64(Float64(Float64(3.0 * y) + Float64(1.0 / Float64(x * 3.0))) - 3.0)) end
function tmp = code(x, y) tmp = sqrt(x) * (((3.0 * y) + (1.0 / (x * 3.0))) - 3.0); end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(N[(N[(3.0 * y), $MachinePrecision] + N[(1.0 / N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \left(\left(3 \cdot y + \frac{1}{x \cdot 3}\right) - 3\right)
\end{array}
Initial program 99.4%
Simplified99.4%
Taylor expanded in y around 0 99.4%
div-inv99.4%
clear-num99.4%
div-inv99.4%
metadata-eval99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sqrt (/ 0.1111111111111111 x))))
(if (<= x 1.5e-78)
t_0
(if (<= x 6.8e-32)
(* y (* (sqrt x) 3.0))
(if (<= x 1.25e-12) t_0 (* (sqrt x) (- (* 3.0 y) 3.0)))))))
double code(double x, double y) {
double t_0 = sqrt((0.1111111111111111 / x));
double tmp;
if (x <= 1.5e-78) {
tmp = t_0;
} else if (x <= 6.8e-32) {
tmp = y * (sqrt(x) * 3.0);
} else if (x <= 1.25e-12) {
tmp = t_0;
} else {
tmp = sqrt(x) * ((3.0 * 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((0.1111111111111111d0 / x))
if (x <= 1.5d-78) then
tmp = t_0
else if (x <= 6.8d-32) then
tmp = y * (sqrt(x) * 3.0d0)
else if (x <= 1.25d-12) then
tmp = t_0
else
tmp = sqrt(x) * ((3.0d0 * y) - 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sqrt((0.1111111111111111 / x));
double tmp;
if (x <= 1.5e-78) {
tmp = t_0;
} else if (x <= 6.8e-32) {
tmp = y * (Math.sqrt(x) * 3.0);
} else if (x <= 1.25e-12) {
tmp = t_0;
} else {
tmp = Math.sqrt(x) * ((3.0 * y) - 3.0);
}
return tmp;
}
def code(x, y): t_0 = math.sqrt((0.1111111111111111 / x)) tmp = 0 if x <= 1.5e-78: tmp = t_0 elif x <= 6.8e-32: tmp = y * (math.sqrt(x) * 3.0) elif x <= 1.25e-12: tmp = t_0 else: tmp = math.sqrt(x) * ((3.0 * y) - 3.0) return tmp
function code(x, y) t_0 = sqrt(Float64(0.1111111111111111 / x)) tmp = 0.0 if (x <= 1.5e-78) tmp = t_0; elseif (x <= 6.8e-32) tmp = Float64(y * Float64(sqrt(x) * 3.0)); elseif (x <= 1.25e-12) tmp = t_0; else tmp = Float64(sqrt(x) * Float64(Float64(3.0 * y) - 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = sqrt((0.1111111111111111 / x)); tmp = 0.0; if (x <= 1.5e-78) tmp = t_0; elseif (x <= 6.8e-32) tmp = y * (sqrt(x) * 3.0); elseif (x <= 1.25e-12) tmp = t_0; else tmp = sqrt(x) * ((3.0 * y) - 3.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.5e-78], t$95$0, If[LessEqual[x, 6.8e-32], N[(y * N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e-12], t$95$0, N[(N[Sqrt[x], $MachinePrecision] * N[(N[(3.0 * y), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{if}\;x \leq 1.5 \cdot 10^{-78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-32}:\\
\;\;\;\;y \cdot \left(\sqrt{x} \cdot 3\right)\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-12}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y - 3\right)\\
\end{array}
\end{array}
if x < 1.49999999999999994e-78 or 6.79999999999999956e-32 < x < 1.24999999999999992e-12Initial program 99.3%
+-commutative99.3%
associate--l+99.3%
distribute-rgt-in99.3%
remove-double-neg99.3%
distribute-lft-neg-in99.3%
distribute-rgt-neg-in99.3%
mul-1-neg99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.2%
distribute-neg-frac99.2%
*-commutative99.2%
associate-/r/99.3%
associate-/l/99.3%
associate-/r/99.2%
Simplified99.3%
Taylor expanded in x around 0 78.5%
*-commutative78.5%
clear-num78.4%
un-div-inv78.4%
div-inv78.6%
metadata-eval78.6%
Applied egg-rr78.6%
*-un-lft-identity78.6%
add-sqr-sqrt78.5%
metadata-eval78.5%
swap-sqr78.5%
times-frac78.6%
metadata-eval78.6%
metadata-eval78.6%
sqrt-prod78.7%
metadata-eval78.7%
div-inv78.6%
sqrt-div78.8%
clear-num78.9%
sqrt-div78.7%
metadata-eval78.7%
*-commutative78.7%
*-commutative78.7%
Applied egg-rr78.7%
*-inverses78.7%
*-rgt-identity78.7%
Simplified78.7%
metadata-eval78.7%
sqrt-div78.9%
pow1/278.9%
Applied egg-rr78.9%
unpow1/278.9%
Simplified78.9%
if 1.49999999999999994e-78 < x < 6.79999999999999956e-32Initial program 99.3%
+-commutative99.3%
associate--l+99.3%
distribute-rgt-in99.3%
remove-double-neg99.3%
distribute-lft-neg-in99.3%
distribute-rgt-neg-in99.3%
mul-1-neg99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.2%
distribute-neg-frac99.2%
*-commutative99.2%
associate-/r/99.0%
associate-/l/99.0%
associate-/r/99.2%
Simplified99.2%
Taylor expanded in y around inf 74.7%
if 1.24999999999999992e-12 < x Initial program 99.5%
Simplified99.5%
Taylor expanded in x around inf 98.2%
Final simplification88.8%
(FPCore (x y)
:precision binary64
(if (<= y -7.2e+41)
(* (sqrt x) (* 3.0 y))
(if (<= y 4.5e-20)
(* (sqrt x) (- (* 0.3333333333333333 (/ 1.0 x)) 3.0))
(* (* (sqrt x) 3.0) (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -7.2e+41) {
tmp = sqrt(x) * (3.0 * y);
} else if (y <= 4.5e-20) {
tmp = sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0);
} else {
tmp = (sqrt(x) * 3.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 (y <= (-7.2d+41)) then
tmp = sqrt(x) * (3.0d0 * y)
else if (y <= 4.5d-20) then
tmp = sqrt(x) * ((0.3333333333333333d0 * (1.0d0 / x)) - 3.0d0)
else
tmp = (sqrt(x) * 3.0d0) * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.2e+41) {
tmp = Math.sqrt(x) * (3.0 * y);
} else if (y <= 4.5e-20) {
tmp = Math.sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0);
} else {
tmp = (Math.sqrt(x) * 3.0) * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.2e+41: tmp = math.sqrt(x) * (3.0 * y) elif y <= 4.5e-20: tmp = math.sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0) else: tmp = (math.sqrt(x) * 3.0) * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.2e+41) tmp = Float64(sqrt(x) * Float64(3.0 * y)); elseif (y <= 4.5e-20) tmp = Float64(sqrt(x) * Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 3.0)); else tmp = Float64(Float64(sqrt(x) * 3.0) * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.2e+41) tmp = sqrt(x) * (3.0 * y); elseif (y <= 4.5e-20) tmp = sqrt(x) * ((0.3333333333333333 * (1.0 / x)) - 3.0); else tmp = (sqrt(x) * 3.0) * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.2e+41], N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e-20], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;\sqrt{x} \cdot \left(0.3333333333333333 \cdot \frac{1}{x} - 3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x} \cdot 3\right) \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if y < -7.20000000000000051e41Initial program 99.4%
Simplified99.6%
Taylor expanded in y around inf 73.2%
associate-*r*73.2%
*-commutative73.2%
Simplified73.2%
if -7.20000000000000051e41 < y < 4.5000000000000001e-20Initial program 99.3%
Simplified99.3%
Taylor expanded in y around 0 97.1%
if 4.5000000000000001e-20 < y Initial program 99.6%
+-commutative99.6%
associate--l+99.6%
distribute-rgt-in99.6%
remove-double-neg99.6%
distribute-lft-neg-in99.6%
distribute-rgt-neg-in99.6%
mul-1-neg99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
distribute-neg-frac99.6%
*-commutative99.6%
associate-/r/99.6%
associate-/l/99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in x around inf 84.3%
Final simplification88.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.42e+41)
(* (sqrt x) (* 3.0 y))
(if (<= y 4.5e-20)
(* (sqrt x) (+ (/ 0.3333333333333333 x) -3.0))
(* (* (sqrt x) 3.0) (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.42e+41) {
tmp = sqrt(x) * (3.0 * y);
} else if (y <= 4.5e-20) {
tmp = sqrt(x) * ((0.3333333333333333 / x) + -3.0);
} else {
tmp = (sqrt(x) * 3.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 (y <= (-1.42d+41)) then
tmp = sqrt(x) * (3.0d0 * y)
else if (y <= 4.5d-20) then
tmp = sqrt(x) * ((0.3333333333333333d0 / x) + (-3.0d0))
else
tmp = (sqrt(x) * 3.0d0) * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.42e+41) {
tmp = Math.sqrt(x) * (3.0 * y);
} else if (y <= 4.5e-20) {
tmp = Math.sqrt(x) * ((0.3333333333333333 / x) + -3.0);
} else {
tmp = (Math.sqrt(x) * 3.0) * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.42e+41: tmp = math.sqrt(x) * (3.0 * y) elif y <= 4.5e-20: tmp = math.sqrt(x) * ((0.3333333333333333 / x) + -3.0) else: tmp = (math.sqrt(x) * 3.0) * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.42e+41) tmp = Float64(sqrt(x) * Float64(3.0 * y)); elseif (y <= 4.5e-20) tmp = Float64(sqrt(x) * Float64(Float64(0.3333333333333333 / x) + -3.0)); else tmp = Float64(Float64(sqrt(x) * 3.0) * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.42e+41) tmp = sqrt(x) * (3.0 * y); elseif (y <= 4.5e-20) tmp = sqrt(x) * ((0.3333333333333333 / x) + -3.0); else tmp = (sqrt(x) * 3.0) * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.42e+41], N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e-20], N[(N[Sqrt[x], $MachinePrecision] * N[(N[(0.3333333333333333 / x), $MachinePrecision] + -3.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[x], $MachinePrecision] * 3.0), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;\sqrt{x} \cdot \left(\frac{0.3333333333333333}{x} + -3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x} \cdot 3\right) \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if y < -1.42000000000000007e41Initial program 99.4%
Simplified99.6%
Taylor expanded in y around inf 73.2%
associate-*r*73.2%
*-commutative73.2%
Simplified73.2%
if -1.42000000000000007e41 < y < 4.5000000000000001e-20Initial program 99.3%
Simplified99.3%
Taylor expanded in y around 0 97.1%
sub-neg97.1%
associate-*r/97.1%
metadata-eval97.1%
metadata-eval97.1%
Simplified97.1%
if 4.5000000000000001e-20 < y Initial program 99.6%
+-commutative99.6%
associate--l+99.6%
distribute-rgt-in99.6%
remove-double-neg99.6%
distribute-lft-neg-in99.6%
distribute-rgt-neg-in99.6%
mul-1-neg99.6%
metadata-eval99.6%
*-commutative99.6%
associate-/r*99.6%
distribute-neg-frac99.6%
*-commutative99.6%
associate-/r/99.6%
associate-/l/99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in x around inf 84.3%
Final simplification88.0%
(FPCore (x y) :precision binary64 (* (sqrt x) (- (+ (* 3.0 y) (/ 0.3333333333333333 x)) 3.0)))
double code(double x, double y) {
return sqrt(x) * (((3.0 * y) + (0.3333333333333333 / x)) - 3.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sqrt(x) * (((3.0d0 * y) + (0.3333333333333333d0 / x)) - 3.0d0)
end function
public static double code(double x, double y) {
return Math.sqrt(x) * (((3.0 * y) + (0.3333333333333333 / x)) - 3.0);
}
def code(x, y): return math.sqrt(x) * (((3.0 * y) + (0.3333333333333333 / x)) - 3.0)
function code(x, y) return Float64(sqrt(x) * Float64(Float64(Float64(3.0 * y) + Float64(0.3333333333333333 / x)) - 3.0)) end
function tmp = code(x, y) tmp = sqrt(x) * (((3.0 * y) + (0.3333333333333333 / x)) - 3.0); end
code[x_, y_] := N[(N[Sqrt[x], $MachinePrecision] * N[(N[(N[(3.0 * y), $MachinePrecision] + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x} \cdot \left(\left(3 \cdot y + \frac{0.3333333333333333}{x}\right) - 3\right)
\end{array}
Initial program 99.4%
Simplified99.4%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around 0 99.4%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (or (<= y -33000000000.0) (not (<= y 6.7e+49))) (* 3.0 (* (sqrt x) y)) (sqrt (/ 0.1111111111111111 x))))
double code(double x, double y) {
double tmp;
if ((y <= -33000000000.0) || !(y <= 6.7e+49)) {
tmp = 3.0 * (sqrt(x) * y);
} else {
tmp = sqrt((0.1111111111111111 / x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-33000000000.0d0)) .or. (.not. (y <= 6.7d+49))) then
tmp = 3.0d0 * (sqrt(x) * y)
else
tmp = sqrt((0.1111111111111111d0 / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -33000000000.0) || !(y <= 6.7e+49)) {
tmp = 3.0 * (Math.sqrt(x) * y);
} else {
tmp = Math.sqrt((0.1111111111111111 / x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -33000000000.0) or not (y <= 6.7e+49): tmp = 3.0 * (math.sqrt(x) * y) else: tmp = math.sqrt((0.1111111111111111 / x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -33000000000.0) || !(y <= 6.7e+49)) tmp = Float64(3.0 * Float64(sqrt(x) * y)); else tmp = sqrt(Float64(0.1111111111111111 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -33000000000.0) || ~((y <= 6.7e+49))) tmp = 3.0 * (sqrt(x) * y); else tmp = sqrt((0.1111111111111111 / x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -33000000000.0], N[Not[LessEqual[y, 6.7e+49]], $MachinePrecision]], N[(3.0 * N[(N[Sqrt[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -33000000000 \lor \neg \left(y \leq 6.7 \cdot 10^{+49}\right):\\
\;\;\;\;3 \cdot \left(\sqrt{x} \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\end{array}
\end{array}
if y < -3.3e10 or 6.6999999999999999e49 < y Initial program 99.5%
Simplified99.6%
Taylor expanded in y around inf 79.6%
if -3.3e10 < y < 6.6999999999999999e49Initial program 99.3%
+-commutative99.3%
associate--l+99.3%
distribute-rgt-in99.3%
remove-double-neg99.3%
distribute-lft-neg-in99.3%
distribute-rgt-neg-in99.3%
mul-1-neg99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
distribute-neg-frac99.3%
*-commutative99.3%
associate-/r/99.3%
associate-/l/99.3%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in x around 0 48.5%
*-commutative48.5%
clear-num48.5%
un-div-inv48.5%
div-inv48.6%
metadata-eval48.6%
Applied egg-rr48.6%
*-un-lft-identity48.6%
add-sqr-sqrt48.5%
metadata-eval48.5%
swap-sqr48.5%
times-frac48.6%
metadata-eval48.6%
metadata-eval48.6%
sqrt-prod48.7%
metadata-eval48.7%
div-inv48.7%
sqrt-div48.7%
clear-num48.7%
sqrt-div48.6%
metadata-eval48.6%
*-commutative48.6%
*-commutative48.6%
Applied egg-rr48.6%
*-inverses48.6%
*-rgt-identity48.6%
Simplified48.6%
metadata-eval48.6%
sqrt-div48.7%
pow1/248.7%
Applied egg-rr48.7%
unpow1/248.7%
Simplified48.7%
Final simplification63.2%
(FPCore (x y) :precision binary64 (if (or (<= y -4.2e+20) (not (<= y 1.35e+51))) (* (sqrt x) (* 3.0 y)) (sqrt (/ 0.1111111111111111 x))))
double code(double x, double y) {
double tmp;
if ((y <= -4.2e+20) || !(y <= 1.35e+51)) {
tmp = sqrt(x) * (3.0 * y);
} else {
tmp = sqrt((0.1111111111111111 / x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-4.2d+20)) .or. (.not. (y <= 1.35d+51))) then
tmp = sqrt(x) * (3.0d0 * y)
else
tmp = sqrt((0.1111111111111111d0 / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -4.2e+20) || !(y <= 1.35e+51)) {
tmp = Math.sqrt(x) * (3.0 * y);
} else {
tmp = Math.sqrt((0.1111111111111111 / x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -4.2e+20) or not (y <= 1.35e+51): tmp = math.sqrt(x) * (3.0 * y) else: tmp = math.sqrt((0.1111111111111111 / x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -4.2e+20) || !(y <= 1.35e+51)) tmp = Float64(sqrt(x) * Float64(3.0 * y)); else tmp = sqrt(Float64(0.1111111111111111 / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -4.2e+20) || ~((y <= 1.35e+51))) tmp = sqrt(x) * (3.0 * y); else tmp = sqrt((0.1111111111111111 / x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -4.2e+20], N[Not[LessEqual[y, 1.35e+51]], $MachinePrecision]], N[(N[Sqrt[x], $MachinePrecision] * N[(3.0 * y), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+20} \lor \neg \left(y \leq 1.35 \cdot 10^{+51}\right):\\
\;\;\;\;\sqrt{x} \cdot \left(3 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\end{array}
\end{array}
if y < -4.2e20 or 1.34999999999999996e51 < y Initial program 99.5%
Simplified99.6%
Taylor expanded in y around inf 79.6%
associate-*r*79.7%
*-commutative79.7%
Simplified79.7%
if -4.2e20 < y < 1.34999999999999996e51Initial program 99.3%
+-commutative99.3%
associate--l+99.3%
distribute-rgt-in99.3%
remove-double-neg99.3%
distribute-lft-neg-in99.3%
distribute-rgt-neg-in99.3%
mul-1-neg99.3%
metadata-eval99.3%
*-commutative99.3%
associate-/r*99.3%
distribute-neg-frac99.3%
*-commutative99.3%
associate-/r/99.3%
associate-/l/99.3%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in x around 0 48.5%
*-commutative48.5%
clear-num48.5%
un-div-inv48.5%
div-inv48.6%
metadata-eval48.6%
Applied egg-rr48.6%
*-un-lft-identity48.6%
add-sqr-sqrt48.5%
metadata-eval48.5%
swap-sqr48.5%
times-frac48.6%
metadata-eval48.6%
metadata-eval48.6%
sqrt-prod48.7%
metadata-eval48.7%
div-inv48.7%
sqrt-div48.7%
clear-num48.7%
sqrt-div48.6%
metadata-eval48.6%
*-commutative48.6%
*-commutative48.6%
Applied egg-rr48.6%
*-inverses48.6%
*-rgt-identity48.6%
Simplified48.6%
metadata-eval48.6%
sqrt-div48.7%
pow1/248.7%
Applied egg-rr48.7%
unpow1/248.7%
Simplified48.7%
Final simplification63.3%
(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%
distribute-rgt-in99.4%
remove-double-neg99.4%
distribute-lft-neg-in99.4%
distribute-rgt-neg-in99.4%
mul-1-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-/r*99.4%
distribute-neg-frac99.4%
*-commutative99.4%
associate-/r/99.4%
associate-/l/99.4%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in x around 0 35.5%
*-commutative35.5%
clear-num35.5%
un-div-inv35.5%
div-inv35.6%
metadata-eval35.6%
Applied egg-rr35.6%
*-un-lft-identity35.6%
add-sqr-sqrt35.5%
metadata-eval35.5%
swap-sqr35.6%
times-frac35.6%
metadata-eval35.6%
metadata-eval35.6%
sqrt-prod35.6%
metadata-eval35.6%
div-inv35.6%
sqrt-div35.7%
clear-num35.7%
sqrt-div35.6%
metadata-eval35.6%
*-commutative35.6%
*-commutative35.6%
Applied egg-rr35.6%
*-inverses35.6%
*-rgt-identity35.6%
Simplified35.6%
metadata-eval35.6%
sqrt-div35.7%
pow1/235.7%
Applied egg-rr35.7%
unpow1/235.7%
Simplified35.7%
Final simplification35.7%
(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 2023195
(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)))