
(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 (or (<= z -6.8e+144) (not (<= z 1e+61))) (+ y (* x (/ (- 1.0 y) z))) (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e+144) || !(z <= 1e+61)) {
tmp = y + (x * ((1.0 - y) / z));
} else {
tmp = (x + (y * (z - 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 <= (-6.8d+144)) .or. (.not. (z <= 1d+61))) then
tmp = y + (x * ((1.0d0 - y) / z))
else
tmp = (x + (y * (z - x))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e+144) || !(z <= 1e+61)) {
tmp = y + (x * ((1.0 - y) / z));
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.8e+144) or not (z <= 1e+61): tmp = y + (x * ((1.0 - y) / z)) else: tmp = (x + (y * (z - x))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.8e+144) || !(z <= 1e+61)) tmp = Float64(y + Float64(x * Float64(Float64(1.0 - y) / z))); else tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.8e+144) || ~((z <= 1e+61))) tmp = y + (x * ((1.0 - y) / z)); else tmp = (x + (y * (z - x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.8e+144], N[Not[LessEqual[z, 1e+61]], $MachinePrecision]], N[(y + N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+144} \lor \neg \left(z \leq 10^{+61}\right):\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}
\end{array}
if z < -6.7999999999999998e144 or 9.99999999999999949e60 < z Initial program 60.2%
Taylor expanded in x around inf 91.3%
Taylor expanded in y around 0 91.3%
+-commutative91.3%
mul-1-neg91.3%
*-rgt-identity91.3%
associate-*r/91.3%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-lft-in99.9%
sub-neg99.9%
div-sub99.9%
Simplified99.9%
if -6.7999999999999998e144 < z < 9.99999999999999949e60Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y -5e+48) (- y (* y (/ x z))) (if (<= y 5e+20) (+ y (* x (/ (- 1.0 y) z))) (* y (/ (- z x) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+48) {
tmp = y - (y * (x / z));
} else if (y <= 5e+20) {
tmp = y + (x * ((1.0 - y) / z));
} else {
tmp = y * ((z - 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 <= (-5d+48)) then
tmp = y - (y * (x / z))
else if (y <= 5d+20) then
tmp = y + (x * ((1.0d0 - y) / z))
else
tmp = y * ((z - x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e+48) {
tmp = y - (y * (x / z));
} else if (y <= 5e+20) {
tmp = y + (x * ((1.0 - y) / z));
} else {
tmp = y * ((z - x) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e+48: tmp = y - (y * (x / z)) elif y <= 5e+20: tmp = y + (x * ((1.0 - y) / z)) else: tmp = y * ((z - x) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e+48) tmp = Float64(y - Float64(y * Float64(x / z))); elseif (y <= 5e+20) tmp = Float64(y + Float64(x * Float64(Float64(1.0 - y) / z))); else tmp = Float64(y * Float64(Float64(z - x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e+48) tmp = y - (y * (x / z)); elseif (y <= 5e+20) tmp = y + (x * ((1.0 - y) / z)); else tmp = y * ((z - x) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e+48], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+20], N[(y + N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+48}:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+20}:\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\end{array}
\end{array}
if y < -4.99999999999999973e48Initial program 72.6%
Taylor expanded in x around inf 95.2%
Taylor expanded in y around inf 95.2%
mul-1-neg95.2%
distribute-rgt-neg-in95.2%
Simplified95.2%
div-inv95.2%
add-sqr-sqrt95.2%
sqrt-unprod57.9%
sqr-neg57.9%
sqrt-unprod0.0%
add-sqr-sqrt61.6%
remove-double-neg61.6%
distribute-rgt-neg-out61.6%
cancel-sign-sub-inv61.6%
div-inv61.6%
*-commutative61.6%
associate-/l*64.6%
add-sqr-sqrt64.6%
sqrt-unprod25.4%
sqr-neg25.4%
sqrt-unprod0.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
if -4.99999999999999973e48 < y < 5e20Initial program 97.8%
Taylor expanded in x around inf 99.3%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
mul-1-neg99.3%
*-rgt-identity99.3%
associate-*r/99.2%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-lft-in99.8%
sub-neg99.8%
div-sub99.8%
Simplified99.8%
if 5e20 < y Initial program 72.5%
Taylor expanded in y around inf 72.5%
associate-/l*99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -8.2e+64) (not (<= x 6e+39))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -8.2e+64) || !(x <= 6e+39)) {
tmp = x * ((1.0 - y) / 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 <= (-8.2d+64)) .or. (.not. (x <= 6d+39))) then
tmp = x * ((1.0d0 - y) / 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 <= -8.2e+64) || !(x <= 6e+39)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -8.2e+64) or not (x <= 6e+39): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -8.2e+64) || !(x <= 6e+39)) tmp = Float64(x * Float64(Float64(1.0 - y) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -8.2e+64) || ~((x <= 6e+39))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -8.2e+64], N[Not[LessEqual[x, 6e+39]], $MachinePrecision]], N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+64} \lor \neg \left(x \leq 6 \cdot 10^{+39}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -8.19999999999999956e64 or 5.9999999999999999e39 < x Initial program 89.4%
Taylor expanded in x around inf 85.5%
associate-/l*90.1%
mul-1-neg90.1%
unsub-neg90.1%
Simplified90.1%
if -8.19999999999999956e64 < x < 5.9999999999999999e39Initial program 84.3%
Taylor expanded in z around inf 74.7%
Taylor expanded in x around 0 90.3%
+-commutative90.3%
Simplified90.3%
Final simplification90.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1350000000.0) (not (<= y 0.001))) (* y (/ (- z x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1350000000.0) || !(y <= 0.001)) {
tmp = y * ((z - 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 <= (-1350000000.0d0)) .or. (.not. (y <= 0.001d0))) then
tmp = y * ((z - 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 <= -1350000000.0) || !(y <= 0.001)) {
tmp = y * ((z - x) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1350000000.0) or not (y <= 0.001): tmp = y * ((z - x) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1350000000.0) || !(y <= 0.001)) tmp = Float64(y * Float64(Float64(z - 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 <= -1350000000.0) || ~((y <= 0.001))) tmp = y * ((z - x) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1350000000.0], N[Not[LessEqual[y, 0.001]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1350000000 \lor \neg \left(y \leq 0.001\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.35e9 or 1e-3 < y Initial program 74.0%
Taylor expanded in y around inf 73.3%
associate-/l*99.2%
Simplified99.2%
if -1.35e9 < y < 1e-3Initial program 99.1%
Taylor expanded in z around inf 97.5%
Taylor expanded in x around 0 98.3%
+-commutative98.3%
Simplified98.3%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= y -1350000000.0) (- y (* y (/ x z))) (if (<= y 0.001) (+ y (/ x z)) (* y (/ (- z x) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1350000000.0) {
tmp = y - (y * (x / z));
} else if (y <= 0.001) {
tmp = y + (x / z);
} else {
tmp = y * ((z - 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 <= (-1350000000.0d0)) then
tmp = y - (y * (x / z))
else if (y <= 0.001d0) then
tmp = y + (x / z)
else
tmp = y * ((z - x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1350000000.0) {
tmp = y - (y * (x / z));
} else if (y <= 0.001) {
tmp = y + (x / z);
} else {
tmp = y * ((z - x) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1350000000.0: tmp = y - (y * (x / z)) elif y <= 0.001: tmp = y + (x / z) else: tmp = y * ((z - x) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1350000000.0) tmp = Float64(y - Float64(y * Float64(x / z))); elseif (y <= 0.001) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(Float64(z - x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1350000000.0) tmp = y - (y * (x / z)); elseif (y <= 0.001) tmp = y + (x / z); else tmp = y * ((z - x) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1350000000.0], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.001], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1350000000:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 0.001:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\end{array}
\end{array}
if y < -1.35e9Initial program 73.3%
Taylor expanded in x around inf 94.5%
Taylor expanded in y around inf 94.2%
mul-1-neg94.2%
distribute-rgt-neg-in94.2%
Simplified94.2%
div-inv94.2%
add-sqr-sqrt94.2%
sqrt-unprod61.6%
sqr-neg61.6%
sqrt-unprod0.0%
add-sqr-sqrt58.0%
remove-double-neg58.0%
distribute-rgt-neg-out58.0%
cancel-sign-sub-inv58.0%
div-inv58.0%
*-commutative58.0%
associate-/l*60.7%
add-sqr-sqrt60.7%
sqrt-unprod26.4%
sqr-neg26.4%
sqrt-unprod0.0%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
if -1.35e9 < y < 1e-3Initial program 99.1%
Taylor expanded in z around inf 97.5%
Taylor expanded in x around 0 98.3%
+-commutative98.3%
Simplified98.3%
if 1e-3 < y Initial program 74.8%
Taylor expanded in y around inf 73.6%
associate-/l*98.6%
Simplified98.6%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= x -9e+228) (- (/ x z) y) (if (<= x -1.65e+142) (- (* (/ y z) x)) (+ y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -9e+228) {
tmp = (x / z) - y;
} else if (x <= -1.65e+142) {
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 <= (-9d+228)) then
tmp = (x / z) - y
else if (x <= (-1.65d+142)) 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 <= -9e+228) {
tmp = (x / z) - y;
} else if (x <= -1.65e+142) {
tmp = -((y / z) * x);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9e+228: tmp = (x / z) - y elif x <= -1.65e+142: tmp = -((y / z) * x) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9e+228) tmp = Float64(Float64(x / z) - y); elseif (x <= -1.65e+142) tmp = Float64(-Float64(Float64(y / 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 <= -9e+228) tmp = (x / z) - y; elseif (x <= -1.65e+142) tmp = -((y / z) * x); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9e+228], N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, -1.65e+142], (-N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]), N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+228}:\\
\;\;\;\;\frac{x}{z} - y\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{+142}:\\
\;\;\;\;-\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -8.99999999999999966e228Initial program 100.0%
Taylor expanded in z around inf 87.6%
Taylor expanded in x around 0 87.6%
+-commutative87.6%
Simplified87.6%
add-sqr-sqrt38.5%
sqrt-unprod95.3%
sqr-neg95.3%
sqrt-unprod49.6%
add-sqr-sqrt88.1%
sub-neg88.1%
Applied egg-rr88.1%
if -8.99999999999999966e228 < x < -1.6500000000000001e142Initial program 87.3%
Taylor expanded in x around inf 87.3%
associate-/l*99.6%
mul-1-neg99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in y around inf 80.6%
neg-mul-180.6%
distribute-neg-frac280.6%
Simplified80.6%
if -1.6500000000000001e142 < x Initial program 85.4%
Taylor expanded in z around inf 70.7%
Taylor expanded in x around 0 83.6%
+-commutative83.6%
Simplified83.6%
Final simplification83.7%
(FPCore (x y z) :precision binary64 (if (<= x -1.95e+232) (- (/ x z) y) (if (<= x -4.6e+139) (* y (/ x (- z))) (+ y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e+232) {
tmp = (x / z) - y;
} else if (x <= -4.6e+139) {
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 <= (-1.95d+232)) then
tmp = (x / z) - y
else if (x <= (-4.6d+139)) 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 <= -1.95e+232) {
tmp = (x / z) - y;
} else if (x <= -4.6e+139) {
tmp = y * (x / -z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.95e+232: tmp = (x / z) - y elif x <= -4.6e+139: tmp = y * (x / -z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.95e+232) tmp = Float64(Float64(x / z) - y); elseif (x <= -4.6e+139) tmp = Float64(y * Float64(x / Float64(-z))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.95e+232) tmp = (x / z) - y; elseif (x <= -4.6e+139) tmp = y * (x / -z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.95e+232], N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, -4.6e+139], N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{+232}:\\
\;\;\;\;\frac{x}{z} - y\\
\mathbf{elif}\;x \leq -4.6 \cdot 10^{+139}:\\
\;\;\;\;y \cdot \frac{x}{-z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -1.9499999999999999e232Initial program 100.0%
Taylor expanded in z around inf 87.6%
Taylor expanded in x around 0 87.6%
+-commutative87.6%
Simplified87.6%
add-sqr-sqrt38.5%
sqrt-unprod95.3%
sqr-neg95.3%
sqrt-unprod49.6%
add-sqr-sqrt88.1%
sub-neg88.1%
Applied egg-rr88.1%
if -1.9499999999999999e232 < x < -4.6e139Initial program 87.3%
Taylor expanded in y around inf 68.3%
associate-/l*80.8%
Simplified80.8%
Taylor expanded in z around 0 68.2%
mul-1-neg68.2%
associate-*l/80.7%
*-commutative80.7%
distribute-rgt-neg-in80.7%
distribute-neg-frac280.7%
Simplified80.7%
if -4.6e139 < x Initial program 85.4%
Taylor expanded in z around inf 70.7%
Taylor expanded in x around 0 83.6%
+-commutative83.6%
Simplified83.6%
Final simplification83.7%
(FPCore (x y z) :precision binary64 (if (<= z 6.2e+158) (+ y (/ (* x (- 1.0 y)) z)) (+ y (* x (/ (- 1.0 y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 6.2e+158) {
tmp = y + ((x * (1.0 - y)) / z);
} else {
tmp = y + (x * ((1.0 - y) / 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 <= 6.2d+158) then
tmp = y + ((x * (1.0d0 - y)) / z)
else
tmp = y + (x * ((1.0d0 - y) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 6.2e+158) {
tmp = y + ((x * (1.0 - y)) / z);
} else {
tmp = y + (x * ((1.0 - y) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 6.2e+158: tmp = y + ((x * (1.0 - y)) / z) else: tmp = y + (x * ((1.0 - y) / z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 6.2e+158) tmp = Float64(y + Float64(Float64(x * Float64(1.0 - y)) / z)); else tmp = Float64(y + Float64(x * Float64(Float64(1.0 - y) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 6.2e+158) tmp = y + ((x * (1.0 - y)) / z); else tmp = y + (x * ((1.0 - y) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 6.2e+158], N[(y + N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.2 \cdot 10^{+158}:\\
\;\;\;\;y + \frac{x \cdot \left(1 - y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\end{array}
\end{array}
if z < 6.2000000000000004e158Initial program 93.3%
Taylor expanded in x around inf 99.1%
if 6.2000000000000004e158 < z Initial program 52.5%
Taylor expanded in x around inf 86.9%
Taylor expanded in y around 0 86.9%
+-commutative86.9%
mul-1-neg86.9%
*-rgt-identity86.9%
associate-*r/86.8%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-lft-in99.9%
sub-neg99.9%
div-sub99.9%
Simplified99.9%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.8e+20) (not (<= x 5.6e+39))) (/ x z) y))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e+20) || !(x <= 5.6e+39)) {
tmp = x / z;
} else {
tmp = 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 <= (-5.8d+20)) .or. (.not. (x <= 5.6d+39))) then
tmp = x / z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e+20) || !(x <= 5.6e+39)) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.8e+20) or not (x <= 5.6e+39): tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.8e+20) || !(x <= 5.6e+39)) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.8e+20) || ~((x <= 5.6e+39))) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.8e+20], N[Not[LessEqual[x, 5.6e+39]], $MachinePrecision]], N[(x / z), $MachinePrecision], y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+20} \lor \neg \left(x \leq 5.6 \cdot 10^{+39}\right):\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -5.8e20 or 5.60000000000000003e39 < x Initial program 89.9%
Taylor expanded in y around 0 55.0%
if -5.8e20 < x < 5.60000000000000003e39Initial program 83.9%
Taylor expanded in x around 0 73.3%
Final simplification65.9%
(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 z around inf 68.8%
Taylor expanded in x around 0 80.3%
+-commutative80.3%
Simplified80.3%
Final simplification80.3%
(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 48.3%
Final simplification48.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 2024044
(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))