
(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 10 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 (- y (* (/ x z) (+ y -1.0))))
double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
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 + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
def code(x, y, z): return y - ((x / z) * (y + -1.0))
function code(x, y, z) return Float64(y - Float64(Float64(x / z) * Float64(y + -1.0))) end
function tmp = code(x, y, z) tmp = y - ((x / z) * (y + -1.0)); end
code[x_, y_, z_] := N[(y - N[(N[(x / z), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - \frac{x}{z} \cdot \left(y + -1\right)
\end{array}
Initial program 83.0%
Taylor expanded in x around -inf 94.0%
mul-1-neg94.0%
unsub-neg94.0%
associate-/l*97.0%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.6e+288) (and (not (<= x 6.2e+186)) (<= x 9e+265))) (* x (/ (- y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.6e+288) || (!(x <= 6.2e+186) && (x <= 9e+265))) {
tmp = x * (-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 <= (-1.6d+288)) .or. (.not. (x <= 6.2d+186)) .and. (x <= 9d+265)) then
tmp = x * (-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 <= -1.6e+288) || (!(x <= 6.2e+186) && (x <= 9e+265))) {
tmp = x * (-y / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.6e+288) or (not (x <= 6.2e+186) and (x <= 9e+265)): tmp = x * (-y / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.6e+288) || (!(x <= 6.2e+186) && (x <= 9e+265))) tmp = Float64(x * Float64(Float64(-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 <= -1.6e+288) || (~((x <= 6.2e+186)) && (x <= 9e+265))) tmp = x * (-y / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.6e+288], And[N[Not[LessEqual[x, 6.2e+186]], $MachinePrecision], LessEqual[x, 9e+265]]], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{+288} \lor \neg \left(x \leq 6.2 \cdot 10^{+186}\right) \land x \leq 9 \cdot 10^{+265}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -1.6000000000000001e288 or 6.2000000000000002e186 < x < 8.9999999999999997e265Initial program 74.6%
Taylor expanded in y around inf 65.5%
associate-/l*90.8%
associate-/r/90.7%
Simplified90.7%
Taylor expanded in z around 0 65.9%
mul-1-neg65.9%
associate-*r/86.8%
distribute-rgt-neg-in86.8%
distribute-neg-frac86.8%
Simplified86.8%
if -1.6000000000000001e288 < x < 6.2000000000000002e186 or 8.9999999999999997e265 < x Initial program 83.8%
Taylor expanded in y around inf 80.0%
Taylor expanded in z around inf 81.3%
Final simplification81.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.6e+31) (not (<= y 1.0))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.6e+31) || !(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 <= (-6.6d+31)) .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 <= -6.6e+31) || !(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 <= -6.6e+31) 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 <= -6.6e+31) || !(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 <= -6.6e+31) || ~((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, -6.6e+31], 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 -6.6 \cdot 10^{+31} \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 < -6.59999999999999985e31 or 1 < y Initial program 66.9%
Taylor expanded in x around -inf 88.3%
mul-1-neg88.3%
unsub-neg88.3%
associate-/l*94.2%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 99.9%
if -6.59999999999999985e31 < y < 1Initial program 99.9%
Taylor expanded in y around inf 96.7%
Taylor expanded in z around inf 98.3%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y -6.6e+31) (* y (- 1.0 (/ 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 <= -6.6e+31) {
tmp = y * (1.0 - (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 <= (-6.6d+31)) then
tmp = y * (1.0d0 - (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 <= -6.6e+31) {
tmp = y * (1.0 - (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 <= -6.6e+31: tmp = y * (1.0 - (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 <= -6.6e+31) tmp = Float64(y * Float64(1.0 - 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 <= -6.6e+31) tmp = y * (1.0 - (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, -6.6e+31], N[(y * N[(1.0 - 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 -6.6 \cdot 10^{+31}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\end{array}
\end{array}
if y < -6.59999999999999985e31Initial program 72.8%
Taylor expanded in x around -inf 94.1%
mul-1-neg94.1%
unsub-neg94.1%
associate-/l*94.3%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -6.59999999999999985e31 < y < 1Initial program 99.9%
Taylor expanded in y around inf 96.7%
Taylor expanded in z around inf 98.3%
if 1 < y Initial program 60.9%
Taylor expanded in y around inf 60.9%
associate-/l*99.8%
Simplified99.8%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y -1e+32) (* y (- 1.0 (/ x z))) (- y (* x (/ (+ y -1.0) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1e+32) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y - (x * ((y + -1.0) / 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 <= (-1d+32)) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y - (x * ((y + (-1.0d0)) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1e+32) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y - (x * ((y + -1.0) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1e+32: tmp = y * (1.0 - (x / z)) else: tmp = y - (x * ((y + -1.0) / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1e+32) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y - Float64(x * Float64(Float64(y + -1.0) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1e+32) tmp = y * (1.0 - (x / z)); else tmp = y - (x * ((y + -1.0) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1e+32], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y - N[(x * N[(N[(y + -1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+32}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y - x \cdot \frac{y + -1}{z}\\
\end{array}
\end{array}
if y < -1.00000000000000005e32Initial program 72.8%
Taylor expanded in x around -inf 94.1%
mul-1-neg94.1%
unsub-neg94.1%
associate-/l*94.3%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -1.00000000000000005e32 < y Initial program 86.5%
Taylor expanded in x around -inf 94.0%
mul-1-neg94.0%
unsub-neg94.0%
associate-/l*98.0%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 94.0%
sub-neg94.0%
metadata-eval94.0%
associate-*r/97.8%
Simplified97.8%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.55e+286) (not (<= x 4.4e+186))) (/ y (/ (- z) x)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55e+286) || !(x <= 4.4e+186)) {
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 <= (-1.55d+286)) .or. (.not. (x <= 4.4d+186))) 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 <= -1.55e+286) || !(x <= 4.4e+186)) {
tmp = y / (-z / x);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.55e+286) or not (x <= 4.4e+186): tmp = y / (-z / x) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.55e+286) || !(x <= 4.4e+186)) 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 <= -1.55e+286) || ~((x <= 4.4e+186))) tmp = y / (-z / x); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.55e+286], N[Not[LessEqual[x, 4.4e+186]], $MachinePrecision]], N[(y / N[((-z) / x), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+286} \lor \neg \left(x \leq 4.4 \cdot 10^{+186}\right):\\
\;\;\;\;\frac{y}{\frac{-z}{x}}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -1.54999999999999996e286 or 4.3999999999999997e186 < x Initial program 80.7%
Taylor expanded in y around inf 55.1%
associate-/l*77.0%
associate-/r/74.0%
Simplified74.0%
Taylor expanded in z around 0 55.3%
mul-1-neg55.3%
associate-*r/71.5%
distribute-rgt-neg-in71.5%
distribute-neg-frac71.5%
Simplified71.5%
associate-*r/55.3%
frac-2neg55.3%
*-commutative55.3%
distribute-lft-neg-in55.3%
remove-double-neg55.3%
Applied egg-rr55.3%
associate-/l*74.4%
Simplified74.4%
if -1.54999999999999996e286 < x < 4.3999999999999997e186Initial program 83.3%
Taylor expanded in y around inf 81.1%
Taylor expanded in z around inf 82.1%
Final simplification81.0%
(FPCore (x y z) :precision binary64 (if (<= x -3.2e+286) (* x (/ (- y) z)) (if (<= x 5.2e+186) (+ y (/ x z)) (* (/ x z) (- y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.2e+286) {
tmp = x * (-y / z);
} else if (x <= 5.2e+186) {
tmp = y + (x / z);
} else {
tmp = (x / z) * -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 <= (-3.2d+286)) then
tmp = x * (-y / z)
else if (x <= 5.2d+186) then
tmp = y + (x / z)
else
tmp = (x / z) * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.2e+286) {
tmp = x * (-y / z);
} else if (x <= 5.2e+186) {
tmp = y + (x / z);
} else {
tmp = (x / z) * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.2e+286: tmp = x * (-y / z) elif x <= 5.2e+186: tmp = y + (x / z) else: tmp = (x / z) * -y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.2e+286) tmp = Float64(x * Float64(Float64(-y) / z)); elseif (x <= 5.2e+186) tmp = Float64(y + Float64(x / z)); else tmp = Float64(Float64(x / z) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.2e+286) tmp = x * (-y / z); elseif (x <= 5.2e+186) tmp = y + (x / z); else tmp = (x / z) * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.2e+286], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e+186], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{+286}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+186}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\end{array}
\end{array}
if x < -3.1999999999999999e286Initial program 65.7%
Taylor expanded in y around inf 65.7%
associate-/l*100.0%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around 0 65.7%
mul-1-neg65.7%
associate-*r/99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac99.8%
Simplified99.8%
if -3.1999999999999999e286 < x < 5.2000000000000001e186Initial program 83.3%
Taylor expanded in y around inf 81.1%
Taylor expanded in z around inf 82.1%
if 5.2000000000000001e186 < x Initial program 85.4%
Taylor expanded in y around inf 51.8%
associate-/l*69.9%
associate-/r/66.1%
Simplified66.1%
Taylor expanded in z around 0 52.1%
mul-1-neg52.1%
associate-*r/62.8%
distribute-rgt-neg-in62.8%
distribute-neg-frac62.8%
Simplified62.8%
Taylor expanded in x around 0 52.1%
mul-1-neg52.1%
associate-*l/66.4%
distribute-lft-neg-in66.4%
*-commutative66.4%
distribute-neg-frac66.4%
Simplified66.4%
Final simplification81.0%
(FPCore (x y z) :precision binary64 (if (<= y -5.2e-22) y (if (<= y 0.000155) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e-22) {
tmp = y;
} else if (y <= 0.000155) {
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 <= (-5.2d-22)) then
tmp = y
else if (y <= 0.000155d0) 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 <= -5.2e-22) {
tmp = y;
} else if (y <= 0.000155) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.2e-22: tmp = y elif y <= 0.000155: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.2e-22) tmp = y; elseif (y <= 0.000155) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.2e-22) tmp = y; elseif (y <= 0.000155) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.2e-22], y, If[LessEqual[y, 0.000155], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-22}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 0.000155:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -5.2e-22 or 1.55e-4 < y Initial program 69.4%
Taylor expanded in x around 0 51.6%
if -5.2e-22 < y < 1.55e-4Initial program 99.9%
Taylor expanded in y around 0 75.9%
Final simplification62.4%
(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 83.0%
Taylor expanded in y around inf 78.7%
Taylor expanded in z around inf 77.0%
Final simplification77.0%
(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 83.0%
Taylor expanded in x around 0 40.3%
Final simplification40.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 2023300
(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))