
(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 (<= y -1.02e+30) (not (<= y 2.2e-6))) (- y (* y (/ x z))) (/ (fma y (- z x) x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.02e+30) || !(y <= 2.2e-6)) {
tmp = y - (y * (x / z));
} else {
tmp = fma(y, (z - x), x) / z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.02e+30) || !(y <= 2.2e-6)) tmp = Float64(y - Float64(y * Float64(x / z))); else tmp = Float64(fma(y, Float64(z - x), x) / z); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.02e+30], N[Not[LessEqual[y, 2.2e-6]], $MachinePrecision]], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z - x), $MachinePrecision] + x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+30} \lor \neg \left(y \leq 2.2 \cdot 10^{-6}\right):\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, z - x, x\right)}{z}\\
\end{array}
\end{array}
if y < -1.02e30 or 2.2000000000000001e-6 < y Initial program 74.2%
Taylor expanded in y around inf 74.2%
associate-/l*99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
sub-neg99.9%
distribute-lft-in99.9%
distribute-neg-frac299.9%
associate-/l*89.9%
*-commutative89.9%
*-un-lft-identity89.9%
*-commutative89.9%
distribute-rgt-in89.9%
*-un-lft-identity89.9%
distribute-frac-neg289.9%
unsub-neg89.9%
*-commutative89.9%
associate-*r/99.9%
Applied egg-rr99.9%
if -1.02e30 < y < 2.2000000000000001e-6Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2e+31) (not (<= y 2.2e-6))) (- y (* y (/ x z))) (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2e+31) || !(y <= 2.2e-6)) {
tmp = y - (y * (x / 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 ((y <= (-2d+31)) .or. (.not. (y <= 2.2d-6))) then
tmp = y - (y * (x / 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 ((y <= -2e+31) || !(y <= 2.2e-6)) {
tmp = y - (y * (x / z));
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2e+31) or not (y <= 2.2e-6): tmp = y - (y * (x / z)) else: tmp = (x + (y * (z - x))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2e+31) || !(y <= 2.2e-6)) tmp = Float64(y - Float64(y * Float64(x / 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 ((y <= -2e+31) || ~((y <= 2.2e-6))) tmp = y - (y * (x / z)); else tmp = (x + (y * (z - x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2e+31], N[Not[LessEqual[y, 2.2e-6]], $MachinePrecision]], N[(y - N[(y * N[(x / 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}\;y \leq -2 \cdot 10^{+31} \lor \neg \left(y \leq 2.2 \cdot 10^{-6}\right):\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}
\end{array}
if y < -1.9999999999999999e31 or 2.2000000000000001e-6 < y Initial program 74.2%
Taylor expanded in y around inf 74.2%
associate-/l*99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
sub-neg99.9%
distribute-lft-in99.9%
distribute-neg-frac299.9%
associate-/l*89.9%
*-commutative89.9%
*-un-lft-identity89.9%
*-commutative89.9%
distribute-rgt-in89.9%
*-un-lft-identity89.9%
distribute-frac-neg289.9%
unsub-neg89.9%
*-commutative89.9%
associate-*r/99.9%
Applied egg-rr99.9%
if -1.9999999999999999e31 < y < 2.2000000000000001e-6Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1600000000.0) (not (<= y 2.2e-6))) (- y (* y (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1600000000.0) || !(y <= 2.2e-6)) {
tmp = y - (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 ((y <= (-1600000000.0d0)) .or. (.not. (y <= 2.2d-6))) then
tmp = y - (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 ((y <= -1600000000.0) || !(y <= 2.2e-6)) {
tmp = y - (y * (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1600000000.0) or not (y <= 2.2e-6): tmp = y - (y * (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1600000000.0) || !(y <= 2.2e-6)) tmp = Float64(y - Float64(y * 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 <= -1600000000.0) || ~((y <= 2.2e-6))) tmp = y - (y * (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1600000000.0], N[Not[LessEqual[y, 2.2e-6]], $MachinePrecision]], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1600000000 \lor \neg \left(y \leq 2.2 \cdot 10^{-6}\right):\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.6e9 or 2.2000000000000001e-6 < y Initial program 75.1%
Taylor expanded in y around inf 74.7%
associate-/l*99.5%
div-sub99.5%
*-inverses99.5%
Simplified99.5%
sub-neg99.5%
distribute-lft-in99.5%
distribute-neg-frac299.5%
associate-/l*89.9%
*-commutative89.9%
*-un-lft-identity89.9%
*-commutative89.9%
distribute-rgt-in89.9%
*-un-lft-identity89.9%
distribute-frac-neg289.9%
unsub-neg89.9%
*-commutative89.9%
associate-*r/99.5%
Applied egg-rr99.5%
if -1.6e9 < y < 2.2000000000000001e-6Initial program 99.9%
Taylor expanded in z around inf 98.3%
Taylor expanded in y around 0 99.3%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -1600000000.0) (not (<= y 2.2e-6))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1600000000.0) || !(y <= 2.2e-6)) {
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 <= (-1600000000.0d0)) .or. (.not. (y <= 2.2d-6))) 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 <= -1600000000.0) || !(y <= 2.2e-6)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1600000000.0) or not (y <= 2.2e-6): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1600000000.0) || !(y <= 2.2e-6)) 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 <= -1600000000.0) || ~((y <= 2.2e-6))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1600000000.0], N[Not[LessEqual[y, 2.2e-6]], $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 -1600000000 \lor \neg \left(y \leq 2.2 \cdot 10^{-6}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.6e9 or 2.2000000000000001e-6 < y Initial program 75.1%
Taylor expanded in y around inf 74.7%
associate-/l*99.5%
div-sub99.5%
*-inverses99.5%
Simplified99.5%
if -1.6e9 < y < 2.2000000000000001e-6Initial program 99.9%
Taylor expanded in z around inf 98.3%
Taylor expanded in y around 0 99.3%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.4e+112) (not (<= x 2.4e-78))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e+112) || !(x <= 2.4e-78)) {
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 <= (-4.4d+112)) .or. (.not. (x <= 2.4d-78))) 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 <= -4.4e+112) || !(x <= 2.4e-78)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.4e+112) or not (x <= 2.4e-78): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.4e+112) || !(x <= 2.4e-78)) 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 <= -4.4e+112) || ~((x <= 2.4e-78))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.4e+112], N[Not[LessEqual[x, 2.4e-78]], $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 -4.4 \cdot 10^{+112} \lor \neg \left(x \leq 2.4 \cdot 10^{-78}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -4.3999999999999999e112 or 2.4e-78 < x Initial program 88.3%
Taylor expanded in x around inf 79.7%
associate-/l*82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
if -4.3999999999999999e112 < x < 2.4e-78Initial program 84.8%
Taylor expanded in z around inf 98.5%
Taylor expanded in y around 0 90.4%
Final simplification86.4%
(FPCore (x y z) :precision binary64 (if (<= y 650000.0) (+ y (/ x z)) (if (<= y 1.8e+84) (* y (/ x (- z))) (* z (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 650000.0) {
tmp = y + (x / z);
} else if (y <= 1.8e+84) {
tmp = y * (x / -z);
} else {
tmp = z * (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 (y <= 650000.0d0) then
tmp = y + (x / z)
else if (y <= 1.8d+84) then
tmp = y * (x / -z)
else
tmp = z * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 650000.0) {
tmp = y + (x / z);
} else if (y <= 1.8e+84) {
tmp = y * (x / -z);
} else {
tmp = z * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 650000.0: tmp = y + (x / z) elif y <= 1.8e+84: tmp = y * (x / -z) else: tmp = z * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 650000.0) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.8e+84) tmp = Float64(y * Float64(x / Float64(-z))); else tmp = Float64(z * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 650000.0) tmp = y + (x / z); elseif (y <= 1.8e+84) tmp = y * (x / -z); else tmp = z * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 650000.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+84], N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 650000:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+84}:\\
\;\;\;\;y \cdot \frac{x}{-z}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 6.5e5Initial program 92.9%
Taylor expanded in z around inf 96.8%
Taylor expanded in y around 0 89.8%
if 6.5e5 < y < 1.8e84Initial program 80.8%
Taylor expanded in y around inf 80.8%
associate-/l*99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in x around inf 68.3%
associate-*l/74.6%
*-commutative74.6%
neg-mul-174.6%
distribute-rgt-neg-in74.6%
distribute-neg-frac274.6%
Simplified74.6%
if 1.8e84 < y Initial program 66.6%
Taylor expanded in y around inf 66.6%
Taylor expanded in z around inf 28.6%
*-commutative28.6%
associate-/l*63.4%
Applied egg-rr63.4%
(FPCore (x y z) :precision binary64 (if (<= y 16000000000000.0) (+ y (/ x z)) (if (<= y 1.75e+84) (* x (/ y (- z))) (* z (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 16000000000000.0) {
tmp = y + (x / z);
} else if (y <= 1.75e+84) {
tmp = x * (y / -z);
} else {
tmp = z * (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 (y <= 16000000000000.0d0) then
tmp = y + (x / z)
else if (y <= 1.75d+84) then
tmp = x * (y / -z)
else
tmp = z * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 16000000000000.0) {
tmp = y + (x / z);
} else if (y <= 1.75e+84) {
tmp = x * (y / -z);
} else {
tmp = z * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 16000000000000.0: tmp = y + (x / z) elif y <= 1.75e+84: tmp = x * (y / -z) else: tmp = z * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 16000000000000.0) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.75e+84) tmp = Float64(x * Float64(y / Float64(-z))); else tmp = Float64(z * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 16000000000000.0) tmp = y + (x / z); elseif (y <= 1.75e+84) tmp = x * (y / -z); else tmp = z * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 16000000000000.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e+84], N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 16000000000000:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+84}:\\
\;\;\;\;x \cdot \frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 1.6e13Initial program 92.9%
Taylor expanded in z around inf 96.8%
Taylor expanded in y around 0 89.8%
if 1.6e13 < y < 1.7499999999999999e84Initial program 80.8%
Taylor expanded in x around inf 68.3%
associate-/l*74.2%
mul-1-neg74.2%
unsub-neg74.2%
Simplified74.2%
Taylor expanded in y around inf 74.2%
neg-mul-174.2%
Simplified74.2%
if 1.7499999999999999e84 < y Initial program 66.6%
Taylor expanded in y around inf 66.6%
Taylor expanded in z around inf 28.6%
*-commutative28.6%
associate-/l*63.4%
Applied egg-rr63.4%
Final simplification83.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.42e-8) y (if (<= y 1.12e-100) (/ x z) (* z (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.42e-8) {
tmp = y;
} else if (y <= 1.12e-100) {
tmp = x / z;
} else {
tmp = z * (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 (y <= (-1.42d-8)) then
tmp = y
else if (y <= 1.12d-100) then
tmp = x / z
else
tmp = z * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.42e-8) {
tmp = y;
} else if (y <= 1.12e-100) {
tmp = x / z;
} else {
tmp = z * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.42e-8: tmp = y elif y <= 1.12e-100: tmp = x / z else: tmp = z * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.42e-8) tmp = y; elseif (y <= 1.12e-100) tmp = Float64(x / z); else tmp = Float64(z * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.42e-8) tmp = y; elseif (y <= 1.12e-100) tmp = x / z; else tmp = z * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.42e-8], y, If[LessEqual[y, 1.12e-100], N[(x / z), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{-8}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{-100}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -1.41999999999999998e-8Initial program 80.2%
Taylor expanded in x around 0 55.9%
if -1.41999999999999998e-8 < y < 1.11999999999999996e-100Initial program 100.0%
Taylor expanded in y around 0 77.3%
if 1.11999999999999996e-100 < y Initial program 76.3%
Taylor expanded in y around inf 70.8%
Taylor expanded in z around inf 36.4%
*-commutative36.4%
associate-/l*59.2%
Applied egg-rr59.2%
(FPCore (x y z) :precision binary64 (if (<= y -2e-9) y (if (<= y 8.6e-110) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2e-9) {
tmp = y;
} else if (y <= 8.6e-110) {
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 (y <= (-2d-9)) then
tmp = y
else if (y <= 8.6d-110) 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 (y <= -2e-9) {
tmp = y;
} else if (y <= 8.6e-110) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2e-9: tmp = y elif y <= 8.6e-110: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2e-9) tmp = y; elseif (y <= 8.6e-110) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2e-9) tmp = y; elseif (y <= 8.6e-110) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2e-9], y, If[LessEqual[y, 8.6e-110], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-9}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-110}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.00000000000000012e-9 or 8.6000000000000005e-110 < y Initial program 78.3%
Taylor expanded in x around 0 56.2%
if -2.00000000000000012e-9 < y < 8.6000000000000005e-110Initial program 100.0%
Taylor expanded in y around 0 78.5%
(FPCore (x y z) :precision binary64 (if (<= y 2e+57) (+ y (/ x z)) (* z (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e+57) {
tmp = y + (x / z);
} else {
tmp = z * (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 (y <= 2d+57) then
tmp = y + (x / z)
else
tmp = z * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e+57) {
tmp = y + (x / z);
} else {
tmp = z * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e+57: tmp = y + (x / z) else: tmp = z * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e+57) tmp = Float64(y + Float64(x / z)); else tmp = Float64(z * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e+57) tmp = y + (x / z); else tmp = z * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e+57], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+57}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 2.0000000000000001e57Initial program 92.2%
Taylor expanded in z around inf 96.5%
Taylor expanded in y around 0 87.1%
if 2.0000000000000001e57 < y Initial program 68.3%
Taylor expanded in y around inf 68.3%
Taylor expanded in z around inf 26.0%
*-commutative26.0%
associate-/l*59.1%
Applied egg-rr59.1%
(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.4%
Taylor expanded in x around 0 43.9%
(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 2024160
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:alt
(! :herbie-platform default (- (+ y (/ x z)) (/ y (/ z x))))
(/ (+ x (* y (- z x))) z))