
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / 2.0d0) * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * Math.sqrt(z)));
}
def code(x, y, z): return (1.0 / 2.0) * (x + (y * math.sqrt(z)))
function code(x, y, z) return Float64(Float64(1.0 / 2.0) * Float64(x + Float64(y * sqrt(z)))) end
function tmp = code(x, y, z) tmp = (1.0 / 2.0) * (x + (y * sqrt(z))); end
code[x_, y_, z_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / 2.0d0) * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * Math.sqrt(z)));
}
def code(x, y, z): return (1.0 / 2.0) * (x + (y * math.sqrt(z)))
function code(x, y, z) return Float64(Float64(1.0 / 2.0) * Float64(x + Float64(y * sqrt(z)))) end
function tmp = code(x, y, z) tmp = (1.0 / 2.0) * (x + (y * sqrt(z))); end
code[x_, y_, z_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
\end{array}
(FPCore (x y z) :precision binary64 (* 0.5 (+ x (/ y (pow z -0.5)))))
double code(double x, double y, double z) {
return 0.5 * (x + (y / pow(z, -0.5)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * (x + (y / (z ** (-0.5d0))))
end function
public static double code(double x, double y, double z) {
return 0.5 * (x + (y / Math.pow(z, -0.5)));
}
def code(x, y, z): return 0.5 * (x + (y / math.pow(z, -0.5)))
function code(x, y, z) return Float64(0.5 * Float64(x + Float64(y / (z ^ -0.5)))) end
function tmp = code(x, y, z) tmp = 0.5 * (x + (y / (z ^ -0.5))); end
code[x_, y_, z_] := N[(0.5 * N[(x + N[(y / N[Power[z, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x + \frac{y}{{z}^{-0.5}}\right)
\end{array}
Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
add-sqr-sqrt52.5%
sqrt-unprod60.8%
pow1/260.8%
*-commutative60.8%
*-commutative60.8%
swap-sqr58.8%
add-sqr-sqrt58.8%
Applied egg-rr58.8%
unpow1/258.8%
*-commutative58.8%
associate-*l*60.8%
Simplified60.8%
sqrt-prod45.5%
sqrt-prod49.0%
associate-*r*49.0%
add-sqr-sqrt99.8%
*-commutative99.8%
pow1/299.8%
metadata-eval99.8%
pow-prod-up99.6%
associate-*r*99.6%
Applied egg-rr99.6%
associate-*r*99.6%
remove-double-div99.6%
metadata-eval99.6%
pow-prod-up99.7%
metadata-eval99.7%
pow1/299.7%
sqrt-div99.7%
associate-/r/99.8%
clear-num99.8%
inv-pow99.8%
sqrt-pow199.8%
metadata-eval99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (sqrt z)))) (if (or (<= t_0 -5e-12) (not (<= t_0 2e-34))) (* 0.5 t_0) (* 0.5 x))))
double code(double x, double y, double z) {
double t_0 = y * sqrt(z);
double tmp;
if ((t_0 <= -5e-12) || !(t_0 <= 2e-34)) {
tmp = 0.5 * t_0;
} else {
tmp = 0.5 * x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * sqrt(z)
if ((t_0 <= (-5d-12)) .or. (.not. (t_0 <= 2d-34))) then
tmp = 0.5d0 * t_0
else
tmp = 0.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * Math.sqrt(z);
double tmp;
if ((t_0 <= -5e-12) || !(t_0 <= 2e-34)) {
tmp = 0.5 * t_0;
} else {
tmp = 0.5 * x;
}
return tmp;
}
def code(x, y, z): t_0 = y * math.sqrt(z) tmp = 0 if (t_0 <= -5e-12) or not (t_0 <= 2e-34): tmp = 0.5 * t_0 else: tmp = 0.5 * x return tmp
function code(x, y, z) t_0 = Float64(y * sqrt(z)) tmp = 0.0 if ((t_0 <= -5e-12) || !(t_0 <= 2e-34)) tmp = Float64(0.5 * t_0); else tmp = Float64(0.5 * x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * sqrt(z); tmp = 0.0; if ((t_0 <= -5e-12) || ~((t_0 <= 2e-34))) tmp = 0.5 * t_0; else tmp = 0.5 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-12], N[Not[LessEqual[t$95$0, 2e-34]], $MachinePrecision]], N[(0.5 * t$95$0), $MachinePrecision], N[(0.5 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \sqrt{z}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{-12} \lor \neg \left(t_0 \leq 2 \cdot 10^{-34}\right):\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot x\\
\end{array}
\end{array}
if (*.f64 y (sqrt.f64 z)) < -4.9999999999999997e-12 or 1.99999999999999986e-34 < (*.f64 y (sqrt.f64 z)) Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 80.1%
if -4.9999999999999997e-12 < (*.f64 y (sqrt.f64 z)) < 1.99999999999999986e-34Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 79.9%
Final simplification80.0%
(FPCore (x y z) :precision binary64 (* 0.5 (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
return 0.5 * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
return 0.5 * (x + (y * Math.sqrt(z)));
}
def code(x, y, z): return 0.5 * (x + (y * math.sqrt(z)))
function code(x, y, z) return Float64(0.5 * Float64(x + Float64(y * sqrt(z)))) end
function tmp = code(x, y, z) tmp = 0.5 * (x + (y * sqrt(z))); end
code[x_, y_, z_] := N[(0.5 * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x + y \cdot \sqrt{z}\right)
\end{array}
Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y -5.8e+193) (* 0.5 (* y (/ (- y) (/ x z)))) (if (<= y 3.4e+190) (* 0.5 x) (* 0.5 (/ 1.0 (/ x (* y (* y z))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+193) {
tmp = 0.5 * (y * (-y / (x / z)));
} else if (y <= 3.4e+190) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * (1.0 / (x / (y * (y * z))));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-5.8d+193)) then
tmp = 0.5d0 * (y * (-y / (x / z)))
else if (y <= 3.4d+190) then
tmp = 0.5d0 * x
else
tmp = 0.5d0 * (1.0d0 / (x / (y * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+193) {
tmp = 0.5 * (y * (-y / (x / z)));
} else if (y <= 3.4e+190) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * (1.0 / (x / (y * (y * z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.8e+193: tmp = 0.5 * (y * (-y / (x / z))) elif y <= 3.4e+190: tmp = 0.5 * x else: tmp = 0.5 * (1.0 / (x / (y * (y * z)))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.8e+193) tmp = Float64(0.5 * Float64(y * Float64(Float64(-y) / Float64(x / z)))); elseif (y <= 3.4e+190) tmp = Float64(0.5 * x); else tmp = Float64(0.5 * Float64(1.0 / Float64(x / Float64(y * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.8e+193) tmp = 0.5 * (y * (-y / (x / z))); elseif (y <= 3.4e+190) tmp = 0.5 * x; else tmp = 0.5 * (1.0 / (x / (y * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.8e+193], N[(0.5 * N[(y * N[((-y) / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+190], N[(0.5 * x), $MachinePrecision], N[(0.5 * N[(1.0 / N[(x / N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+193}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{-y}{\frac{x}{z}}\right)\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+190}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{1}{\frac{x}{y \cdot \left(y \cdot z\right)}}\\
\end{array}
\end{array}
if y < -5.80000000000000026e193Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
flip-+23.3%
clear-num23.2%
*-commutative23.2%
*-commutative23.2%
swap-sqr3.1%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
unsub-neg89.2%
associate-*l/89.1%
*-lft-identity89.1%
unpow289.1%
associate-/r*89.1%
associate-/r*89.1%
Simplified89.1%
Taylor expanded in z around 0 38.4%
mul-1-neg38.4%
unpow238.4%
associate-/l*38.3%
Simplified38.3%
*-un-lft-identity38.3%
times-frac38.5%
Applied egg-rr38.5%
if -5.80000000000000026e193 < y < 3.3999999999999999e190Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 56.3%
if 3.3999999999999999e190 < y Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
flip-+10.7%
clear-num10.7%
*-commutative10.7%
*-commutative10.7%
swap-sqr3.7%
add-sqr-sqrt3.7%
Applied egg-rr3.7%
Taylor expanded in x around 0 99.5%
mul-1-neg99.5%
unsub-neg99.5%
associate-*l/99.6%
*-lft-identity99.6%
unpow299.6%
associate-/r*99.6%
associate-/r*99.6%
Simplified99.6%
Taylor expanded in z around 0 16.7%
associate-*r/16.7%
unpow216.7%
*-commutative16.7%
times-frac16.7%
metadata-eval16.7%
distribute-neg-frac16.7%
distribute-lft-neg-out16.7%
*-inverses16.7%
associate-/r*16.7%
times-frac16.8%
associate-/r/16.7%
associate-/r/16.8%
*-commutative16.8%
*-inverses16.8%
metadata-eval16.8%
times-frac16.8%
*-lft-identity16.8%
associate-/l/16.8%
/-rgt-identity16.8%
Simplified16.8%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.1%
add-sqr-sqrt21.1%
neg-sub00.7%
Applied egg-rr0.7%
neg-sub021.1%
associate-/l/21.0%
*-commutative21.0%
associate-*r*21.0%
distribute-neg-frac21.0%
*-commutative21.0%
associate-*r*21.0%
Simplified21.0%
Final simplification51.2%
(FPCore (x y z) :precision binary64 (if (<= y -1.15e+191) (* 0.5 (* y (/ (- y) (/ x z)))) (if (<= y 2e+188) (* 0.5 x) (* 0.5 (/ 1.0 (/ (/ x y) (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+191) {
tmp = 0.5 * (y * (-y / (x / z)));
} else if (y <= 2e+188) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * (1.0 / ((x / y) / (y * z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.15d+191)) then
tmp = 0.5d0 * (y * (-y / (x / z)))
else if (y <= 2d+188) then
tmp = 0.5d0 * x
else
tmp = 0.5d0 * (1.0d0 / ((x / y) / (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+191) {
tmp = 0.5 * (y * (-y / (x / z)));
} else if (y <= 2e+188) {
tmp = 0.5 * x;
} else {
tmp = 0.5 * (1.0 / ((x / y) / (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+191: tmp = 0.5 * (y * (-y / (x / z))) elif y <= 2e+188: tmp = 0.5 * x else: tmp = 0.5 * (1.0 / ((x / y) / (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+191) tmp = Float64(0.5 * Float64(y * Float64(Float64(-y) / Float64(x / z)))); elseif (y <= 2e+188) tmp = Float64(0.5 * x); else tmp = Float64(0.5 * Float64(1.0 / Float64(Float64(x / y) / Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.15e+191) tmp = 0.5 * (y * (-y / (x / z))); elseif (y <= 2e+188) tmp = 0.5 * x; else tmp = 0.5 * (1.0 / ((x / y) / (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+191], N[(0.5 * N[(y * N[((-y) / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+188], N[(0.5 * x), $MachinePrecision], N[(0.5 * N[(1.0 / N[(N[(x / y), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+191}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{-y}{\frac{x}{z}}\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+188}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{1}{\frac{\frac{x}{y}}{y \cdot z}}\\
\end{array}
\end{array}
if y < -1.15e191Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
flip-+23.3%
clear-num23.2%
*-commutative23.2%
*-commutative23.2%
swap-sqr3.1%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
unsub-neg89.2%
associate-*l/89.1%
*-lft-identity89.1%
unpow289.1%
associate-/r*89.1%
associate-/r*89.1%
Simplified89.1%
Taylor expanded in z around 0 38.4%
mul-1-neg38.4%
unpow238.4%
associate-/l*38.3%
Simplified38.3%
*-un-lft-identity38.3%
times-frac38.5%
Applied egg-rr38.5%
if -1.15e191 < y < 2e188Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 56.3%
if 2e188 < y Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
flip-+10.7%
clear-num10.7%
*-commutative10.7%
*-commutative10.7%
swap-sqr3.7%
add-sqr-sqrt3.7%
Applied egg-rr3.7%
Taylor expanded in x around 0 99.5%
mul-1-neg99.5%
unsub-neg99.5%
associate-*l/99.6%
*-lft-identity99.6%
unpow299.6%
associate-/r*99.6%
associate-/r*99.6%
Simplified99.6%
Taylor expanded in z around 0 16.7%
associate-*r/16.7%
unpow216.7%
*-commutative16.7%
times-frac16.7%
metadata-eval16.7%
distribute-neg-frac16.7%
distribute-lft-neg-out16.7%
*-inverses16.7%
associate-/r*16.7%
times-frac16.8%
associate-/r/16.7%
associate-/r/16.8%
*-commutative16.8%
*-inverses16.8%
metadata-eval16.8%
times-frac16.8%
*-lft-identity16.8%
associate-/l/16.8%
/-rgt-identity16.8%
Simplified16.8%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.1%
add-sqr-sqrt21.1%
neg-sub00.7%
Applied egg-rr0.7%
neg-sub021.1%
distribute-neg-frac21.1%
Simplified21.1%
Final simplification51.2%
(FPCore (x y z) :precision binary64 (if (<= y -2.5e+194) (* 0.5 (* z (/ (* y (- y)) x))) (* 0.5 x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.5e+194) {
tmp = 0.5 * (z * ((y * -y) / x));
} else {
tmp = 0.5 * x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2.5d+194)) then
tmp = 0.5d0 * (z * ((y * -y) / x))
else
tmp = 0.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.5e+194) {
tmp = 0.5 * (z * ((y * -y) / x));
} else {
tmp = 0.5 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.5e+194: tmp = 0.5 * (z * ((y * -y) / x)) else: tmp = 0.5 * x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.5e+194) tmp = Float64(0.5 * Float64(z * Float64(Float64(y * Float64(-y)) / x))); else tmp = Float64(0.5 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.5e+194) tmp = 0.5 * (z * ((y * -y) / x)); else tmp = 0.5 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.5e+194], N[(0.5 * N[(z * N[(N[(y * (-y)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+194}:\\
\;\;\;\;0.5 \cdot \left(z \cdot \frac{y \cdot \left(-y\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot x\\
\end{array}
\end{array}
if y < -2.49999999999999994e194Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
flip-+23.3%
clear-num23.2%
*-commutative23.2%
*-commutative23.2%
swap-sqr3.1%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
unsub-neg89.2%
associate-*l/89.1%
*-lft-identity89.1%
unpow289.1%
associate-/r*89.1%
associate-/r*89.1%
Simplified89.1%
Taylor expanded in z around 0 38.4%
mul-1-neg38.4%
unpow238.4%
associate-/l*38.3%
Simplified38.3%
associate-/r/38.4%
Applied egg-rr38.4%
if -2.49999999999999994e194 < y Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 50.2%
Final simplification49.3%
(FPCore (x y z) :precision binary64 (if (<= y -5.8e+195) (* 0.5 (* y (* z (- (/ y x))))) (* 0.5 x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+195) {
tmp = 0.5 * (y * (z * -(y / x)));
} else {
tmp = 0.5 * x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-5.8d+195)) then
tmp = 0.5d0 * (y * (z * -(y / x)))
else
tmp = 0.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+195) {
tmp = 0.5 * (y * (z * -(y / x)));
} else {
tmp = 0.5 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.8e+195: tmp = 0.5 * (y * (z * -(y / x))) else: tmp = 0.5 * x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.8e+195) tmp = Float64(0.5 * Float64(y * Float64(z * Float64(-Float64(y / x))))); else tmp = Float64(0.5 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.8e+195) tmp = 0.5 * (y * (z * -(y / x))); else tmp = 0.5 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.8e+195], N[(0.5 * N[(y * N[(z * (-N[(y / x), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+195}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \left(z \cdot \left(-\frac{y}{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot x\\
\end{array}
\end{array}
if y < -5.79999999999999984e195Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
flip-+23.3%
clear-num23.2%
*-commutative23.2%
*-commutative23.2%
swap-sqr3.1%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
unsub-neg89.2%
associate-*l/89.1%
*-lft-identity89.1%
unpow289.1%
associate-/r*89.1%
associate-/r*89.1%
Simplified89.1%
Taylor expanded in z around 0 38.4%
associate-*r/38.4%
unpow238.4%
*-commutative38.4%
times-frac38.4%
metadata-eval38.4%
distribute-neg-frac38.4%
distribute-lft-neg-out38.4%
*-inverses38.4%
associate-/r*38.4%
times-frac38.4%
associate-/r/38.4%
associate-/r/38.4%
*-commutative38.4%
*-inverses38.4%
metadata-eval38.4%
times-frac38.4%
*-lft-identity38.4%
associate-/l/38.4%
/-rgt-identity38.4%
Simplified38.4%
Taylor expanded in x around 0 38.4%
mul-1-neg38.4%
unpow238.4%
associate-/l*38.3%
associate-*r/38.5%
distribute-rgt-neg-in38.5%
associate-/r/38.4%
Simplified38.4%
if -5.79999999999999984e195 < y Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 50.2%
Final simplification49.3%
(FPCore (x y z) :precision binary64 (if (<= y -8.8e+192) (* 0.5 (/ (* (* y z) (- y)) x)) (* 0.5 x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.8e+192) {
tmp = 0.5 * (((y * z) * -y) / x);
} else {
tmp = 0.5 * x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-8.8d+192)) then
tmp = 0.5d0 * (((y * z) * -y) / x)
else
tmp = 0.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -8.8e+192) {
tmp = 0.5 * (((y * z) * -y) / x);
} else {
tmp = 0.5 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.8e+192: tmp = 0.5 * (((y * z) * -y) / x) else: tmp = 0.5 * x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.8e+192) tmp = Float64(0.5 * Float64(Float64(Float64(y * z) * Float64(-y)) / x)); else tmp = Float64(0.5 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8.8e+192) tmp = 0.5 * (((y * z) * -y) / x); else tmp = 0.5 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8.8e+192], N[(0.5 * N[(N[(N[(y * z), $MachinePrecision] * (-y)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(0.5 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{+192}:\\
\;\;\;\;0.5 \cdot \frac{\left(y \cdot z\right) \cdot \left(-y\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot x\\
\end{array}
\end{array}
if y < -8.8000000000000003e192Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
flip-+23.3%
clear-num23.2%
*-commutative23.2%
*-commutative23.2%
swap-sqr3.1%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
unsub-neg89.2%
associate-*l/89.1%
*-lft-identity89.1%
unpow289.1%
associate-/r*89.1%
associate-/r*89.1%
Simplified89.1%
Taylor expanded in z around 0 38.4%
associate-*r/38.4%
unpow238.4%
associate-*l*38.4%
*-commutative38.4%
neg-mul-138.4%
distribute-rgt-neg-in38.4%
distribute-lft-neg-in38.4%
*-commutative38.4%
Simplified38.4%
if -8.8000000000000003e192 < y Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 50.2%
Final simplification49.3%
(FPCore (x y z) :precision binary64 (if (<= y -9.6e+191) (* 0.5 (* y (/ (- y) (/ x z)))) (* 0.5 x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.6e+191) {
tmp = 0.5 * (y * (-y / (x / z)));
} else {
tmp = 0.5 * x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-9.6d+191)) then
tmp = 0.5d0 * (y * (-y / (x / z)))
else
tmp = 0.5d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.6e+191) {
tmp = 0.5 * (y * (-y / (x / z)));
} else {
tmp = 0.5 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.6e+191: tmp = 0.5 * (y * (-y / (x / z))) else: tmp = 0.5 * x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.6e+191) tmp = Float64(0.5 * Float64(y * Float64(Float64(-y) / Float64(x / z)))); else tmp = Float64(0.5 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.6e+191) tmp = 0.5 * (y * (-y / (x / z))); else tmp = 0.5 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.6e+191], N[(0.5 * N[(y * N[((-y) / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+191}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{-y}{\frac{x}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot x\\
\end{array}
\end{array}
if y < -9.59999999999999943e191Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
flip-+23.3%
clear-num23.2%
*-commutative23.2%
*-commutative23.2%
swap-sqr3.1%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
unsub-neg89.2%
associate-*l/89.1%
*-lft-identity89.1%
unpow289.1%
associate-/r*89.1%
associate-/r*89.1%
Simplified89.1%
Taylor expanded in z around 0 38.4%
mul-1-neg38.4%
unpow238.4%
associate-/l*38.3%
Simplified38.3%
*-un-lft-identity38.3%
times-frac38.5%
Applied egg-rr38.5%
if -9.59999999999999943e191 < y Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 50.2%
Final simplification49.3%
(FPCore (x y z) :precision binary64 (* 0.5 x))
double code(double x, double y, double z) {
return 0.5 * x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * x
end function
public static double code(double x, double y, double z) {
return 0.5 * x;
}
def code(x, y, z): return 0.5 * x
function code(x, y, z) return Float64(0.5 * x) end
function tmp = code(x, y, z) tmp = 0.5 * x; end
code[x_, y_, z_] := N[(0.5 * x), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot x
\end{array}
Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 46.6%
Final simplification46.6%
herbie shell --seed 2023261
(FPCore (x y z)
:name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B"
:precision binary64
(* (/ 1.0 2.0) (+ x (* y (sqrt z)))))