
(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 11 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}
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (* (- (* (+ x z) (/ (- z x) y)) y) -0.5))
z = abs(z);
double code(double x, double y, double z) {
return (((x + z) * ((z - x) / y)) - y) * -0.5;
}
NOTE: z should be positive before calling this function
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) * ((z - x) / y)) - y) * (-0.5d0)
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
return (((x + z) * ((z - x) / y)) - y) * -0.5;
}
z = abs(z) def code(x, y, z): return (((x + z) * ((z - x) / y)) - y) * -0.5
z = abs(z) function code(x, y, z) return Float64(Float64(Float64(Float64(x + z) * Float64(Float64(z - x) / y)) - y) * -0.5) end
z = abs(z) function tmp = code(x, y, z) tmp = (((x + z) * ((z - x) / y)) - y) * -0.5; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := N[(N[(N[(N[(x + z), $MachinePrecision] * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
z = |z|\\
\\
\left(\left(x + z\right) \cdot \frac{z - x}{y} - y\right) \cdot -0.5
\end{array}
Initial program 70.3%
sub-neg70.3%
+-commutative70.3%
neg-sub070.3%
associate-+l-70.3%
sub0-neg70.3%
neg-mul-170.3%
*-commutative70.3%
times-frac70.3%
associate--r+70.3%
div-sub70.3%
difference-of-squares74.6%
+-commutative74.6%
associate-*r/77.9%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(if (<= (* x x) 1e-68)
(* -0.5 (- (* z (/ z y)) y))
(if (or (<= (* x x) 2e+101) (not (<= (* x x) 2e+161)))
(* -0.5 (- (/ (- x) (/ y x)) y))
(* -0.5 (- (/ z (/ y z)) y)))))z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * ((z * (z / y)) - y);
} else if (((x * x) <= 2e+101) || !((x * x) <= 2e+161)) {
tmp = -0.5 * ((-x / (y / x)) - y);
} else {
tmp = -0.5 * ((z / (y / z)) - y);
}
return tmp;
}
NOTE: z should be positive before calling this function
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-68) then
tmp = (-0.5d0) * ((z * (z / y)) - y)
else if (((x * x) <= 2d+101) .or. (.not. ((x * x) <= 2d+161))) then
tmp = (-0.5d0) * ((-x / (y / x)) - y)
else
tmp = (-0.5d0) * ((z / (y / z)) - y)
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * ((z * (z / y)) - y);
} else if (((x * x) <= 2e+101) || !((x * x) <= 2e+161)) {
tmp = -0.5 * ((-x / (y / x)) - y);
} else {
tmp = -0.5 * ((z / (y / z)) - y);
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (x * x) <= 1e-68: tmp = -0.5 * ((z * (z / y)) - y) elif ((x * x) <= 2e+101) or not ((x * x) <= 2e+161): tmp = -0.5 * ((-x / (y / x)) - y) else: tmp = -0.5 * ((z / (y / z)) - y) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 1e-68) tmp = Float64(-0.5 * Float64(Float64(z * Float64(z / y)) - y)); elseif ((Float64(x * x) <= 2e+101) || !(Float64(x * x) <= 2e+161)) tmp = Float64(-0.5 * Float64(Float64(Float64(-x) / Float64(y / x)) - y)); else tmp = Float64(-0.5 * Float64(Float64(z / Float64(y / z)) - y)); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 1e-68) tmp = -0.5 * ((z * (z / y)) - y); elseif (((x * x) <= 2e+101) || ~(((x * x) <= 2e+161))) tmp = -0.5 * ((-x / (y / x)) - y); else tmp = -0.5 * ((z / (y / z)) - y); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-68], N[(-0.5 * N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * x), $MachinePrecision], 2e+101], N[Not[LessEqual[N[(x * x), $MachinePrecision], 2e+161]], $MachinePrecision]], N[(-0.5 * N[(N[((-x) / N[(y / x), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-68}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+101} \lor \neg \left(x \cdot x \leq 2 \cdot 10^{+161}\right):\\
\;\;\;\;-0.5 \cdot \left(\frac{-x}{\frac{y}{x}} - y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.00000000000000007e-68Initial program 70.6%
sub-neg70.6%
+-commutative70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
*-commutative70.6%
times-frac70.6%
associate--r+70.6%
div-sub70.6%
difference-of-squares70.7%
+-commutative70.7%
associate-*l/75.6%
*-commutative75.6%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 82.7%
unpow282.7%
associate-*r/89.4%
Simplified89.4%
if 1.00000000000000007e-68 < (*.f64 x x) < 2e101 or 2.0000000000000001e161 < (*.f64 x x) 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-squares80.1%
+-commutative80.1%
associate-*l/81.8%
*-commutative81.8%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 75.6%
mul-1-neg75.6%
unpow275.6%
associate-/l*83.9%
distribute-neg-frac83.9%
Simplified83.9%
if 2e101 < (*.f64 x x) < 2.0000000000000001e161Initial program 67.9%
sub-neg67.9%
+-commutative67.9%
neg-sub067.9%
associate-+l-67.9%
sub0-neg67.9%
neg-mul-167.9%
*-commutative67.9%
times-frac67.9%
associate--r+67.9%
div-sub67.9%
difference-of-squares67.9%
+-commutative67.9%
associate-*l/67.9%
*-commutative67.9%
associate-/l*99.6%
*-inverses99.6%
/-rgt-identity99.6%
metadata-eval99.6%
Simplified99.6%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
*-un-lft-identity99.7%
add-sqr-sqrt50.0%
times-frac49.8%
+-commutative49.8%
+-commutative49.8%
Applied egg-rr49.8%
associate-*l/49.8%
*-lft-identity49.8%
+-commutative49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in z around inf 68.3%
unpow268.3%
associate-/l*83.7%
Simplified83.7%
Final simplification86.7%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(if (<= (* x x) 1e-68)
(* -0.5 (- (* z (/ z y)) y))
(if (<= (* x x) 2e+101)
(* -0.5 (- (/ (- (* x x)) y) y))
(if (<= (* x x) 2e+161)
(* -0.5 (- (/ z (/ y z)) y))
(* -0.5 (- (/ (- x) (/ y x)) y))))))z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * ((z * (z / y)) - y);
} else if ((x * x) <= 2e+101) {
tmp = -0.5 * ((-(x * x) / y) - y);
} else if ((x * x) <= 2e+161) {
tmp = -0.5 * ((z / (y / z)) - y);
} else {
tmp = -0.5 * ((-x / (y / x)) - y);
}
return tmp;
}
NOTE: z should be positive before calling this function
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-68) then
tmp = (-0.5d0) * ((z * (z / y)) - y)
else if ((x * x) <= 2d+101) then
tmp = (-0.5d0) * ((-(x * x) / y) - y)
else if ((x * x) <= 2d+161) then
tmp = (-0.5d0) * ((z / (y / z)) - y)
else
tmp = (-0.5d0) * ((-x / (y / x)) - y)
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * ((z * (z / y)) - y);
} else if ((x * x) <= 2e+101) {
tmp = -0.5 * ((-(x * x) / y) - y);
} else if ((x * x) <= 2e+161) {
tmp = -0.5 * ((z / (y / z)) - y);
} else {
tmp = -0.5 * ((-x / (y / x)) - y);
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (x * x) <= 1e-68: tmp = -0.5 * ((z * (z / y)) - y) elif (x * x) <= 2e+101: tmp = -0.5 * ((-(x * x) / y) - y) elif (x * x) <= 2e+161: tmp = -0.5 * ((z / (y / z)) - y) else: tmp = -0.5 * ((-x / (y / x)) - y) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 1e-68) tmp = Float64(-0.5 * Float64(Float64(z * Float64(z / y)) - y)); elseif (Float64(x * x) <= 2e+101) tmp = Float64(-0.5 * Float64(Float64(Float64(-Float64(x * x)) / y) - y)); elseif (Float64(x * x) <= 2e+161) tmp = Float64(-0.5 * Float64(Float64(z / Float64(y / z)) - y)); else tmp = Float64(-0.5 * Float64(Float64(Float64(-x) / Float64(y / x)) - y)); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 1e-68) tmp = -0.5 * ((z * (z / y)) - y); elseif ((x * x) <= 2e+101) tmp = -0.5 * ((-(x * x) / y) - y); elseif ((x * x) <= 2e+161) tmp = -0.5 * ((z / (y / z)) - y); else tmp = -0.5 * ((-x / (y / x)) - y); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-68], N[(-0.5 * N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+101], N[(-0.5 * N[(N[((-N[(x * x), $MachinePrecision]) / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+161], N[(-0.5 * N[(N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[((-x) / N[(y / x), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-68}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+101}:\\
\;\;\;\;-0.5 \cdot \left(\frac{-x \cdot x}{y} - y\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+161}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(\frac{-x}{\frac{y}{x}} - y\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.00000000000000007e-68Initial program 70.6%
sub-neg70.6%
+-commutative70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
*-commutative70.6%
times-frac70.6%
associate--r+70.6%
div-sub70.6%
difference-of-squares70.7%
+-commutative70.7%
associate-*l/75.6%
*-commutative75.6%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 82.7%
unpow282.7%
associate-*r/89.4%
Simplified89.4%
if 1.00000000000000007e-68 < (*.f64 x x) < 2e101Initial program 86.3%
sub-neg86.3%
+-commutative86.3%
neg-sub086.3%
associate-+l-86.3%
sub0-neg86.3%
neg-mul-186.3%
*-commutative86.3%
times-frac86.3%
associate--r+86.3%
div-sub86.3%
difference-of-squares86.3%
+-commutative86.3%
associate-*r/86.3%
associate-/l*99.8%
*-inverses99.8%
/-rgt-identity99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf 84.8%
unpow284.8%
associate-*r/84.8%
neg-mul-184.8%
distribute-rgt-neg-in84.8%
Simplified84.8%
if 2e101 < (*.f64 x x) < 2.0000000000000001e161Initial program 67.9%
sub-neg67.9%
+-commutative67.9%
neg-sub067.9%
associate-+l-67.9%
sub0-neg67.9%
neg-mul-167.9%
*-commutative67.9%
times-frac67.9%
associate--r+67.9%
div-sub67.9%
difference-of-squares67.9%
+-commutative67.9%
associate-*l/67.9%
*-commutative67.9%
associate-/l*99.6%
*-inverses99.6%
/-rgt-identity99.6%
metadata-eval99.6%
Simplified99.6%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
*-un-lft-identity99.7%
add-sqr-sqrt50.0%
times-frac49.8%
+-commutative49.8%
+-commutative49.8%
Applied egg-rr49.8%
associate-*l/49.8%
*-lft-identity49.8%
+-commutative49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in z around inf 68.3%
unpow268.3%
associate-/l*83.7%
Simplified83.7%
if 2.0000000000000001e161 < (*.f64 x x) Initial program 63.4%
sub-neg63.4%
+-commutative63.4%
neg-sub063.4%
associate-+l-63.4%
sub0-neg63.4%
neg-mul-163.4%
*-commutative63.4%
times-frac63.4%
associate--r+63.4%
div-sub63.4%
difference-of-squares77.5%
+-commutative77.5%
associate-*l/79.9%
*-commutative79.9%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 71.8%
mul-1-neg71.8%
unpow271.8%
associate-/l*83.5%
distribute-neg-frac83.5%
Simplified83.5%
Final simplification86.7%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -0.5 (* z (/ z y)))) (t_1 (* x (* x (/ 0.5 y)))))
(if (<= y -2.15e+49)
(* y 0.5)
(if (<= y -1.45e-12)
t_1
(if (<= y -9.8e-21)
(* y 0.5)
(if (<= y -4.1e-81)
t_0
(if (<= y -3.3e-258)
t_1
(if (<= y 1.1e-43) t_0 (if (<= y 1.05e+121) t_1 (* y 0.5))))))))))z = abs(z);
double code(double x, double y, double z) {
double t_0 = -0.5 * (z * (z / y));
double t_1 = x * (x * (0.5 / y));
double tmp;
if (y <= -2.15e+49) {
tmp = y * 0.5;
} else if (y <= -1.45e-12) {
tmp = t_1;
} else if (y <= -9.8e-21) {
tmp = y * 0.5;
} else if (y <= -4.1e-81) {
tmp = t_0;
} else if (y <= -3.3e-258) {
tmp = t_1;
} else if (y <= 1.1e-43) {
tmp = t_0;
} else if (y <= 1.05e+121) {
tmp = t_1;
} else {
tmp = y * 0.5;
}
return tmp;
}
NOTE: z should be positive before calling this function
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) :: t_1
real(8) :: tmp
t_0 = (-0.5d0) * (z * (z / y))
t_1 = x * (x * (0.5d0 / y))
if (y <= (-2.15d+49)) then
tmp = y * 0.5d0
else if (y <= (-1.45d-12)) then
tmp = t_1
else if (y <= (-9.8d-21)) then
tmp = y * 0.5d0
else if (y <= (-4.1d-81)) then
tmp = t_0
else if (y <= (-3.3d-258)) then
tmp = t_1
else if (y <= 1.1d-43) then
tmp = t_0
else if (y <= 1.05d+121) then
tmp = t_1
else
tmp = y * 0.5d0
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double t_0 = -0.5 * (z * (z / y));
double t_1 = x * (x * (0.5 / y));
double tmp;
if (y <= -2.15e+49) {
tmp = y * 0.5;
} else if (y <= -1.45e-12) {
tmp = t_1;
} else if (y <= -9.8e-21) {
tmp = y * 0.5;
} else if (y <= -4.1e-81) {
tmp = t_0;
} else if (y <= -3.3e-258) {
tmp = t_1;
} else if (y <= 1.1e-43) {
tmp = t_0;
} else if (y <= 1.05e+121) {
tmp = t_1;
} else {
tmp = y * 0.5;
}
return tmp;
}
z = abs(z) def code(x, y, z): t_0 = -0.5 * (z * (z / y)) t_1 = x * (x * (0.5 / y)) tmp = 0 if y <= -2.15e+49: tmp = y * 0.5 elif y <= -1.45e-12: tmp = t_1 elif y <= -9.8e-21: tmp = y * 0.5 elif y <= -4.1e-81: tmp = t_0 elif y <= -3.3e-258: tmp = t_1 elif y <= 1.1e-43: tmp = t_0 elif y <= 1.05e+121: tmp = t_1 else: tmp = y * 0.5 return tmp
z = abs(z) function code(x, y, z) t_0 = Float64(-0.5 * Float64(z * Float64(z / y))) t_1 = Float64(x * Float64(x * Float64(0.5 / y))) tmp = 0.0 if (y <= -2.15e+49) tmp = Float64(y * 0.5); elseif (y <= -1.45e-12) tmp = t_1; elseif (y <= -9.8e-21) tmp = Float64(y * 0.5); elseif (y <= -4.1e-81) tmp = t_0; elseif (y <= -3.3e-258) tmp = t_1; elseif (y <= 1.1e-43) tmp = t_0; elseif (y <= 1.05e+121) tmp = t_1; else tmp = Float64(y * 0.5); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) t_0 = -0.5 * (z * (z / y)); t_1 = x * (x * (0.5 / y)); tmp = 0.0; if (y <= -2.15e+49) tmp = y * 0.5; elseif (y <= -1.45e-12) tmp = t_1; elseif (y <= -9.8e-21) tmp = y * 0.5; elseif (y <= -4.1e-81) tmp = t_0; elseif (y <= -3.3e-258) tmp = t_1; elseif (y <= 1.1e-43) tmp = t_0; elseif (y <= 1.05e+121) tmp = t_1; else tmp = y * 0.5; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.15e+49], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -1.45e-12], t$95$1, If[LessEqual[y, -9.8e-21], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -4.1e-81], t$95$0, If[LessEqual[y, -3.3e-258], t$95$1, If[LessEqual[y, 1.1e-43], t$95$0, If[LessEqual[y, 1.05e+121], t$95$1, N[(y * 0.5), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\
t_1 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;y \leq -2.15 \cdot 10^{+49}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -9.8 \cdot 10^{-21}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -4.1 \cdot 10^{-81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-258}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-43}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+121}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < -2.15e49 or -1.4500000000000001e-12 < y < -9.8000000000000003e-21 or 1.0500000000000001e121 < y Initial program 41.8%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
Simplified74.0%
if -2.15e49 < y < -1.4500000000000001e-12 or -4.09999999999999984e-81 < y < -3.3e-258 or 1.09999999999999999e-43 < y < 1.0500000000000001e121Initial program 91.9%
Taylor expanded in x around inf 57.4%
unpow257.4%
Simplified57.4%
Taylor expanded in x around 0 57.4%
unpow257.4%
associate-*r/57.4%
associate-*l/57.4%
*-commutative57.4%
associate-*r*59.5%
Simplified59.5%
if -9.8000000000000003e-21 < y < -4.09999999999999984e-81 or -3.3e-258 < y < 1.09999999999999999e-43Initial program 84.0%
Taylor expanded in y around 0 81.8%
unpow281.8%
unpow281.8%
Simplified81.8%
Taylor expanded in x around 0 60.9%
unpow260.9%
associate-*l/63.4%
Simplified63.4%
Final simplification66.3%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -0.5 (* z (/ z y)))) (t_1 (* x (* x (/ 0.5 y)))))
(if (<= y -4.5e+48)
(* y 0.5)
(if (<= y -1.8e-11)
t_1
(if (<= y -1.45e-21)
(* y 0.5)
(if (<= y -3.7e-81)
t_0
(if (<= y -9e-258)
(* x (/ x (* y 2.0)))
(if (<= y 1.3e-42) t_0 (if (<= y 1.05e+121) t_1 (* y 0.5))))))))))z = abs(z);
double code(double x, double y, double z) {
double t_0 = -0.5 * (z * (z / y));
double t_1 = x * (x * (0.5 / y));
double tmp;
if (y <= -4.5e+48) {
tmp = y * 0.5;
} else if (y <= -1.8e-11) {
tmp = t_1;
} else if (y <= -1.45e-21) {
tmp = y * 0.5;
} else if (y <= -3.7e-81) {
tmp = t_0;
} else if (y <= -9e-258) {
tmp = x * (x / (y * 2.0));
} else if (y <= 1.3e-42) {
tmp = t_0;
} else if (y <= 1.05e+121) {
tmp = t_1;
} else {
tmp = y * 0.5;
}
return tmp;
}
NOTE: z should be positive before calling this function
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) :: t_1
real(8) :: tmp
t_0 = (-0.5d0) * (z * (z / y))
t_1 = x * (x * (0.5d0 / y))
if (y <= (-4.5d+48)) then
tmp = y * 0.5d0
else if (y <= (-1.8d-11)) then
tmp = t_1
else if (y <= (-1.45d-21)) then
tmp = y * 0.5d0
else if (y <= (-3.7d-81)) then
tmp = t_0
else if (y <= (-9d-258)) then
tmp = x * (x / (y * 2.0d0))
else if (y <= 1.3d-42) then
tmp = t_0
else if (y <= 1.05d+121) then
tmp = t_1
else
tmp = y * 0.5d0
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double t_0 = -0.5 * (z * (z / y));
double t_1 = x * (x * (0.5 / y));
double tmp;
if (y <= -4.5e+48) {
tmp = y * 0.5;
} else if (y <= -1.8e-11) {
tmp = t_1;
} else if (y <= -1.45e-21) {
tmp = y * 0.5;
} else if (y <= -3.7e-81) {
tmp = t_0;
} else if (y <= -9e-258) {
tmp = x * (x / (y * 2.0));
} else if (y <= 1.3e-42) {
tmp = t_0;
} else if (y <= 1.05e+121) {
tmp = t_1;
} else {
tmp = y * 0.5;
}
return tmp;
}
z = abs(z) def code(x, y, z): t_0 = -0.5 * (z * (z / y)) t_1 = x * (x * (0.5 / y)) tmp = 0 if y <= -4.5e+48: tmp = y * 0.5 elif y <= -1.8e-11: tmp = t_1 elif y <= -1.45e-21: tmp = y * 0.5 elif y <= -3.7e-81: tmp = t_0 elif y <= -9e-258: tmp = x * (x / (y * 2.0)) elif y <= 1.3e-42: tmp = t_0 elif y <= 1.05e+121: tmp = t_1 else: tmp = y * 0.5 return tmp
z = abs(z) function code(x, y, z) t_0 = Float64(-0.5 * Float64(z * Float64(z / y))) t_1 = Float64(x * Float64(x * Float64(0.5 / y))) tmp = 0.0 if (y <= -4.5e+48) tmp = Float64(y * 0.5); elseif (y <= -1.8e-11) tmp = t_1; elseif (y <= -1.45e-21) tmp = Float64(y * 0.5); elseif (y <= -3.7e-81) tmp = t_0; elseif (y <= -9e-258) tmp = Float64(x * Float64(x / Float64(y * 2.0))); elseif (y <= 1.3e-42) tmp = t_0; elseif (y <= 1.05e+121) tmp = t_1; else tmp = Float64(y * 0.5); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) t_0 = -0.5 * (z * (z / y)); t_1 = x * (x * (0.5 / y)); tmp = 0.0; if (y <= -4.5e+48) tmp = y * 0.5; elseif (y <= -1.8e-11) tmp = t_1; elseif (y <= -1.45e-21) tmp = y * 0.5; elseif (y <= -3.7e-81) tmp = t_0; elseif (y <= -9e-258) tmp = x * (x / (y * 2.0)); elseif (y <= 1.3e-42) tmp = t_0; elseif (y <= 1.05e+121) tmp = t_1; else tmp = y * 0.5; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.5e+48], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -1.8e-11], t$95$1, If[LessEqual[y, -1.45e-21], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -3.7e-81], t$95$0, If[LessEqual[y, -9e-258], N[(x * N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-42], t$95$0, If[LessEqual[y, 1.05e+121], t$95$1, N[(y * 0.5), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\
t_1 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{+48}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-21}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -3.7 \cdot 10^{-81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -9 \cdot 10^{-258}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+121}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < -4.49999999999999995e48 or -1.79999999999999992e-11 < y < -1.45e-21 or 1.0500000000000001e121 < y Initial program 41.8%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
Simplified74.0%
if -4.49999999999999995e48 < y < -1.79999999999999992e-11 or 1.3e-42 < y < 1.0500000000000001e121Initial program 88.4%
Taylor expanded in x around inf 54.5%
unpow254.5%
Simplified54.5%
Taylor expanded in x around 0 54.5%
unpow254.5%
associate-*r/54.5%
associate-*l/54.4%
*-commutative54.4%
associate-*r*57.1%
Simplified57.1%
if -1.45e-21 < y < -3.69999999999999986e-81 or -9.00000000000000017e-258 < y < 1.3e-42Initial program 84.0%
Taylor expanded in y around 0 81.8%
unpow281.8%
unpow281.8%
Simplified81.8%
Taylor expanded in x around 0 60.9%
unpow260.9%
associate-*l/63.4%
Simplified63.4%
if -3.69999999999999986e-81 < y < -9.00000000000000017e-258Initial program 94.9%
Taylor expanded in x around inf 59.9%
unpow259.9%
Simplified59.9%
associate-/l*61.6%
associate-/r/61.6%
Applied egg-rr61.6%
Final simplification66.3%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -0.5 (* z (/ z y)))))
(if (<= y -9.2e+48)
(* y 0.5)
(if (<= y -6.2e-8)
(* x (* x (/ 0.5 y)))
(if (<= y -1.35e-21)
(* y 0.5)
(if (<= y -3.25e-81)
t_0
(if (<= y -6.5e-258)
(* x (/ x (* y 2.0)))
(if (<= y 9.8e-43)
t_0
(if (<= y 1.05e+121) (* (/ x (/ y x)) 0.5) (* y 0.5))))))))))z = abs(z);
double code(double x, double y, double z) {
double t_0 = -0.5 * (z * (z / y));
double tmp;
if (y <= -9.2e+48) {
tmp = y * 0.5;
} else if (y <= -6.2e-8) {
tmp = x * (x * (0.5 / y));
} else if (y <= -1.35e-21) {
tmp = y * 0.5;
} else if (y <= -3.25e-81) {
tmp = t_0;
} else if (y <= -6.5e-258) {
tmp = x * (x / (y * 2.0));
} else if (y <= 9.8e-43) {
tmp = t_0;
} else if (y <= 1.05e+121) {
tmp = (x / (y / x)) * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
NOTE: z should be positive before calling this function
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 = (-0.5d0) * (z * (z / y))
if (y <= (-9.2d+48)) then
tmp = y * 0.5d0
else if (y <= (-6.2d-8)) then
tmp = x * (x * (0.5d0 / y))
else if (y <= (-1.35d-21)) then
tmp = y * 0.5d0
else if (y <= (-3.25d-81)) then
tmp = t_0
else if (y <= (-6.5d-258)) then
tmp = x * (x / (y * 2.0d0))
else if (y <= 9.8d-43) then
tmp = t_0
else if (y <= 1.05d+121) then
tmp = (x / (y / x)) * 0.5d0
else
tmp = y * 0.5d0
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double t_0 = -0.5 * (z * (z / y));
double tmp;
if (y <= -9.2e+48) {
tmp = y * 0.5;
} else if (y <= -6.2e-8) {
tmp = x * (x * (0.5 / y));
} else if (y <= -1.35e-21) {
tmp = y * 0.5;
} else if (y <= -3.25e-81) {
tmp = t_0;
} else if (y <= -6.5e-258) {
tmp = x * (x / (y * 2.0));
} else if (y <= 9.8e-43) {
tmp = t_0;
} else if (y <= 1.05e+121) {
tmp = (x / (y / x)) * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
z = abs(z) def code(x, y, z): t_0 = -0.5 * (z * (z / y)) tmp = 0 if y <= -9.2e+48: tmp = y * 0.5 elif y <= -6.2e-8: tmp = x * (x * (0.5 / y)) elif y <= -1.35e-21: tmp = y * 0.5 elif y <= -3.25e-81: tmp = t_0 elif y <= -6.5e-258: tmp = x * (x / (y * 2.0)) elif y <= 9.8e-43: tmp = t_0 elif y <= 1.05e+121: tmp = (x / (y / x)) * 0.5 else: tmp = y * 0.5 return tmp
z = abs(z) function code(x, y, z) t_0 = Float64(-0.5 * Float64(z * Float64(z / y))) tmp = 0.0 if (y <= -9.2e+48) tmp = Float64(y * 0.5); elseif (y <= -6.2e-8) tmp = Float64(x * Float64(x * Float64(0.5 / y))); elseif (y <= -1.35e-21) tmp = Float64(y * 0.5); elseif (y <= -3.25e-81) tmp = t_0; elseif (y <= -6.5e-258) tmp = Float64(x * Float64(x / Float64(y * 2.0))); elseif (y <= 9.8e-43) tmp = t_0; elseif (y <= 1.05e+121) tmp = Float64(Float64(x / Float64(y / x)) * 0.5); else tmp = Float64(y * 0.5); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) t_0 = -0.5 * (z * (z / y)); tmp = 0.0; if (y <= -9.2e+48) tmp = y * 0.5; elseif (y <= -6.2e-8) tmp = x * (x * (0.5 / y)); elseif (y <= -1.35e-21) tmp = y * 0.5; elseif (y <= -3.25e-81) tmp = t_0; elseif (y <= -6.5e-258) tmp = x * (x / (y * 2.0)); elseif (y <= 9.8e-43) tmp = t_0; elseif (y <= 1.05e+121) tmp = (x / (y / x)) * 0.5; else tmp = y * 0.5; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e+48], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -6.2e-8], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.35e-21], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, -3.25e-81], t$95$0, If[LessEqual[y, -6.5e-258], N[(x * N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e-43], t$95$0, If[LessEqual[y, 1.05e+121], N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+48}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{elif}\;y \leq -1.35 \cdot 10^{-21}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -3.25 \cdot 10^{-81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -6.5 \cdot 10^{-258}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{-43}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+121}:\\
\;\;\;\;\frac{x}{\frac{y}{x}} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < -9.2000000000000001e48 or -6.2e-8 < y < -1.3500000000000001e-21 or 1.0500000000000001e121 < y Initial program 41.8%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
Simplified74.0%
if -9.2000000000000001e48 < y < -6.2e-8Initial program 88.7%
Taylor expanded in x around inf 66.9%
unpow266.9%
Simplified66.9%
Taylor expanded in x around 0 66.9%
unpow266.9%
associate-*r/66.9%
associate-*l/66.9%
*-commutative66.9%
associate-*r*67.1%
Simplified67.1%
if -1.3500000000000001e-21 < y < -3.2500000000000001e-81 or -6.5000000000000002e-258 < y < 9.79999999999999976e-43Initial program 84.0%
Taylor expanded in y around 0 81.8%
unpow281.8%
unpow281.8%
Simplified81.8%
Taylor expanded in x around 0 60.9%
unpow260.9%
associate-*l/63.4%
Simplified63.4%
if -3.2500000000000001e-81 < y < -6.5000000000000002e-258Initial program 94.9%
Taylor expanded in x around inf 59.9%
unpow259.9%
Simplified59.9%
associate-/l*61.6%
associate-/r/61.6%
Applied egg-rr61.6%
if 9.79999999999999976e-43 < y < 1.0500000000000001e121Initial program 88.2%
Taylor expanded in x around inf 50.0%
unpow250.0%
Simplified50.0%
associate-/r*50.0%
div-inv50.0%
associate-/l*53.6%
metadata-eval53.6%
Applied egg-rr53.6%
Final simplification66.3%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(if (or (<= (* x x) 2e+161)
(and (not (<= (* x x) 4e+182)) (<= (* x x) 1e+243)))
(* -0.5 (- (* z (/ z y)) y))
(* (/ x (/ y x)) 0.5)))z = abs(z);
double code(double x, double y, double z) {
double tmp;
if (((x * x) <= 2e+161) || (!((x * x) <= 4e+182) && ((x * x) <= 1e+243))) {
tmp = -0.5 * ((z * (z / y)) - y);
} else {
tmp = (x / (y / x)) * 0.5;
}
return tmp;
}
NOTE: z should be positive before calling this function
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) <= 2d+161) .or. (.not. ((x * x) <= 4d+182)) .and. ((x * x) <= 1d+243)) then
tmp = (-0.5d0) * ((z * (z / y)) - y)
else
tmp = (x / (y / x)) * 0.5d0
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if (((x * x) <= 2e+161) || (!((x * x) <= 4e+182) && ((x * x) <= 1e+243))) {
tmp = -0.5 * ((z * (z / y)) - y);
} else {
tmp = (x / (y / x)) * 0.5;
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if ((x * x) <= 2e+161) or (not ((x * x) <= 4e+182) and ((x * x) <= 1e+243)): tmp = -0.5 * ((z * (z / y)) - y) else: tmp = (x / (y / x)) * 0.5 return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if ((Float64(x * x) <= 2e+161) || (!(Float64(x * x) <= 4e+182) && (Float64(x * x) <= 1e+243))) tmp = Float64(-0.5 * Float64(Float64(z * Float64(z / y)) - y)); else tmp = Float64(Float64(x / Float64(y / x)) * 0.5); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * x) <= 2e+161) || (~(((x * x) <= 4e+182)) && ((x * x) <= 1e+243))) tmp = -0.5 * ((z * (z / y)) - y); else tmp = (x / (y / x)) * 0.5; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 2e+161], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 4e+182]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 1e+243]]], N[(-0.5 * N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+161} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{+182}\right) \land x \cdot x \leq 10^{+243}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{x}} \cdot 0.5\\
\end{array}
\end{array}
if (*.f64 x x) < 2.0000000000000001e161 or 4.0000000000000003e182 < (*.f64 x x) < 1.0000000000000001e243Initial program 72.4%
sub-neg72.4%
+-commutative72.4%
neg-sub072.4%
associate-+l-72.4%
sub0-neg72.4%
neg-mul-172.4%
*-commutative72.4%
times-frac72.4%
associate--r+72.4%
div-sub72.4%
difference-of-squares72.4%
+-commutative72.4%
associate-*l/76.0%
*-commutative76.0%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 76.9%
unpow276.9%
associate-*r/83.2%
Simplified83.2%
if 2.0000000000000001e161 < (*.f64 x x) < 4.0000000000000003e182 or 1.0000000000000001e243 < (*.f64 x x) Initial program 64.8%
Taylor expanded in x around inf 70.3%
unpow270.3%
Simplified70.3%
associate-/r*70.3%
div-inv70.3%
associate-/l*76.2%
metadata-eval76.2%
Applied egg-rr76.2%
Final simplification81.2%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= (* x x) 1e-68) (* -0.5 (- (* z (/ z y)) y)) (* -0.5 (- (* (- z x) (/ x y)) y))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * ((z * (z / y)) - y);
} else {
tmp = -0.5 * (((z - x) * (x / y)) - y);
}
return tmp;
}
NOTE: z should be positive before calling this function
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-68) then
tmp = (-0.5d0) * ((z * (z / y)) - y)
else
tmp = (-0.5d0) * (((z - x) * (x / y)) - y)
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * ((z * (z / y)) - y);
} else {
tmp = -0.5 * (((z - x) * (x / y)) - y);
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (x * x) <= 1e-68: tmp = -0.5 * ((z * (z / y)) - y) else: tmp = -0.5 * (((z - x) * (x / y)) - y) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 1e-68) tmp = Float64(-0.5 * Float64(Float64(z * Float64(z / y)) - y)); else tmp = Float64(-0.5 * Float64(Float64(Float64(z - x) * Float64(x / y)) - y)); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 1e-68) tmp = -0.5 * ((z * (z / y)) - y); else tmp = -0.5 * (((z - x) * (x / y)) - y); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-68], N[(-0.5 * N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-68}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{x}{y} - y\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.00000000000000007e-68Initial program 70.6%
sub-neg70.6%
+-commutative70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
*-commutative70.6%
times-frac70.6%
associate--r+70.6%
div-sub70.6%
difference-of-squares70.7%
+-commutative70.7%
associate-*l/75.6%
*-commutative75.6%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 82.7%
unpow282.7%
associate-*r/89.4%
Simplified89.4%
if 1.00000000000000007e-68 < (*.f64 x x) Initial program 69.9%
sub-neg69.9%
+-commutative69.9%
neg-sub069.9%
associate-+l-69.9%
sub0-neg69.9%
neg-mul-169.9%
*-commutative69.9%
times-frac69.9%
associate--r+69.9%
div-sub70.0%
difference-of-squares78.9%
+-commutative78.9%
associate-*l/80.4%
*-commutative80.4%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 86.7%
Final simplification88.1%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= (* x x) 1e-68) (* -0.5 (- (/ (- z x) (/ y z)) y)) (* -0.5 (- (* (- z x) (/ x y)) y))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * (((z - x) / (y / z)) - y);
} else {
tmp = -0.5 * (((z - x) * (x / y)) - y);
}
return tmp;
}
NOTE: z should be positive before calling this function
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-68) then
tmp = (-0.5d0) * (((z - x) / (y / z)) - y)
else
tmp = (-0.5d0) * (((z - x) * (x / y)) - y)
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 1e-68) {
tmp = -0.5 * (((z - x) / (y / z)) - y);
} else {
tmp = -0.5 * (((z - x) * (x / y)) - y);
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (x * x) <= 1e-68: tmp = -0.5 * (((z - x) / (y / z)) - y) else: tmp = -0.5 * (((z - x) * (x / y)) - y) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 1e-68) tmp = Float64(-0.5 * Float64(Float64(Float64(z - x) / Float64(y / z)) - y)); else tmp = Float64(-0.5 * Float64(Float64(Float64(z - x) * Float64(x / y)) - y)); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 1e-68) tmp = -0.5 * (((z - x) / (y / z)) - y); else tmp = -0.5 * (((z - x) * (x / y)) - y); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-68], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] / N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[(z - x), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-68}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z - x}{\frac{y}{z}} - y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{x}{y} - y\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.00000000000000007e-68Initial program 70.6%
sub-neg70.6%
+-commutative70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
*-commutative70.6%
times-frac70.6%
associate--r+70.6%
div-sub70.6%
difference-of-squares70.7%
+-commutative70.7%
associate-*l/75.6%
*-commutative75.6%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 89.3%
if 1.00000000000000007e-68 < (*.f64 x x) Initial program 69.9%
sub-neg69.9%
+-commutative69.9%
neg-sub069.9%
associate-+l-69.9%
sub0-neg69.9%
neg-mul-169.9%
*-commutative69.9%
times-frac69.9%
associate--r+69.9%
div-sub70.0%
difference-of-squares78.9%
+-commutative78.9%
associate-*l/80.4%
*-commutative80.4%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 86.7%
Final simplification88.0%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y -1.22e-21) (* y 0.5) (if (<= y 5.5e+121) (* -0.5 (* z (/ z y))) (* y 0.5))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if (y <= -1.22e-21) {
tmp = y * 0.5;
} else if (y <= 5.5e+121) {
tmp = -0.5 * (z * (z / y));
} else {
tmp = y * 0.5;
}
return tmp;
}
NOTE: z should be positive before calling this function
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.22d-21)) then
tmp = y * 0.5d0
else if (y <= 5.5d+121) then
tmp = (-0.5d0) * (z * (z / y))
else
tmp = y * 0.5d0
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.22e-21) {
tmp = y * 0.5;
} else if (y <= 5.5e+121) {
tmp = -0.5 * (z * (z / y));
} else {
tmp = y * 0.5;
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if y <= -1.22e-21: tmp = y * 0.5 elif y <= 5.5e+121: tmp = -0.5 * (z * (z / y)) else: tmp = y * 0.5 return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (y <= -1.22e-21) tmp = Float64(y * 0.5); elseif (y <= 5.5e+121) tmp = Float64(-0.5 * Float64(z * Float64(z / y))); else tmp = Float64(y * 0.5); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.22e-21) tmp = y * 0.5; elseif (y <= 5.5e+121) tmp = -0.5 * (z * (z / y)); else tmp = y * 0.5; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, -1.22e-21], N[(y * 0.5), $MachinePrecision], If[LessEqual[y, 5.5e+121], N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{-21}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+121}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < -1.21999999999999991e-21 or 5.4999999999999998e121 < y Initial program 45.8%
Taylor expanded in y around inf 68.0%
*-commutative68.0%
Simplified68.0%
if -1.21999999999999991e-21 < y < 5.4999999999999998e121Initial program 87.6%
Taylor expanded in y around 0 82.0%
unpow282.0%
unpow282.0%
Simplified82.0%
Taylor expanded in x around 0 47.8%
unpow247.8%
associate-*l/49.3%
Simplified49.3%
Final simplification57.0%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (* y 0.5))
z = abs(z);
double code(double x, double y, double z) {
return y * 0.5;
}
NOTE: z should be positive before calling this function
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
z = Math.abs(z);
public static double code(double x, double y, double z) {
return y * 0.5;
}
z = abs(z) def code(x, y, z): return y * 0.5
z = abs(z) function code(x, y, z) return Float64(y * 0.5) end
z = abs(z) function tmp = code(x, y, z) tmp = y * 0.5; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := N[(y * 0.5), $MachinePrecision]
\begin{array}{l}
z = |z|\\
\\
y \cdot 0.5
\end{array}
Initial program 70.3%
Taylor expanded in y around inf 33.3%
*-commutative33.3%
Simplified33.3%
Final simplification33.3%
(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 2023240
(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)))