
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= y 5.5e-270) (+ (/ x z) (* y (- 1.0 (/ x z)))) (if (<= y 1.56e+16) (/ (+ x (* y (- z x))) z) (/ y (/ z (- z x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.5e-270) {
tmp = (x / z) + (y * (1.0 - (x / z)));
} else if (y <= 1.56e+16) {
tmp = (x + (y * (z - x))) / z;
} else {
tmp = y / (z / (z - x));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 5.5d-270) then
tmp = (x / z) + (y * (1.0d0 - (x / z)))
else if (y <= 1.56d+16) then
tmp = (x + (y * (z - x))) / z
else
tmp = y / (z / (z - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.5e-270) {
tmp = (x / z) + (y * (1.0 - (x / z)));
} else if (y <= 1.56e+16) {
tmp = (x + (y * (z - x))) / z;
} else {
tmp = y / (z / (z - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.5e-270: tmp = (x / z) + (y * (1.0 - (x / z))) elif y <= 1.56e+16: tmp = (x + (y * (z - x))) / z else: tmp = y / (z / (z - x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.5e-270) tmp = Float64(Float64(x / z) + Float64(y * Float64(1.0 - Float64(x / z)))); elseif (y <= 1.56e+16) tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z); else tmp = Float64(y / Float64(z / Float64(z - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.5e-270) tmp = (x / z) + (y * (1.0 - (x / z))); elseif (y <= 1.56e+16) tmp = (x + (y * (z - x))) / z; else tmp = y / (z / (z - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.5e-270], N[(N[(x / z), $MachinePrecision] + N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.56e+16], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-270}:\\
\;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{elif}\;y \leq 1.56 \cdot 10^{+16}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\end{array}
\end{array}
if y < 5.4999999999999996e-270Initial program 88.8%
Taylor expanded in y around 0 100.0%
if 5.4999999999999996e-270 < y < 1.56e16Initial program 99.9%
if 1.56e16 < y Initial program 66.0%
Taylor expanded in y around inf 66.0%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y -1.7e+31) (- y (* y (/ x z))) (if (<= y 8e+14) (/ (+ x (* y (- z x))) z) (/ y (/ z (- z x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.7e+31) {
tmp = y - (y * (x / z));
} else if (y <= 8e+14) {
tmp = (x + (y * (z - x))) / z;
} else {
tmp = y / (z / (z - x));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.7d+31)) then
tmp = y - (y * (x / z))
else if (y <= 8d+14) then
tmp = (x + (y * (z - x))) / z
else
tmp = y / (z / (z - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.7e+31) {
tmp = y - (y * (x / z));
} else if (y <= 8e+14) {
tmp = (x + (y * (z - x))) / z;
} else {
tmp = y / (z / (z - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.7e+31: tmp = y - (y * (x / z)) elif y <= 8e+14: tmp = (x + (y * (z - x))) / z else: tmp = y / (z / (z - x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.7e+31) tmp = Float64(y - Float64(y * Float64(x / z))); elseif (y <= 8e+14) tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z); else tmp = Float64(y / Float64(z / Float64(z - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.7e+31) tmp = y - (y * (x / z)); elseif (y <= 8e+14) tmp = (x + (y * (z - x))) / z; else tmp = y / (z / (z - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.7e+31], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+14], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+31}:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+14}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\end{array}
\end{array}
if y < -1.6999999999999999e31Initial program 76.2%
Taylor expanded in y around inf 76.2%
Taylor expanded in z around 0 97.0%
+-commutative97.0%
mul-1-neg97.0%
associate-*r/100.0%
unsub-neg100.0%
*-commutative100.0%
Simplified100.0%
if -1.6999999999999999e31 < y < 8e14Initial program 99.9%
if 8e14 < y Initial program 66.0%
Taylor expanded in y around inf 66.0%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = 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 ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 73.3%
Taylor expanded in y around 0 95.3%
Taylor expanded in y around inf 99.5%
if -1 < y < 1Initial program 99.9%
Taylor expanded in y around 0 89.6%
Taylor expanded in x around 0 99.3%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (- y (* y (/ x z))) (if (<= y 1.0) (+ y (/ x z)) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y - (y * (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = 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 (y <= (-1.0d0)) then
tmp = y - (y * (x / z))
else if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y * (1.0d0 - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y - (y * (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y * (1.0 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = y - (y * (x / z)) elif y <= 1.0: tmp = y + (x / z) else: tmp = y * (1.0 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(y - Float64(y * Float64(x / z))); elseif (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(1.0 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.0) tmp = y - (y * (x / z)); elseif (y <= 1.0) tmp = y + (x / z); else tmp = y * (1.0 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.0], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -1Initial program 78.0%
Taylor expanded in y around inf 77.6%
Taylor expanded in z around 0 96.9%
+-commutative96.9%
mul-1-neg96.9%
associate-*r/99.6%
unsub-neg99.6%
*-commutative99.6%
Simplified99.6%
if -1 < y < 1Initial program 99.9%
Taylor expanded in y around 0 89.6%
Taylor expanded in x around 0 99.3%
if 1 < y Initial program 68.2%
Taylor expanded in y around 0 90.1%
Taylor expanded in y around inf 99.4%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (- y (* y (/ x z))) (if (<= y 1.0) (+ y (/ x z)) (/ y (/ z (- z x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y - (y * (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y / (z / (z - x));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = y - (y * (x / z))
else if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y / (z / (z - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y - (y * (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y / (z / (z - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = y - (y * (x / z)) elif y <= 1.0: tmp = y + (x / z) else: tmp = y / (z / (z - x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(y - Float64(y * Float64(x / z))); elseif (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y / Float64(z / Float64(z - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.0) tmp = y - (y * (x / z)); elseif (y <= 1.0) tmp = y + (x / z); else tmp = y / (z / (z - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.0], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\end{array}
\end{array}
if y < -1Initial program 78.0%
Taylor expanded in y around inf 77.6%
Taylor expanded in z around 0 96.9%
+-commutative96.9%
mul-1-neg96.9%
associate-*r/99.6%
unsub-neg99.6%
*-commutative99.6%
Simplified99.6%
if -1 < y < 1Initial program 99.9%
Taylor expanded in y around 0 89.6%
Taylor expanded in x around 0 99.3%
if 1 < y Initial program 68.2%
Taylor expanded in y around inf 67.7%
associate-/l*99.5%
Simplified99.5%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -8.2e-44) (not (<= y 0.00042))) (* z (/ y z)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8.2e-44) || !(y <= 0.00042)) {
tmp = z * (y / z);
} else {
tmp = 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 ((y <= (-8.2d-44)) .or. (.not. (y <= 0.00042d0))) then
tmp = z * (y / z)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8.2e-44) || !(y <= 0.00042)) {
tmp = z * (y / z);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8.2e-44) or not (y <= 0.00042): tmp = z * (y / z) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8.2e-44) || !(y <= 0.00042)) tmp = Float64(z * Float64(y / z)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8.2e-44) || ~((y <= 0.00042))) tmp = z * (y / z); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8.2e-44], N[Not[LessEqual[y, 0.00042]], $MachinePrecision]], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-44} \lor \neg \left(y \leq 0.00042\right):\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -8.19999999999999984e-44 or 4.2000000000000002e-4 < y Initial program 75.5%
Taylor expanded in z around inf 46.0%
Taylor expanded in x around 0 38.7%
associate-/l*58.5%
associate-/r/59.4%
Applied egg-rr59.4%
if -8.19999999999999984e-44 < y < 4.2000000000000002e-4Initial program 99.9%
Taylor expanded in y around 0 73.7%
Final simplification65.7%
(FPCore (x y z) :precision binary64 (if (<= x -4.7e+187) (* y (/ (- x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.7e+187) {
tmp = y * (-x / z);
} else {
tmp = 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 (x <= (-4.7d+187)) then
tmp = y * (-x / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.7e+187) {
tmp = y * (-x / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.7e+187: tmp = y * (-x / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.7e+187) tmp = Float64(y * Float64(Float64(-x) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.7e+187) tmp = y * (-x / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.7e+187], N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{+187}:\\
\;\;\;\;y \cdot \frac{-x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -4.69999999999999989e187Initial program 79.5%
Taylor expanded in y around inf 51.3%
Taylor expanded in z around 0 51.3%
mul-1-neg51.3%
associate-*r/76.7%
*-commutative76.7%
distribute-rgt-neg-in76.7%
Simplified76.7%
if -4.69999999999999989e187 < x Initial program 86.8%
Taylor expanded in y around 0 94.1%
Taylor expanded in x around 0 83.4%
Final simplification82.9%
(FPCore (x y z) :precision binary64 (if (<= x -5.4e+187) (/ y (/ (- z) x)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.4e+187) {
tmp = y / (-z / x);
} else {
tmp = 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 (x <= (-5.4d+187)) then
tmp = y / (-z / x)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.4e+187) {
tmp = y / (-z / x);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.4e+187: tmp = y / (-z / x) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.4e+187) tmp = Float64(y / Float64(Float64(-z) / x)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.4e+187) tmp = y / (-z / x); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.4e+187], N[(y / N[((-z) / x), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{+187}:\\
\;\;\;\;\frac{y}{\frac{-z}{x}}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -5.40000000000000016e187Initial program 79.5%
Taylor expanded in y around inf 51.3%
associate-/l*76.9%
Simplified76.9%
Taylor expanded in z around 0 76.9%
associate-*r/76.9%
neg-mul-176.9%
Simplified76.9%
if -5.40000000000000016e187 < x Initial program 86.8%
Taylor expanded in y around 0 94.1%
Taylor expanded in x around 0 83.4%
Final simplification82.9%
(FPCore (x y z) :precision binary64 (if (<= x -3.6e+19) (/ x z) (if (<= x 4.8e+83) y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e+19) {
tmp = x / z;
} else if (x <= 4.8e+83) {
tmp = y;
} else {
tmp = 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 (x <= (-3.6d+19)) then
tmp = x / z
else if (x <= 4.8d+83) then
tmp = y
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e+19) {
tmp = x / z;
} else if (x <= 4.8e+83) {
tmp = y;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.6e+19: tmp = x / z elif x <= 4.8e+83: tmp = y else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.6e+19) tmp = Float64(x / z); elseif (x <= 4.8e+83) tmp = y; else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.6e+19) tmp = x / z; elseif (x <= 4.8e+83) tmp = y; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.6e+19], N[(x / z), $MachinePrecision], If[LessEqual[x, 4.8e+83], y, N[(x / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+19}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+83}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if x < -3.6e19 or 4.79999999999999982e83 < x Initial program 91.2%
Taylor expanded in y around 0 59.7%
if -3.6e19 < x < 4.79999999999999982e83Initial program 82.8%
Taylor expanded in x around 0 69.7%
Final simplification65.5%
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
return y + (x / z);
}
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)
end function
public static double code(double x, double y, double z) {
return y + (x / z);
}
def code(x, y, z): return y + (x / z)
function code(x, y, z) return Float64(y + Float64(x / z)) end
function tmp = code(x, y, z) tmp = y + (x / z); end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z}
\end{array}
Initial program 86.3%
Taylor expanded in y around 0 92.5%
Taylor expanded in x around 0 80.7%
Final simplification80.7%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 86.3%
Taylor expanded in x around 0 45.3%
Final simplification45.3%
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
return (y + (x / z)) - (y / (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 + (x / z)) - (y / (z / x))
end function
public static double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z): return (y + (x / z)) - (y / (z / x))
function code(x, y, z) return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x))) end
function tmp = code(x, y, z) tmp = (y + (x / z)) - (y / (z / x)); end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}
herbie shell --seed 2023187
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:herbie-target
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))