
(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 12 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 (/ (- y (/ (+ x z) (/ y (- z x)))) 2.0))
double code(double x, double y, double z) {
return (y - ((x + z) / (y / (z - x)))) / 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 - ((x + z) / (y / (z - x)))) / 2.0d0
end function
public static double code(double x, double y, double z) {
return (y - ((x + z) / (y / (z - x)))) / 2.0;
}
def code(x, y, z): return (y - ((x + z) / (y / (z - x)))) / 2.0
function code(x, y, z) return Float64(Float64(y - Float64(Float64(x + z) / Float64(y / Float64(z - x)))) / 2.0) end
function tmp = code(x, y, z) tmp = (y - ((x + z) / (y / (z - x)))) / 2.0; end
code[x_, y_, z_] := N[(N[(y - N[(N[(x + z), $MachinePrecision] / N[(y / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - \frac{x + z}{\frac{y}{z - x}}}{2}
\end{array}
Initial program 65.8%
Simplified0
Applied egg-rr0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* (/ z y) z) -0.5)))
(if (<= x 9.2e-234)
(/ y 2.0)
(if (<= x 4.5e-202)
t_0
(if (<= x 1.2e-22)
(/ y 2.0)
(if (<= x 2.45e+50) t_0 (/ (* (/ x y) x) 2.0)))))))
double code(double x, double y, double z) {
double t_0 = ((z / y) * z) * -0.5;
double tmp;
if (x <= 9.2e-234) {
tmp = y / 2.0;
} else if (x <= 4.5e-202) {
tmp = t_0;
} else if (x <= 1.2e-22) {
tmp = y / 2.0;
} else if (x <= 2.45e+50) {
tmp = t_0;
} else {
tmp = ((x / y) * x) / 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 / y) * z) * (-0.5d0)
if (x <= 9.2d-234) then
tmp = y / 2.0d0
else if (x <= 4.5d-202) then
tmp = t_0
else if (x <= 1.2d-22) then
tmp = y / 2.0d0
else if (x <= 2.45d+50) then
tmp = t_0
else
tmp = ((x / y) * x) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((z / y) * z) * -0.5;
double tmp;
if (x <= 9.2e-234) {
tmp = y / 2.0;
} else if (x <= 4.5e-202) {
tmp = t_0;
} else if (x <= 1.2e-22) {
tmp = y / 2.0;
} else if (x <= 2.45e+50) {
tmp = t_0;
} else {
tmp = ((x / y) * x) / 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = ((z / y) * z) * -0.5 tmp = 0 if x <= 9.2e-234: tmp = y / 2.0 elif x <= 4.5e-202: tmp = t_0 elif x <= 1.2e-22: tmp = y / 2.0 elif x <= 2.45e+50: tmp = t_0 else: tmp = ((x / y) * x) / 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(z / y) * z) * -0.5) tmp = 0.0 if (x <= 9.2e-234) tmp = Float64(y / 2.0); elseif (x <= 4.5e-202) tmp = t_0; elseif (x <= 1.2e-22) tmp = Float64(y / 2.0); elseif (x <= 2.45e+50) tmp = t_0; else tmp = Float64(Float64(Float64(x / y) * x) / 2.0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((z / y) * z) * -0.5; tmp = 0.0; if (x <= 9.2e-234) tmp = y / 2.0; elseif (x <= 4.5e-202) tmp = t_0; elseif (x <= 1.2e-22) tmp = y / 2.0; elseif (x <= 2.45e+50) tmp = t_0; else tmp = ((x / y) * x) / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(z / y), $MachinePrecision] * z), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[x, 9.2e-234], N[(y / 2.0), $MachinePrecision], If[LessEqual[x, 4.5e-202], t$95$0, If[LessEqual[x, 1.2e-22], N[(y / 2.0), $MachinePrecision], If[LessEqual[x, 2.45e+50], t$95$0, N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{z}{y} \cdot z\right) \cdot -0.5\\
\mathbf{if}\;x \leq 9.2 \cdot 10^{-234}:\\
\;\;\;\;\frac{y}{2}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-202}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{y}{2}\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y} \cdot x}{2}\\
\end{array}
\end{array}
if x < 9.19999999999999961e-234 or 4.50000000000000039e-202 < x < 1.20000000000000001e-22Initial program 68.8%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if 9.19999999999999961e-234 < x < 4.50000000000000039e-202 or 1.20000000000000001e-22 < x < 2.4500000000000001e50Initial program 74.6%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
if 2.4500000000000001e50 < x Initial program 53.2%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z)
:precision binary64
(if (<= x 1.05e-93)
(/ (- y (/ z (/ y z))) 2.0)
(if (<= x 1.16e-6)
(/ (- y (/ x (/ y (- z x)))) 2.0)
(if (<= x 3.6e+41)
(/ (- y (* (/ z y) z)) 2.0)
(/ (- y (* x (/ (- z x) y))) 2.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.05e-93) {
tmp = (y - (z / (y / z))) / 2.0;
} else if (x <= 1.16e-6) {
tmp = (y - (x / (y / (z - x)))) / 2.0;
} else if (x <= 3.6e+41) {
tmp = (y - ((z / y) * z)) / 2.0;
} else {
tmp = (y - (x * ((z - 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 <= 1.05d-93) then
tmp = (y - (z / (y / z))) / 2.0d0
else if (x <= 1.16d-6) then
tmp = (y - (x / (y / (z - x)))) / 2.0d0
else if (x <= 3.6d+41) then
tmp = (y - ((z / y) * z)) / 2.0d0
else
tmp = (y - (x * ((z - x) / y))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.05e-93) {
tmp = (y - (z / (y / z))) / 2.0;
} else if (x <= 1.16e-6) {
tmp = (y - (x / (y / (z - x)))) / 2.0;
} else if (x <= 3.6e+41) {
tmp = (y - ((z / y) * z)) / 2.0;
} else {
tmp = (y - (x * ((z - x) / y))) / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.05e-93: tmp = (y - (z / (y / z))) / 2.0 elif x <= 1.16e-6: tmp = (y - (x / (y / (z - x)))) / 2.0 elif x <= 3.6e+41: tmp = (y - ((z / y) * z)) / 2.0 else: tmp = (y - (x * ((z - x) / y))) / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.05e-93) tmp = Float64(Float64(y - Float64(z / Float64(y / z))) / 2.0); elseif (x <= 1.16e-6) tmp = Float64(Float64(y - Float64(x / Float64(y / Float64(z - x)))) / 2.0); elseif (x <= 3.6e+41) tmp = Float64(Float64(y - Float64(Float64(z / y) * z)) / 2.0); else tmp = Float64(Float64(y - Float64(x * Float64(Float64(z - x) / y))) / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.05e-93) tmp = (y - (z / (y / z))) / 2.0; elseif (x <= 1.16e-6) tmp = (y - (x / (y / (z - x)))) / 2.0; elseif (x <= 3.6e+41) tmp = (y - ((z / y) * z)) / 2.0; else tmp = (y - (x * ((z - x) / y))) / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.05e-93], N[(N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.16e-6], N[(N[(y - N[(x / N[(y / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.6e+41], N[(N[(y - N[(N[(z / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(y - N[(x * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.05 \cdot 10^{-93}:\\
\;\;\;\;\frac{y - \frac{z}{\frac{y}{z}}}{2}\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{-6}:\\
\;\;\;\;\frac{y - \frac{x}{\frac{y}{z - x}}}{2}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{y - \frac{z}{y} \cdot z}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x \cdot \frac{z - x}{y}}{2}\\
\end{array}
\end{array}
if x < 1.05e-93Initial program 68.2%
Simplified0
Applied egg-rr0
Taylor expanded in z around inf 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 1.05e-93 < x < 1.1599999999999999e-6Initial program 70.6%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
if 1.1599999999999999e-6 < x < 3.60000000000000025e41Initial program 87.5%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Applied egg-rr0
if 3.60000000000000025e41 < x Initial program 54.8%
Simplified0
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (- y (* x (/ (- z x) y))) 2.0)))
(if (<= x 7e-94)
(/ (- y (/ z (/ y z))) 2.0)
(if (<= x 2.2e-6)
t_0
(if (<= x 5.6e+41) (/ (- y (* (/ z y) z)) 2.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = (y - (x * ((z - x) / y))) / 2.0;
double tmp;
if (x <= 7e-94) {
tmp = (y - (z / (y / z))) / 2.0;
} else if (x <= 2.2e-6) {
tmp = t_0;
} else if (x <= 5.6e+41) {
tmp = (y - ((z / y) * z)) / 2.0;
} else {
tmp = t_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 = (y - (x * ((z - x) / y))) / 2.0d0
if (x <= 7d-94) then
tmp = (y - (z / (y / z))) / 2.0d0
else if (x <= 2.2d-6) then
tmp = t_0
else if (x <= 5.6d+41) then
tmp = (y - ((z / y) * z)) / 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y - (x * ((z - x) / y))) / 2.0;
double tmp;
if (x <= 7e-94) {
tmp = (y - (z / (y / z))) / 2.0;
} else if (x <= 2.2e-6) {
tmp = t_0;
} else if (x <= 5.6e+41) {
tmp = (y - ((z / y) * z)) / 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (y - (x * ((z - x) / y))) / 2.0 tmp = 0 if x <= 7e-94: tmp = (y - (z / (y / z))) / 2.0 elif x <= 2.2e-6: tmp = t_0 elif x <= 5.6e+41: tmp = (y - ((z / y) * z)) / 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(y - Float64(x * Float64(Float64(z - x) / y))) / 2.0) tmp = 0.0 if (x <= 7e-94) tmp = Float64(Float64(y - Float64(z / Float64(y / z))) / 2.0); elseif (x <= 2.2e-6) tmp = t_0; elseif (x <= 5.6e+41) tmp = Float64(Float64(y - Float64(Float64(z / y) * z)) / 2.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - (x * ((z - x) / y))) / 2.0; tmp = 0.0; if (x <= 7e-94) tmp = (y - (z / (y / z))) / 2.0; elseif (x <= 2.2e-6) tmp = t_0; elseif (x <= 5.6e+41) tmp = (y - ((z / y) * z)) / 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - N[(x * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 7e-94], N[(N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.2e-6], t$95$0, If[LessEqual[x, 5.6e+41], N[(N[(y - N[(N[(z / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y - x \cdot \frac{z - x}{y}}{2}\\
\mathbf{if}\;x \leq 7 \cdot 10^{-94}:\\
\;\;\;\;\frac{y - \frac{z}{\frac{y}{z}}}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{y - \frac{z}{y} \cdot z}{2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < 6.99999999999999996e-94Initial program 68.2%
Simplified0
Applied egg-rr0
Taylor expanded in z around inf 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 6.99999999999999996e-94 < x < 2.2000000000000001e-6 or 5.5999999999999999e41 < x Initial program 58.1%
Simplified0
Taylor expanded in x around inf 0
Simplified0
if 2.2000000000000001e-6 < x < 5.5999999999999999e41Initial program 87.5%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= (* x x) 1e-47) (/ y 2.0) (if (<= (* x x) 5e+100) (/ (/ z (/ y z)) -2.0) (/ (* (/ x y) x) 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-47) {
tmp = y / 2.0;
} else if ((x * x) <= 5e+100) {
tmp = (z / (y / z)) / -2.0;
} else {
tmp = ((x / y) * x) / 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-47) then
tmp = y / 2.0d0
else if ((x * x) <= 5d+100) then
tmp = (z / (y / z)) / (-2.0d0)
else
tmp = ((x / y) * x) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-47) {
tmp = y / 2.0;
} else if ((x * x) <= 5e+100) {
tmp = (z / (y / z)) / -2.0;
} else {
tmp = ((x / y) * x) / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 1e-47: tmp = y / 2.0 elif (x * x) <= 5e+100: tmp = (z / (y / z)) / -2.0 else: tmp = ((x / y) * x) / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 1e-47) tmp = Float64(y / 2.0); elseif (Float64(x * x) <= 5e+100) tmp = Float64(Float64(z / Float64(y / z)) / -2.0); else tmp = Float64(Float64(Float64(x / y) * x) / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 1e-47) tmp = y / 2.0; elseif ((x * x) <= 5e+100) tmp = (z / (y / z)) / -2.0; else tmp = ((x / y) * x) / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-47], N[(y / 2.0), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 5e+100], N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] / -2.0), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-47}:\\
\;\;\;\;\frac{y}{2}\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+100}:\\
\;\;\;\;\frac{\frac{z}{\frac{y}{z}}}{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y} \cdot x}{2}\\
\end{array}
\end{array}
if (*.f64 x x) < 9.9999999999999997e-48Initial program 67.6%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if 9.9999999999999997e-48 < (*.f64 x x) < 4.9999999999999999e100Initial program 76.0%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
Applied egg-rr0
if 4.9999999999999999e100 < (*.f64 x x) Initial program 60.7%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= x 3.9e+50) (/ (- y (* (/ z y) z)) 2.0) (/ (+ y (* (/ x y) x)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (x <= 3.9e+50) {
tmp = (y - ((z / y) * z)) / 2.0;
} else {
tmp = (y + ((x / y) * x)) / 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 <= 3.9d+50) then
tmp = (y - ((z / y) * z)) / 2.0d0
else
tmp = (y + ((x / y) * x)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 3.9e+50) {
tmp = (y - ((z / y) * z)) / 2.0;
} else {
tmp = (y + ((x / y) * x)) / 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 3.9e+50: tmp = (y - ((z / y) * z)) / 2.0 else: tmp = (y + ((x / y) * x)) / 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= 3.9e+50) tmp = Float64(Float64(y - Float64(Float64(z / y) * z)) / 2.0); else tmp = Float64(Float64(y + Float64(Float64(x / y) * x)) / 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 3.9e+50) tmp = (y - ((z / y) * z)) / 2.0; else tmp = (y + ((x / y) * x)) / 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 3.9e+50], N[(N[(y - N[(N[(z / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(y + N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.9 \cdot 10^{+50}:\\
\;\;\;\;\frac{y - \frac{z}{y} \cdot z}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + \frac{x}{y} \cdot x}{2}\\
\end{array}
\end{array}
if x < 3.89999999999999967e50Initial program 69.4%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Applied egg-rr0
if 3.89999999999999967e50 < x Initial program 53.2%
Simplified0
Taylor expanded in z around 0 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= z 3.5e+199) (/ (+ y (* (/ x y) x)) 2.0) (/ (/ z (/ y z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= 3.5e+199) {
tmp = (y + ((x / y) * x)) / 2.0;
} else {
tmp = (z / (y / z)) / -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 (z <= 3.5d+199) then
tmp = (y + ((x / y) * x)) / 2.0d0
else
tmp = (z / (y / z)) / (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 3.5e+199) {
tmp = (y + ((x / y) * x)) / 2.0;
} else {
tmp = (z / (y / z)) / -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 3.5e+199: tmp = (y + ((x / y) * x)) / 2.0 else: tmp = (z / (y / z)) / -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= 3.5e+199) tmp = Float64(Float64(y + Float64(Float64(x / y) * x)) / 2.0); else tmp = Float64(Float64(z / Float64(y / z)) / -2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 3.5e+199) tmp = (y + ((x / y) * x)) / 2.0; else tmp = (z / (y / z)) / -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 3.5e+199], N[(N[(y + N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] / -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.5 \cdot 10^{+199}:\\
\;\;\;\;\frac{y + \frac{x}{y} \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z}{\frac{y}{z}}}{-2}\\
\end{array}
\end{array}
if z < 3.49999999999999981e199Initial program 68.6%
Simplified0
Taylor expanded in z around 0 0
Simplified0
Applied egg-rr0
if 3.49999999999999981e199 < z Initial program 42.9%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= (* z z) 1e+148) (/ y 2.0) (/ z (/ -2.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e+148) {
tmp = y / 2.0;
} else {
tmp = z / (-2.0 / (z / y));
}
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) <= 1d+148) then
tmp = y / 2.0d0
else
tmp = z / ((-2.0d0) / (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e+148) {
tmp = y / 2.0;
} else {
tmp = z / (-2.0 / (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 1e+148: tmp = y / 2.0 else: tmp = z / (-2.0 / (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e+148) tmp = Float64(y / 2.0); else tmp = Float64(z / Float64(-2.0 / Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 1e+148) tmp = y / 2.0; else tmp = z / (-2.0 / (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+148], N[(y / 2.0), $MachinePrecision], N[(z / N[(-2.0 / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+148}:\\
\;\;\;\;\frac{y}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{-2}{\frac{z}{y}}}\\
\end{array}
\end{array}
if (*.f64 z z) < 1e148Initial program 76.3%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if 1e148 < (*.f64 z z) Initial program 47.8%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= (* z z) 1e+148) (/ y 2.0) (* (* (/ z y) z) -0.5)))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e+148) {
tmp = y / 2.0;
} else {
tmp = ((z / y) * z) * -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) <= 1d+148) then
tmp = y / 2.0d0
else
tmp = ((z / y) * z) * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e+148) {
tmp = y / 2.0;
} else {
tmp = ((z / y) * z) * -0.5;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 1e+148: tmp = y / 2.0 else: tmp = ((z / y) * z) * -0.5 return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e+148) tmp = Float64(y / 2.0); else tmp = Float64(Float64(Float64(z / y) * z) * -0.5); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 1e+148) tmp = y / 2.0; else tmp = ((z / y) * z) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+148], N[(y / 2.0), $MachinePrecision], N[(N[(N[(z / y), $MachinePrecision] * z), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+148}:\\
\;\;\;\;\frac{y}{2}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{y} \cdot z\right) \cdot -0.5\\
\end{array}
\end{array}
if (*.f64 z z) < 1e148Initial program 76.3%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if 1e148 < (*.f64 z z) Initial program 47.8%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= (* z z) 7.6e+153) (/ y 2.0) (* (* z z) (/ -0.5 y))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 7.6e+153) {
tmp = y / 2.0;
} else {
tmp = (z * z) * (-0.5 / y);
}
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) <= 7.6d+153) then
tmp = y / 2.0d0
else
tmp = (z * z) * ((-0.5d0) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 7.6e+153) {
tmp = y / 2.0;
} else {
tmp = (z * z) * (-0.5 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 7.6e+153: tmp = y / 2.0 else: tmp = (z * z) * (-0.5 / y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 7.6e+153) tmp = Float64(y / 2.0); else tmp = Float64(Float64(z * z) * Float64(-0.5 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 7.6e+153) tmp = y / 2.0; else tmp = (z * z) * (-0.5 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 7.6e+153], N[(y / 2.0), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 7.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{y}{2}\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \frac{-0.5}{y}\\
\end{array}
\end{array}
if (*.f64 z z) < 7.59999999999999933e153Initial program 76.3%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if 7.59999999999999933e153 < (*.f64 z z) Initial program 47.8%
Simplified0
Taylor expanded in z around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (/ (- y (* (+ x z) (/ (- z x) y))) 2.0))
double code(double x, double y, double z) {
return (y - ((x + z) * ((z - x) / 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 - ((x + z) * ((z - x) / y))) / 2.0d0
end function
public static double code(double x, double y, double z) {
return (y - ((x + z) * ((z - x) / y))) / 2.0;
}
def code(x, y, z): return (y - ((x + z) * ((z - x) / y))) / 2.0
function code(x, y, z) return Float64(Float64(y - Float64(Float64(x + z) * Float64(Float64(z - x) / y))) / 2.0) end
function tmp = code(x, y, z) tmp = (y - ((x + z) * ((z - x) / y))) / 2.0; end
code[x_, y_, z_] := N[(N[(y - N[(N[(x + z), $MachinePrecision] * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - \left(x + z\right) \cdot \frac{z - x}{y}}{2}
\end{array}
Initial program 65.8%
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 65.8%
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 2024110
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))