
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
(FPCore (x y z) :precision binary64 (/ (+ (* (+ x z) (/ (- x z) y)) y) 2.0))
double code(double x, double y, double z) {
return (((x + z) * ((x - z) / y)) + y) / 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x + z) * ((x - z) / y)) + y) / 2.0d0
end function
public static double code(double x, double y, double z) {
return (((x + z) * ((x - z) / y)) + y) / 2.0;
}
def code(x, y, z): return (((x + z) * ((x - z) / y)) + y) / 2.0
function code(x, y, z) return Float64(Float64(Float64(Float64(x + z) * Float64(Float64(x - z) / y)) + y) / 2.0) end
function tmp = code(x, y, z) tmp = (((x + z) * ((x - z) / y)) + y) / 2.0; end
code[x_, y_, z_] := N[(N[(N[(N[(x + z), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + z\right) \cdot \frac{x - z}{y} + y}{2}
\end{array}
Initial program 72.3%
Simplified0
Applied egg-rr0
(FPCore (x y z)
:precision binary64
(if (<= y 4e-169)
(/ (* z -0.5) (/ y z))
(if (<= y 3.3e-69)
(/ (/ (* x x) y) 2.0)
(if (<= y 0.0145) (* z (* (/ z y) -0.5)) (/ y 2.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4e-169) {
tmp = (z * -0.5) / (y / z);
} else if (y <= 3.3e-69) {
tmp = ((x * x) / y) / 2.0;
} else if (y <= 0.0145) {
tmp = z * ((z / y) * -0.5);
} else {
tmp = y / 2.0;
}
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 <= 4d-169) then
tmp = (z * (-0.5d0)) / (y / z)
else if (y <= 3.3d-69) then
tmp = ((x * x) / y) / 2.0d0
else if (y <= 0.0145d0) then
tmp = z * ((z / y) * (-0.5d0))
else
tmp = y / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4e-169) {
tmp = (z * -0.5) / (y / z);
} else if (y <= 3.3e-69) {
tmp = ((x * x) / y) / 2.0;
} else if (y <= 0.0145) {
tmp = z * ((z / y) * -0.5);
} else {
tmp = y / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4e-169: tmp = (z * -0.5) / (y / z) elif y <= 3.3e-69: tmp = ((x * x) / y) / 2.0 elif y <= 0.0145: tmp = z * ((z / y) * -0.5) else: tmp = y / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4e-169) tmp = Float64(Float64(z * -0.5) / Float64(y / z)); elseif (y <= 3.3e-69) tmp = Float64(Float64(Float64(x * x) / y) / 2.0); elseif (y <= 0.0145) tmp = Float64(z * Float64(Float64(z / y) * -0.5)); else tmp = Float64(y / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4e-169) tmp = (z * -0.5) / (y / z); elseif (y <= 3.3e-69) tmp = ((x * x) / y) / 2.0; elseif (y <= 0.0145) tmp = z * ((z / y) * -0.5); else tmp = y / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4e-169], N[(N[(z * -0.5), $MachinePrecision] / N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e-69], N[(N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[y, 0.0145], N[(z * N[(N[(z / y), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(y / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{-169}:\\
\;\;\;\;\frac{z \cdot -0.5}{\frac{y}{z}}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-69}:\\
\;\;\;\;\frac{\frac{x \cdot x}{y}}{2}\\
\mathbf{elif}\;y \leq 0.0145:\\
\;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{2}\\
\end{array}
\end{array}
if y < 4.00000000000000008e-169Initial program 80.1%
Simplified0
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
if 4.00000000000000008e-169 < y < 3.3e-69Initial program 96.2%
Simplified0
Taylor expanded in x around inf 0
Simplified0
if 3.3e-69 < y < 0.0145000000000000007Initial program 100.0%
Simplified0
Taylor expanded in z around inf 0
Simplified0
if 0.0145000000000000007 < y Initial program 37.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z)
:precision binary64
(if (<= y 1.05e-169)
(/ (* z -0.5) (/ y z))
(if (<= y 3.3e-69)
(* x (* x (/ 0.5 y)))
(if (<= y 0.038) (* z (* (/ z y) -0.5)) (/ y 2.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.05e-169) {
tmp = (z * -0.5) / (y / z);
} else if (y <= 3.3e-69) {
tmp = x * (x * (0.5 / y));
} else if (y <= 0.038) {
tmp = z * ((z / y) * -0.5);
} else {
tmp = y / 2.0;
}
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.05d-169) then
tmp = (z * (-0.5d0)) / (y / z)
else if (y <= 3.3d-69) then
tmp = x * (x * (0.5d0 / y))
else if (y <= 0.038d0) then
tmp = z * ((z / y) * (-0.5d0))
else
tmp = y / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.05e-169) {
tmp = (z * -0.5) / (y / z);
} else if (y <= 3.3e-69) {
tmp = x * (x * (0.5 / y));
} else if (y <= 0.038) {
tmp = z * ((z / y) * -0.5);
} else {
tmp = y / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.05e-169: tmp = (z * -0.5) / (y / z) elif y <= 3.3e-69: tmp = x * (x * (0.5 / y)) elif y <= 0.038: tmp = z * ((z / y) * -0.5) else: tmp = y / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.05e-169) tmp = Float64(Float64(z * -0.5) / Float64(y / z)); elseif (y <= 3.3e-69) tmp = Float64(x * Float64(x * Float64(0.5 / y))); elseif (y <= 0.038) tmp = Float64(z * Float64(Float64(z / y) * -0.5)); else tmp = Float64(y / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.05e-169) tmp = (z * -0.5) / (y / z); elseif (y <= 3.3e-69) tmp = x * (x * (0.5 / y)); elseif (y <= 0.038) tmp = z * ((z / y) * -0.5); else tmp = y / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.05e-169], N[(N[(z * -0.5), $MachinePrecision] / N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e-69], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.038], N[(z * N[(N[(z / y), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(y / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{-169}:\\
\;\;\;\;\frac{z \cdot -0.5}{\frac{y}{z}}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-69}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{elif}\;y \leq 0.038:\\
\;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{2}\\
\end{array}
\end{array}
if y < 1.05e-169Initial program 80.1%
Simplified0
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
if 1.05e-169 < y < 3.3e-69Initial program 96.2%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 3.3e-69 < y < 0.0379999999999999991Initial program 100.0%
Simplified0
Taylor expanded in z around inf 0
Simplified0
if 0.0379999999999999991 < y Initial program 37.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* (/ z y) -0.5))))
(if (<= y 4e-170)
t_0
(if (<= y 3e-69) (* x (* x (/ 0.5 y))) (if (<= y 0.42) t_0 (/ y 2.0))))))
double code(double x, double y, double z) {
double t_0 = z * ((z / y) * -0.5);
double tmp;
if (y <= 4e-170) {
tmp = t_0;
} else if (y <= 3e-69) {
tmp = x * (x * (0.5 / y));
} else if (y <= 0.42) {
tmp = t_0;
} else {
tmp = y / 2.0;
}
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 = z * ((z / y) * (-0.5d0))
if (y <= 4d-170) then
tmp = t_0
else if (y <= 3d-69) then
tmp = x * (x * (0.5d0 / y))
else if (y <= 0.42d0) then
tmp = t_0
else
tmp = y / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * ((z / y) * -0.5);
double tmp;
if (y <= 4e-170) {
tmp = t_0;
} else if (y <= 3e-69) {
tmp = x * (x * (0.5 / y));
} else if (y <= 0.42) {
tmp = t_0;
} else {
tmp = y / 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = z * ((z / y) * -0.5) tmp = 0 if y <= 4e-170: tmp = t_0 elif y <= 3e-69: tmp = x * (x * (0.5 / y)) elif y <= 0.42: tmp = t_0 else: tmp = y / 2.0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(z / y) * -0.5)) tmp = 0.0 if (y <= 4e-170) tmp = t_0; elseif (y <= 3e-69) tmp = Float64(x * Float64(x * Float64(0.5 / y))); elseif (y <= 0.42) tmp = t_0; else tmp = Float64(y / 2.0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((z / y) * -0.5); tmp = 0.0; if (y <= 4e-170) tmp = t_0; elseif (y <= 3e-69) tmp = x * (x * (0.5 / y)); elseif (y <= 0.42) tmp = t_0; else tmp = y / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(z / y), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4e-170], t$95$0, If[LessEqual[y, 3e-69], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.42], t$95$0, N[(y / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\
\mathbf{if}\;y \leq 4 \cdot 10^{-170}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-69}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{elif}\;y \leq 0.42:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{2}\\
\end{array}
\end{array}
if y < 3.99999999999999993e-170 or 2.99999999999999989e-69 < y < 0.419999999999999984Initial program 81.9%
Simplified0
Taylor expanded in z around inf 0
Simplified0
if 3.99999999999999993e-170 < y < 2.99999999999999989e-69Initial program 96.2%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 0.419999999999999984 < y Initial program 37.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (if (<= (* x x) 1e+303) (/ (+ y (/ (- (* x x) (* z z)) y)) 2.0) (/ (+ (/ x (/ y x)) y) 2.0)))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e+303) {
tmp = (y + (((x * x) - (z * z)) / y)) / 2.0;
} else {
tmp = ((x / (y / x)) + y) / 2.0;
}
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 ((x * x) <= 1d+303) then
tmp = (y + (((x * x) - (z * z)) / y)) / 2.0d0
else
tmp = ((x / (y / x)) + y) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e+303) {
tmp = (y + (((x * x) - (z * z)) / y)) / 2.0;
} else {
tmp = ((x / (y / x)) + y) / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 1e+303: tmp = (y + (((x * x) - (z * z)) / y)) / 2.0 else: tmp = ((x / (y / x)) + y) / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 1e+303) tmp = Float64(Float64(y + Float64(Float64(Float64(x * x) - Float64(z * z)) / y)) / 2.0); else tmp = Float64(Float64(Float64(x / Float64(y / x)) + y) / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 1e+303) tmp = (y + (((x * x) - (z * z)) / y)) / 2.0; else tmp = ((x / (y / x)) + y) / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e+303], N[(N[(y + N[(N[(N[(x * x), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{+303}:\\
\;\;\;\;\frac{y + \frac{x \cdot x - z \cdot z}{y}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\frac{y}{x}} + y}{2}\\
\end{array}
\end{array}
if (*.f64 x x) < 1e303Initial program 78.7%
Simplified0
if 1e303 < (*.f64 x x) Initial program 55.1%
Simplified0
Applied egg-rr0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= (* x x) 1e-162) (/ (- y (/ z (/ y z))) 2.0) (/ (+ (/ x (/ y x)) y) 2.0)))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-162) {
tmp = (y - (z / (y / z))) / 2.0;
} else {
tmp = ((x / (y / x)) + y) / 2.0;
}
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 ((x * x) <= 1d-162) then
tmp = (y - (z / (y / z))) / 2.0d0
else
tmp = ((x / (y / x)) + y) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-162) {
tmp = (y - (z / (y / z))) / 2.0;
} else {
tmp = ((x / (y / x)) + y) / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 1e-162: tmp = (y - (z / (y / z))) / 2.0 else: tmp = ((x / (y / x)) + y) / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 1e-162) tmp = Float64(Float64(y - Float64(z / Float64(y / z))) / 2.0); else tmp = Float64(Float64(Float64(x / Float64(y / x)) + y) / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 1e-162) tmp = (y - (z / (y / z))) / 2.0; else tmp = ((x / (y / x)) + y) / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-162], N[(N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-162}:\\
\;\;\;\;\frac{y - \frac{z}{\frac{y}{z}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\frac{y}{x}} + y}{2}\\
\end{array}
\end{array}
if (*.f64 x x) < 9.99999999999999954e-163Initial program 82.1%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Applied egg-rr0
if 9.99999999999999954e-163 < (*.f64 x x) Initial program 66.5%
Simplified0
Applied egg-rr0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+290) (/ (+ (/ x (/ y x)) y) 2.0) (* z (* (/ z y) -0.5))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+290) {
tmp = ((x / (y / x)) + y) / 2.0;
} else {
tmp = z * ((z / y) * -0.5);
}
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 ((z * z) <= 2d+290) then
tmp = ((x / (y / x)) + y) / 2.0d0
else
tmp = z * ((z / y) * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+290) {
tmp = ((x / (y / x)) + y) / 2.0;
} else {
tmp = z * ((z / y) * -0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e+290: tmp = ((x / (y / x)) + y) / 2.0 else: tmp = z * ((z / y) * -0.5) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+290) tmp = Float64(Float64(Float64(x / Float64(y / x)) + y) / 2.0); else tmp = Float64(z * Float64(Float64(z / y) * -0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e+290) tmp = ((x / (y / x)) + y) / 2.0; else tmp = z * ((z / y) * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+290], N[(N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] / 2.0), $MachinePrecision], N[(z * N[(N[(z / y), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\frac{\frac{x}{\frac{y}{x}} + y}{2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000012e290Initial program 77.1%
Simplified0
Applied egg-rr0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
if 2.00000000000000012e290 < (*.f64 z z) Initial program 55.4%
Simplified0
Taylor expanded in z around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+290) (/ (+ y (/ (* x x) y)) 2.0) (* z (* (/ z y) -0.5))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+290) {
tmp = (y + ((x * x) / y)) / 2.0;
} else {
tmp = z * ((z / y) * -0.5);
}
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 ((z * z) <= 2d+290) then
tmp = (y + ((x * x) / y)) / 2.0d0
else
tmp = z * ((z / y) * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+290) {
tmp = (y + ((x * x) / y)) / 2.0;
} else {
tmp = z * ((z / y) * -0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e+290: tmp = (y + ((x * x) / y)) / 2.0 else: tmp = z * ((z / y) * -0.5) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+290) tmp = Float64(Float64(y + Float64(Float64(x * x) / y)) / 2.0); else tmp = Float64(z * Float64(Float64(z / y) * -0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e+290) tmp = (y + ((x * x) / y)) / 2.0; else tmp = z * ((z / y) * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+290], N[(N[(y + N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(z * N[(N[(z / y), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\frac{y + \frac{x \cdot x}{y}}{2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{z}{y} \cdot -0.5\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000012e290Initial program 77.1%
Simplified0
Taylor expanded in x around inf 0
Simplified0
if 2.00000000000000012e290 < (*.f64 z z) Initial program 55.4%
Simplified0
Taylor expanded in z around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (if (<= y 2.2e+43) (* x (* x (/ 0.5 y))) (/ y 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e+43) {
tmp = x * (x * (0.5 / y));
} else {
tmp = y / 2.0;
}
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.2d+43) then
tmp = x * (x * (0.5d0 / y))
else
tmp = y / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e+43) {
tmp = x * (x * (0.5 / y));
} else {
tmp = y / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.2e+43: tmp = x * (x * (0.5 / y)) else: tmp = y / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.2e+43) tmp = Float64(x * Float64(x * Float64(0.5 / y))); else tmp = Float64(y / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.2e+43) tmp = x * (x * (0.5 / y)); else tmp = y / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.2e+43], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{+43}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{2}\\
\end{array}
\end{array}
if y < 2.20000000000000001e43Initial program 84.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 2.20000000000000001e43 < y Initial program 31.8%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (/ y 2.0))
double code(double x, double y, double z) {
return y / 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y / 2.0d0
end function
public static double code(double x, double y, double z) {
return y / 2.0;
}
def code(x, y, z): return y / 2.0
function code(x, y, z) return Float64(y / 2.0) end
function tmp = code(x, y, z) tmp = y / 2.0; end
code[x_, y_, z_] := N[(y / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{2}
\end{array}
Initial program 72.3%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x))))
double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y * 0.5d0) - (((0.5d0 / y) * (z + x)) * (z - x))
end function
public static double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
def code(x, y, z): return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x))
function code(x, y, z) return Float64(Float64(y * 0.5) - Float64(Float64(Float64(0.5 / y) * Float64(z + x)) * Float64(z - x))) end
function tmp = code(x, y, z) tmp = (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x)); end
code[x_, y_, z_] := N[(N[(y * 0.5), $MachinePrecision] - N[(N[(N[(0.5 / y), $MachinePrecision] * N[(z + x), $MachinePrecision]), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)
\end{array}
herbie shell --seed 2024111
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))