
(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 13 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 (* (- (* (- z x) (/ (+ z x) y)) y) -0.5))
double code(double x, double y, double z) {
return (((z - x) * ((z + x) / y)) - y) * -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 = (((z - x) * ((z + x) / y)) - y) * (-0.5d0)
end function
public static double code(double x, double y, double z) {
return (((z - x) * ((z + x) / y)) - y) * -0.5;
}
def code(x, y, z): return (((z - x) * ((z + x) / y)) - y) * -0.5
function code(x, y, z) return Float64(Float64(Float64(Float64(z - x) * Float64(Float64(z + x) / y)) - y) * -0.5) end
function tmp = code(x, y, z) tmp = (((z - x) * ((z + x) / y)) - y) * -0.5; end
code[x_, y_, z_] := N[(N[(N[(N[(z - x), $MachinePrecision] * N[(N[(z + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(z - x\right) \cdot \frac{z + x}{y} - y\right) \cdot -0.5
\end{array}
Initial program 70.2%
sub-neg70.2%
+-commutative70.2%
neg-sub070.2%
associate-+l-70.2%
sub0-neg70.2%
neg-mul-170.2%
*-commutative70.2%
times-frac70.2%
associate--r+70.2%
div-sub70.2%
difference-of-squares74.9%
+-commutative74.9%
associate-*l/77.9%
*-commutative77.9%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= (* x x) 500000.0)
(* y 0.5)
(if (<= (* x x) 5e+131)
(/ (* z (* z -0.5)) y)
(if (or (<= (* x x) 1e+180) (not (<= (* x x) 5e+222)))
(* 0.5 (/ (+ z x) (/ y x)))
(* z (/ (* z -0.5) y))))))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 500000.0) {
tmp = y * 0.5;
} else if ((x * x) <= 5e+131) {
tmp = (z * (z * -0.5)) / y;
} else if (((x * x) <= 1e+180) || !((x * x) <= 5e+222)) {
tmp = 0.5 * ((z + x) / (y / x));
} 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 ((x * x) <= 500000.0d0) then
tmp = y * 0.5d0
else if ((x * x) <= 5d+131) then
tmp = (z * (z * (-0.5d0))) / y
else if (((x * x) <= 1d+180) .or. (.not. ((x * x) <= 5d+222))) then
tmp = 0.5d0 * ((z + x) / (y / x))
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 ((x * x) <= 500000.0) {
tmp = y * 0.5;
} else if ((x * x) <= 5e+131) {
tmp = (z * (z * -0.5)) / y;
} else if (((x * x) <= 1e+180) || !((x * x) <= 5e+222)) {
tmp = 0.5 * ((z + x) / (y / x));
} else {
tmp = z * ((z * -0.5) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 500000.0: tmp = y * 0.5 elif (x * x) <= 5e+131: tmp = (z * (z * -0.5)) / y elif ((x * x) <= 1e+180) or not ((x * x) <= 5e+222): tmp = 0.5 * ((z + x) / (y / x)) else: tmp = z * ((z * -0.5) / y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 500000.0) tmp = Float64(y * 0.5); elseif (Float64(x * x) <= 5e+131) tmp = Float64(Float64(z * Float64(z * -0.5)) / y); elseif ((Float64(x * x) <= 1e+180) || !(Float64(x * x) <= 5e+222)) tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y / x))); else tmp = Float64(z * Float64(Float64(z * -0.5) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 500000.0) tmp = y * 0.5; elseif ((x * x) <= 5e+131) tmp = (z * (z * -0.5)) / y; elseif (((x * x) <= 1e+180) || ~(((x * x) <= 5e+222))) tmp = 0.5 * ((z + x) / (y / x)); else tmp = z * ((z * -0.5) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 500000.0], N[(y * 0.5), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 5e+131], N[(N[(z * N[(z * -0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[Or[LessEqual[N[(x * x), $MachinePrecision], 1e+180], N[Not[LessEqual[N[(x * x), $MachinePrecision], 5e+222]], $MachinePrecision]], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(z * -0.5), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 500000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\frac{z \cdot \left(z \cdot -0.5\right)}{y}\\
\mathbf{elif}\;x \cdot x \leq 10^{+180} \lor \neg \left(x \cdot x \leq 5 \cdot 10^{+222}\right):\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{z \cdot -0.5}{y}\\
\end{array}
\end{array}
if (*.f64 x x) < 5e5Initial program 68.9%
Taylor expanded in y around inf 54.9%
*-commutative54.9%
Simplified54.9%
if 5e5 < (*.f64 x x) < 4.99999999999999995e131Initial program 88.0%
Taylor expanded in z around inf 51.5%
unpow251.5%
associate-*r/51.5%
associate-*r*51.5%
Simplified51.5%
if 4.99999999999999995e131 < (*.f64 x x) < 1e180 or 5.00000000000000023e222 < (*.f64 x x) Initial program 68.8%
Taylor expanded in y around 0 65.3%
unpow265.3%
unpow265.3%
difference-of-squares78.0%
+-commutative78.0%
associate-/l*84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in x around inf 76.4%
if 1e180 < (*.f64 x x) < 5.00000000000000023e222Initial program 57.6%
Taylor expanded in z around inf 56.7%
unpow256.7%
associate-*r/56.7%
associate-*r*56.7%
Simplified56.7%
associate-/l*67.2%
associate-/r/67.2%
*-commutative67.2%
Applied egg-rr67.2%
Final simplification63.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (/ (* z -0.5) y))))
(if (<= (* x x) 500000.0)
(* y 0.5)
(if (<= (* x x) 5e+131)
t_0
(if (<= (* x x) 1e+180)
(/ (* x x) (* y 2.0))
(if (<= (* x x) 5e+222) t_0 (* (/ x y) (* x 0.5))))))))
double code(double x, double y, double z) {
double t_0 = z * ((z * -0.5) / y);
double tmp;
if ((x * x) <= 500000.0) {
tmp = y * 0.5;
} else if ((x * x) <= 5e+131) {
tmp = t_0;
} else if ((x * x) <= 1e+180) {
tmp = (x * x) / (y * 2.0);
} else if ((x * x) <= 5e+222) {
tmp = t_0;
} else {
tmp = (x / y) * (x * 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) :: t_0
real(8) :: tmp
t_0 = z * ((z * (-0.5d0)) / y)
if ((x * x) <= 500000.0d0) then
tmp = y * 0.5d0
else if ((x * x) <= 5d+131) then
tmp = t_0
else if ((x * x) <= 1d+180) then
tmp = (x * x) / (y * 2.0d0)
else if ((x * x) <= 5d+222) then
tmp = t_0
else
tmp = (x / y) * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * ((z * -0.5) / y);
double tmp;
if ((x * x) <= 500000.0) {
tmp = y * 0.5;
} else if ((x * x) <= 5e+131) {
tmp = t_0;
} else if ((x * x) <= 1e+180) {
tmp = (x * x) / (y * 2.0);
} else if ((x * x) <= 5e+222) {
tmp = t_0;
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
def code(x, y, z): t_0 = z * ((z * -0.5) / y) tmp = 0 if (x * x) <= 500000.0: tmp = y * 0.5 elif (x * x) <= 5e+131: tmp = t_0 elif (x * x) <= 1e+180: tmp = (x * x) / (y * 2.0) elif (x * x) <= 5e+222: tmp = t_0 else: tmp = (x / y) * (x * 0.5) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(z * -0.5) / y)) tmp = 0.0 if (Float64(x * x) <= 500000.0) tmp = Float64(y * 0.5); elseif (Float64(x * x) <= 5e+131) tmp = t_0; elseif (Float64(x * x) <= 1e+180) tmp = Float64(Float64(x * x) / Float64(y * 2.0)); elseif (Float64(x * x) <= 5e+222) tmp = t_0; else tmp = Float64(Float64(x / y) * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((z * -0.5) / y); tmp = 0.0; if ((x * x) <= 500000.0) tmp = y * 0.5; elseif ((x * x) <= 5e+131) tmp = t_0; elseif ((x * x) <= 1e+180) tmp = (x * x) / (y * 2.0); elseif ((x * x) <= 5e+222) tmp = t_0; else tmp = (x / y) * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(z * -0.5), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 500000.0], N[(y * 0.5), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 5e+131], t$95$0, If[LessEqual[N[(x * x), $MachinePrecision], 1e+180], N[(N[(x * x), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 5e+222], t$95$0, N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{z \cdot -0.5}{y}\\
\mathbf{if}\;x \cdot x \leq 500000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+131}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 10^{+180}:\\
\;\;\;\;\frac{x \cdot x}{y \cdot 2}\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+222}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 5e5Initial program 68.9%
Taylor expanded in y around inf 54.9%
*-commutative54.9%
Simplified54.9%
if 5e5 < (*.f64 x x) < 4.99999999999999995e131 or 1e180 < (*.f64 x x) < 5.00000000000000023e222Initial program 79.7%
Taylor expanded in z around inf 53.0%
unpow253.0%
associate-*r/53.0%
associate-*r*53.0%
Simplified53.0%
associate-/l*55.8%
associate-/r/55.8%
*-commutative55.8%
Applied egg-rr55.8%
if 4.99999999999999995e131 < (*.f64 x x) < 1e180Initial program 72.6%
Taylor expanded in x around inf 51.3%
unpow251.3%
Simplified51.3%
if 5.00000000000000023e222 < (*.f64 x x) Initial program 68.0%
Taylor expanded in y around 0 65.8%
unpow265.8%
unpow265.8%
difference-of-squares81.2%
+-commutative81.2%
associate-/l*86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 70.7%
*-commutative70.7%
unpow270.7%
associate-*l/75.9%
associate-*l*75.9%
Simplified75.9%
Final simplification61.6%
(FPCore (x y z)
:precision binary64
(if (<= (* x x) 500000.0)
(* y 0.5)
(if (<= (* x x) 5e+131)
(/ (* z (* z -0.5)) y)
(if (<= (* x x) 1e+180)
(/ (* x x) (* y 2.0))
(if (<= (* x x) 5e+222)
(* z (/ (* z -0.5) y))
(* (/ x y) (* x 0.5)))))))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 500000.0) {
tmp = y * 0.5;
} else if ((x * x) <= 5e+131) {
tmp = (z * (z * -0.5)) / y;
} else if ((x * x) <= 1e+180) {
tmp = (x * x) / (y * 2.0);
} else if ((x * x) <= 5e+222) {
tmp = z * ((z * -0.5) / y);
} else {
tmp = (x / y) * (x * 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 ((x * x) <= 500000.0d0) then
tmp = y * 0.5d0
else if ((x * x) <= 5d+131) then
tmp = (z * (z * (-0.5d0))) / y
else if ((x * x) <= 1d+180) then
tmp = (x * x) / (y * 2.0d0)
else if ((x * x) <= 5d+222) then
tmp = z * ((z * (-0.5d0)) / y)
else
tmp = (x / y) * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 500000.0) {
tmp = y * 0.5;
} else if ((x * x) <= 5e+131) {
tmp = (z * (z * -0.5)) / y;
} else if ((x * x) <= 1e+180) {
tmp = (x * x) / (y * 2.0);
} else if ((x * x) <= 5e+222) {
tmp = z * ((z * -0.5) / y);
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 500000.0: tmp = y * 0.5 elif (x * x) <= 5e+131: tmp = (z * (z * -0.5)) / y elif (x * x) <= 1e+180: tmp = (x * x) / (y * 2.0) elif (x * x) <= 5e+222: tmp = z * ((z * -0.5) / y) else: tmp = (x / y) * (x * 0.5) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 500000.0) tmp = Float64(y * 0.5); elseif (Float64(x * x) <= 5e+131) tmp = Float64(Float64(z * Float64(z * -0.5)) / y); elseif (Float64(x * x) <= 1e+180) tmp = Float64(Float64(x * x) / Float64(y * 2.0)); elseif (Float64(x * x) <= 5e+222) tmp = Float64(z * Float64(Float64(z * -0.5) / y)); else tmp = Float64(Float64(x / y) * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 500000.0) tmp = y * 0.5; elseif ((x * x) <= 5e+131) tmp = (z * (z * -0.5)) / y; elseif ((x * x) <= 1e+180) tmp = (x * x) / (y * 2.0); elseif ((x * x) <= 5e+222) tmp = z * ((z * -0.5) / y); else tmp = (x / y) * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 500000.0], N[(y * 0.5), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 5e+131], N[(N[(z * N[(z * -0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 1e+180], N[(N[(x * x), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 5e+222], N[(z * N[(N[(z * -0.5), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 500000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\frac{z \cdot \left(z \cdot -0.5\right)}{y}\\
\mathbf{elif}\;x \cdot x \leq 10^{+180}:\\
\;\;\;\;\frac{x \cdot x}{y \cdot 2}\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+222}:\\
\;\;\;\;z \cdot \frac{z \cdot -0.5}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 5e5Initial program 68.9%
Taylor expanded in y around inf 54.9%
*-commutative54.9%
Simplified54.9%
if 5e5 < (*.f64 x x) < 4.99999999999999995e131Initial program 88.0%
Taylor expanded in z around inf 51.5%
unpow251.5%
associate-*r/51.5%
associate-*r*51.5%
Simplified51.5%
if 4.99999999999999995e131 < (*.f64 x x) < 1e180Initial program 72.6%
Taylor expanded in x around inf 51.3%
unpow251.3%
Simplified51.3%
if 1e180 < (*.f64 x x) < 5.00000000000000023e222Initial program 57.6%
Taylor expanded in z around inf 56.7%
unpow256.7%
associate-*r/56.7%
associate-*r*56.7%
Simplified56.7%
associate-/l*67.2%
associate-/r/67.2%
*-commutative67.2%
Applied egg-rr67.2%
if 5.00000000000000023e222 < (*.f64 x x) Initial program 68.0%
Taylor expanded in y around 0 65.8%
unpow265.8%
unpow265.8%
difference-of-squares81.2%
+-commutative81.2%
associate-/l*86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 70.7%
*-commutative70.7%
unpow270.7%
associate-*l/75.9%
associate-*l*75.9%
Simplified75.9%
Final simplification61.6%
(FPCore (x y z)
:precision binary64
(if (or (<= (* x x) 4e+99)
(and (not (<= (* x x) 5e+165)) (<= (* x x) 5e+233)))
(* -0.5 (- (* x (/ z y)) y))
(* 0.5 (/ (+ z x) (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (((x * x) <= 4e+99) || (!((x * x) <= 5e+165) && ((x * x) <= 5e+233))) {
tmp = -0.5 * ((x * (z / y)) - y);
} else {
tmp = 0.5 * ((z + x) / (y / 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 (((x * x) <= 4d+99) .or. (.not. ((x * x) <= 5d+165)) .and. ((x * x) <= 5d+233)) then
tmp = (-0.5d0) * ((x * (z / y)) - y)
else
tmp = 0.5d0 * ((z + x) / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * x) <= 4e+99) || (!((x * x) <= 5e+165) && ((x * x) <= 5e+233))) {
tmp = -0.5 * ((x * (z / y)) - y);
} else {
tmp = 0.5 * ((z + x) / (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * x) <= 4e+99) or (not ((x * x) <= 5e+165) and ((x * x) <= 5e+233)): tmp = -0.5 * ((x * (z / y)) - y) else: tmp = 0.5 * ((z + x) / (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * x) <= 4e+99) || (!(Float64(x * x) <= 5e+165) && (Float64(x * x) <= 5e+233))) tmp = Float64(-0.5 * Float64(Float64(x * Float64(z / y)) - y)); else tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * x) <= 4e+99) || (~(((x * x) <= 5e+165)) && ((x * x) <= 5e+233))) tmp = -0.5 * ((x * (z / y)) - y); else tmp = 0.5 * ((z + x) / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 4e+99], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 5e+165]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 5e+233]]], N[(-0.5 * N[(N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{+99} \lor \neg \left(x \cdot x \leq 5 \cdot 10^{+165}\right) \land x \cdot x \leq 5 \cdot 10^{+233}:\\
\;\;\;\;-0.5 \cdot \left(x \cdot \frac{z}{y} - y\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x}}\\
\end{array}
\end{array}
if (*.f64 x x) < 3.9999999999999999e99 or 4.9999999999999997e165 < (*.f64 x x) < 5.00000000000000009e233Initial program 70.0%
sub-neg70.0%
+-commutative70.0%
neg-sub070.0%
associate-+l-70.0%
sub0-neg70.0%
neg-mul-170.0%
*-commutative70.0%
times-frac70.0%
associate--r+70.0%
div-sub70.0%
difference-of-squares70.0%
+-commutative70.0%
associate-*l/73.0%
*-commutative73.0%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 68.4%
Taylor expanded in z around inf 57.3%
*-commutative57.3%
*-lft-identity57.3%
times-frac59.7%
/-rgt-identity59.7%
Simplified59.7%
if 3.9999999999999999e99 < (*.f64 x x) < 4.9999999999999997e165 or 5.00000000000000009e233 < (*.f64 x x) Initial program 70.6%
Taylor expanded in y around 0 68.1%
unpow268.1%
unpow268.1%
difference-of-squares80.8%
+-commutative80.8%
associate-/l*86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in x around inf 77.3%
Final simplification66.7%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 6e+220) (* -0.5 (- (* (- z x) (/ x y)) y)) (* 0.5 (/ (+ z x) (* y (/ 1.0 (- x z)))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 6e+220) {
tmp = -0.5 * (((z - x) * (x / y)) - y);
} else {
tmp = 0.5 * ((z + x) / (y * (1.0 / (x - 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 ((z * z) <= 6d+220) then
tmp = (-0.5d0) * (((z - x) * (x / y)) - y)
else
tmp = 0.5d0 * ((z + x) / (y * (1.0d0 / (x - z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 6e+220) {
tmp = -0.5 * (((z - x) * (x / y)) - y);
} else {
tmp = 0.5 * ((z + x) / (y * (1.0 / (x - z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 6e+220: tmp = -0.5 * (((z - x) * (x / y)) - y) else: tmp = 0.5 * ((z + x) / (y * (1.0 / (x - z)))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 6e+220) tmp = Float64(-0.5 * Float64(Float64(Float64(z - x) * Float64(x / y)) - y)); else tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y * Float64(1.0 / Float64(x - z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 6e+220) tmp = -0.5 * (((z - x) * (x / y)) - y); else tmp = 0.5 * ((z + x) / (y * (1.0 / (x - z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 6e+220], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y * N[(1.0 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 6 \cdot 10^{+220}:\\
\;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{x}{y} - y\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{z + x}{y \cdot \frac{1}{x - z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 6.00000000000000048e220Initial program 74.8%
sub-neg74.8%
+-commutative74.8%
neg-sub074.8%
associate-+l-74.8%
sub0-neg74.8%
neg-mul-174.8%
*-commutative74.8%
times-frac74.8%
associate--r+74.8%
div-sub74.8%
difference-of-squares74.8%
+-commutative74.8%
associate-*l/76.9%
*-commutative76.9%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 90.5%
if 6.00000000000000048e220 < (*.f64 z z) Initial program 59.7%
Taylor expanded in y around 0 63.9%
unpow263.9%
unpow263.9%
difference-of-squares80.6%
+-commutative80.6%
associate-/l*88.9%
+-commutative88.9%
Simplified88.9%
div-inv88.9%
Applied egg-rr88.9%
Final simplification90.0%
(FPCore (x y z)
:precision binary64
(if (<= y -1.04e+102)
(* -0.5 (- (/ z (/ y z)) y))
(if (<= y 3700.0)
(* 0.5 (/ (+ z x) (/ y (- x z))))
(* -0.5 (- (* x (/ (- x) y)) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.04e+102) {
tmp = -0.5 * ((z / (y / z)) - y);
} else if (y <= 3700.0) {
tmp = 0.5 * ((z + x) / (y / (x - z)));
} else {
tmp = -0.5 * ((x * (-x / y)) - 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 (y <= (-1.04d+102)) then
tmp = (-0.5d0) * ((z / (y / z)) - y)
else if (y <= 3700.0d0) then
tmp = 0.5d0 * ((z + x) / (y / (x - z)))
else
tmp = (-0.5d0) * ((x * (-x / y)) - y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.04e+102) {
tmp = -0.5 * ((z / (y / z)) - y);
} else if (y <= 3700.0) {
tmp = 0.5 * ((z + x) / (y / (x - z)));
} else {
tmp = -0.5 * ((x * (-x / y)) - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.04e+102: tmp = -0.5 * ((z / (y / z)) - y) elif y <= 3700.0: tmp = 0.5 * ((z + x) / (y / (x - z))) else: tmp = -0.5 * ((x * (-x / y)) - y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.04e+102) tmp = Float64(-0.5 * Float64(Float64(z / Float64(y / z)) - y)); elseif (y <= 3700.0) tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y / Float64(x - z)))); else tmp = Float64(-0.5 * Float64(Float64(x * Float64(Float64(-x) / y)) - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.04e+102) tmp = -0.5 * ((z / (y / z)) - y); elseif (y <= 3700.0) tmp = 0.5 * ((z + x) / (y / (x - z))); else tmp = -0.5 * ((x * (-x / y)) - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.04e+102], N[(-0.5 * N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3700.0], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(x * N[((-x) / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.04 \cdot 10^{+102}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{elif}\;y \leq 3700:\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x - z}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(x \cdot \frac{-x}{y} - y\right)\\
\end{array}
\end{array}
if y < -1.04e102Initial program 22.2%
sub-neg22.2%
+-commutative22.2%
neg-sub022.2%
associate-+l-22.2%
sub0-neg22.2%
neg-mul-122.2%
*-commutative22.2%
times-frac22.2%
associate--r+22.2%
div-sub22.2%
difference-of-squares22.2%
+-commutative22.2%
associate-*l/27.2%
*-commutative27.2%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 78.1%
unpow278.1%
associate-/l*92.7%
Simplified92.7%
if -1.04e102 < y < 3700Initial program 87.2%
Taylor expanded in y around 0 77.2%
unpow277.2%
unpow277.2%
difference-of-squares85.4%
+-commutative85.4%
associate-/l*88.1%
+-commutative88.1%
Simplified88.1%
if 3700 < y Initial program 62.0%
sub-neg62.0%
+-commutative62.0%
neg-sub062.0%
associate-+l-62.0%
sub0-neg62.0%
neg-mul-162.0%
*-commutative62.0%
times-frac62.0%
associate--r+62.0%
div-sub62.0%
difference-of-squares62.0%
+-commutative62.0%
associate-*l/64.8%
*-commutative64.8%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
add-cube-cbrt99.7%
pow399.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 90.3%
mul-1-neg90.3%
unpow290.3%
associate-*l/95.3%
distribute-rgt-neg-in95.3%
Simplified95.3%
Final simplification90.8%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 6e+220) (* -0.5 (- (* (- z x) (/ x y)) y)) (* 0.5 (/ (+ z x) (/ y (- x z))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 6e+220) {
tmp = -0.5 * (((z - x) * (x / y)) - y);
} else {
tmp = 0.5 * ((z + x) / (y / (x - 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 ((z * z) <= 6d+220) then
tmp = (-0.5d0) * (((z - x) * (x / y)) - y)
else
tmp = 0.5d0 * ((z + x) / (y / (x - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 6e+220) {
tmp = -0.5 * (((z - x) * (x / y)) - y);
} else {
tmp = 0.5 * ((z + x) / (y / (x - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 6e+220: tmp = -0.5 * (((z - x) * (x / y)) - y) else: tmp = 0.5 * ((z + x) / (y / (x - z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 6e+220) tmp = Float64(-0.5 * Float64(Float64(Float64(z - x) * Float64(x / y)) - y)); else tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y / Float64(x - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 6e+220) tmp = -0.5 * (((z - x) * (x / y)) - y); else tmp = 0.5 * ((z + x) / (y / (x - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 6e+220], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 6 \cdot 10^{+220}:\\
\;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{x}{y} - y\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x - z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 6.00000000000000048e220Initial program 74.8%
sub-neg74.8%
+-commutative74.8%
neg-sub074.8%
associate-+l-74.8%
sub0-neg74.8%
neg-mul-174.8%
*-commutative74.8%
times-frac74.8%
associate--r+74.8%
div-sub74.8%
difference-of-squares74.8%
+-commutative74.8%
associate-*l/76.9%
*-commutative76.9%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 90.5%
if 6.00000000000000048e220 < (*.f64 z z) Initial program 59.7%
Taylor expanded in y around 0 63.9%
unpow263.9%
unpow263.9%
difference-of-squares80.6%
+-commutative80.6%
associate-/l*88.9%
+-commutative88.9%
Simplified88.9%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.6e+45) (not (<= z 7.2e+93))) (* -0.5 (- (/ z (/ y z)) y)) (* -0.5 (- (* x (/ (- x) y)) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.6e+45) || !(z <= 7.2e+93)) {
tmp = -0.5 * ((z / (y / z)) - y);
} else {
tmp = -0.5 * ((x * (-x / y)) - 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 <= (-6.6d+45)) .or. (.not. (z <= 7.2d+93))) then
tmp = (-0.5d0) * ((z / (y / z)) - y)
else
tmp = (-0.5d0) * ((x * (-x / y)) - y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.6e+45) || !(z <= 7.2e+93)) {
tmp = -0.5 * ((z / (y / z)) - y);
} else {
tmp = -0.5 * ((x * (-x / y)) - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.6e+45) or not (z <= 7.2e+93): tmp = -0.5 * ((z / (y / z)) - y) else: tmp = -0.5 * ((x * (-x / y)) - y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.6e+45) || !(z <= 7.2e+93)) tmp = Float64(-0.5 * Float64(Float64(z / Float64(y / z)) - y)); else tmp = Float64(-0.5 * Float64(Float64(x * Float64(Float64(-x) / y)) - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.6e+45) || ~((z <= 7.2e+93))) tmp = -0.5 * ((z / (y / z)) - y); else tmp = -0.5 * ((x * (-x / y)) - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.6e+45], N[Not[LessEqual[z, 7.2e+93]], $MachinePrecision]], N[(-0.5 * N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(x * N[((-x) / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+45} \lor \neg \left(z \leq 7.2 \cdot 10^{+93}\right):\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(x \cdot \frac{-x}{y} - y\right)\\
\end{array}
\end{array}
if z < -6.6000000000000001e45 or 7.1999999999999998e93 < z Initial program 59.8%
sub-neg59.8%
+-commutative59.8%
neg-sub059.8%
associate-+l-59.8%
sub0-neg59.8%
neg-mul-159.8%
*-commutative59.8%
times-frac59.8%
associate--r+59.8%
div-sub59.8%
difference-of-squares72.8%
+-commutative72.8%
associate-*l/77.1%
*-commutative77.1%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 75.5%
unpow275.5%
associate-/l*85.9%
Simplified85.9%
if -6.6000000000000001e45 < z < 7.1999999999999998e93Initial program 76.1%
sub-neg76.1%
+-commutative76.1%
neg-sub076.1%
associate-+l-76.1%
sub0-neg76.1%
neg-mul-176.1%
*-commutative76.1%
times-frac76.1%
associate--r+76.1%
div-sub76.1%
difference-of-squares76.1%
+-commutative76.1%
associate-*l/78.4%
*-commutative78.4%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
add-cube-cbrt99.5%
pow399.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in z around 0 86.3%
mul-1-neg86.3%
unpow286.3%
associate-*l/92.0%
distribute-rgt-neg-in92.0%
Simplified92.0%
Final simplification89.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ x y) (* x 0.5))))
(if (<= x -1.45e-28)
t_0
(if (<= x 9.2e-36)
(* y 0.5)
(if (<= x 8.4e+65) (* z (/ (* z -0.5) y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = (x / y) * (x * 0.5);
double tmp;
if (x <= -1.45e-28) {
tmp = t_0;
} else if (x <= 9.2e-36) {
tmp = y * 0.5;
} else if (x <= 8.4e+65) {
tmp = z * ((z * -0.5) / y);
} 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 = (x / y) * (x * 0.5d0)
if (x <= (-1.45d-28)) then
tmp = t_0
else if (x <= 9.2d-36) then
tmp = y * 0.5d0
else if (x <= 8.4d+65) then
tmp = z * ((z * (-0.5d0)) / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x / y) * (x * 0.5);
double tmp;
if (x <= -1.45e-28) {
tmp = t_0;
} else if (x <= 9.2e-36) {
tmp = y * 0.5;
} else if (x <= 8.4e+65) {
tmp = z * ((z * -0.5) / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x / y) * (x * 0.5) tmp = 0 if x <= -1.45e-28: tmp = t_0 elif x <= 9.2e-36: tmp = y * 0.5 elif x <= 8.4e+65: tmp = z * ((z * -0.5) / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x / y) * Float64(x * 0.5)) tmp = 0.0 if (x <= -1.45e-28) tmp = t_0; elseif (x <= 9.2e-36) tmp = Float64(y * 0.5); elseif (x <= 8.4e+65) tmp = Float64(z * Float64(Float64(z * -0.5) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x / y) * (x * 0.5); tmp = 0.0; if (x <= -1.45e-28) tmp = t_0; elseif (x <= 9.2e-36) tmp = y * 0.5; elseif (x <= 8.4e+65) tmp = z * ((z * -0.5) / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.45e-28], t$95$0, If[LessEqual[x, 9.2e-36], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 8.4e+65], N[(z * N[(N[(z * -0.5), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{-28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-36}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+65}:\\
\;\;\;\;z \cdot \frac{z \cdot -0.5}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1.45000000000000006e-28 or 8.39999999999999965e65 < x Initial program 71.4%
Taylor expanded in y around 0 66.8%
unpow266.8%
unpow266.8%
difference-of-squares77.0%
+-commutative77.0%
associate-/l*82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in x around inf 61.4%
*-commutative61.4%
unpow261.4%
associate-*l/64.7%
associate-*l*64.7%
Simplified64.7%
if -1.45000000000000006e-28 < x < 9.19999999999999986e-36Initial program 67.9%
Taylor expanded in y around inf 56.7%
*-commutative56.7%
Simplified56.7%
if 9.19999999999999986e-36 < x < 8.39999999999999965e65Initial program 75.6%
Taylor expanded in z around inf 56.9%
unpow256.9%
associate-*r/56.9%
associate-*r*56.9%
Simplified56.9%
associate-/l*61.6%
associate-/r/61.6%
*-commutative61.6%
Applied egg-rr61.6%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= (* x x) 5e+233) (* -0.5 (- (/ z (/ y z)) y)) (* 0.5 (/ (+ z x) (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 5e+233) {
tmp = -0.5 * ((z / (y / z)) - y);
} else {
tmp = 0.5 * ((z + x) / (y / 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 ((x * x) <= 5d+233) then
tmp = (-0.5d0) * ((z / (y / z)) - y)
else
tmp = 0.5d0 * ((z + x) / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 5e+233) {
tmp = -0.5 * ((z / (y / z)) - y);
} else {
tmp = 0.5 * ((z + x) / (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 5e+233: tmp = -0.5 * ((z / (y / z)) - y) else: tmp = 0.5 * ((z + x) / (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 5e+233) tmp = Float64(-0.5 * Float64(Float64(z / Float64(y / z)) - y)); else tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 5e+233) tmp = -0.5 * ((z / (y / z)) - y); else tmp = 0.5 * ((z + x) / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+233], N[(-0.5 * N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+233}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x}}\\
\end{array}
\end{array}
if (*.f64 x x) < 5.00000000000000009e233Initial program 71.0%
sub-neg71.0%
+-commutative71.0%
neg-sub071.0%
associate-+l-71.0%
sub0-neg71.0%
neg-mul-171.0%
*-commutative71.0%
times-frac71.0%
associate--r+71.0%
div-sub71.0%
difference-of-squares71.0%
+-commutative71.0%
associate-*l/73.7%
*-commutative73.7%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 79.7%
unpow279.7%
associate-/l*84.0%
Simplified84.0%
if 5.00000000000000009e233 < (*.f64 x x) Initial program 68.7%
Taylor expanded in y around 0 66.5%
unpow266.5%
unpow266.5%
difference-of-squares82.2%
+-commutative82.2%
associate-/l*87.5%
+-commutative87.5%
Simplified87.5%
Taylor expanded in x around inf 82.7%
Final simplification83.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -6.5e-30) (not (<= x 1.08e+71))) (* (/ x y) (* x 0.5)) (* y 0.5)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.5e-30) || !(x <= 1.08e+71)) {
tmp = (x / y) * (x * 0.5);
} else {
tmp = 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 ((x <= (-6.5d-30)) .or. (.not. (x <= 1.08d+71))) then
tmp = (x / y) * (x * 0.5d0)
else
tmp = y * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -6.5e-30) || !(x <= 1.08e+71)) {
tmp = (x / y) * (x * 0.5);
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.5e-30) or not (x <= 1.08e+71): tmp = (x / y) * (x * 0.5) else: tmp = y * 0.5 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.5e-30) || !(x <= 1.08e+71)) tmp = Float64(Float64(x / y) * Float64(x * 0.5)); else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -6.5e-30) || ~((x <= 1.08e+71))) tmp = (x / y) * (x * 0.5); else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.5e-30], N[Not[LessEqual[x, 1.08e+71]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-30} \lor \neg \left(x \leq 1.08 \cdot 10^{+71}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if x < -6.5000000000000005e-30 or 1.08e71 < x Initial program 71.4%
Taylor expanded in y around 0 66.8%
unpow266.8%
unpow266.8%
difference-of-squares77.0%
+-commutative77.0%
associate-/l*82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in x around inf 61.4%
*-commutative61.4%
unpow261.4%
associate-*l/64.7%
associate-*l*64.7%
Simplified64.7%
if -6.5000000000000005e-30 < x < 1.08e71Initial program 69.1%
Taylor expanded in y around inf 52.4%
*-commutative52.4%
Simplified52.4%
Final simplification58.6%
(FPCore (x y z) :precision binary64 (* y 0.5))
double code(double x, double y, double z) {
return y * 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 = y * 0.5d0
end function
public static double code(double x, double y, double z) {
return y * 0.5;
}
def code(x, y, z): return y * 0.5
function code(x, y, z) return Float64(y * 0.5) end
function tmp = code(x, y, z) tmp = y * 0.5; end
code[x_, y_, z_] := N[(y * 0.5), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5
\end{array}
Initial program 70.2%
Taylor expanded in y around inf 36.1%
*-commutative36.1%
Simplified36.1%
Final simplification36.1%
(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 2023185
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:herbie-target
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))