
(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 -1.1e+22) (not (<= z 1.5e-77))) (- y (* x (/ (+ y -1.0) z))) (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1e+22) || !(z <= 1.5e-77)) {
tmp = y - (x * ((y + -1.0) / 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 <= (-1.1d+22)) .or. (.not. (z <= 1.5d-77))) then
tmp = y - (x * ((y + (-1.0d0)) / 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 <= -1.1e+22) || !(z <= 1.5e-77)) {
tmp = y - (x * ((y + -1.0) / z));
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.1e+22) or not (z <= 1.5e-77): tmp = y - (x * ((y + -1.0) / z)) else: tmp = (x + (y * (z - x))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.1e+22) || !(z <= 1.5e-77)) tmp = Float64(y - Float64(x * Float64(Float64(y + -1.0) / 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 <= -1.1e+22) || ~((z <= 1.5e-77))) tmp = y - (x * ((y + -1.0) / z)); else tmp = (x + (y * (z - x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.1e+22], N[Not[LessEqual[z, 1.5e-77]], $MachinePrecision]], N[(y - N[(x * N[(N[(y + -1.0), $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 -1.1 \cdot 10^{+22} \lor \neg \left(z \leq 1.5 \cdot 10^{-77}\right):\\
\;\;\;\;y - x \cdot \frac{y + -1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}
\end{array}
if z < -1.1e22 or 1.50000000000000008e-77 < z Initial program 74.8%
Taylor expanded in y around inf 74.8%
Taylor expanded in z around -inf 92.1%
mul-1-neg92.1%
unsub-neg92.1%
distribute-rgt-out92.1%
*-lft-identity92.1%
times-frac99.9%
/-rgt-identity99.9%
+-commutative99.9%
Simplified99.9%
if -1.1e22 < z < 1.50000000000000008e-77Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.02e+155) (not (<= y 220000000.0))) (* y (/ (- z x) z)) (- y (* x (/ (+ y -1.0) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.02e+155) || !(y <= 220000000.0)) {
tmp = y * ((z - 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 <= (-1.02d+155)) .or. (.not. (y <= 220000000.0d0))) then
tmp = y * ((z - 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 <= -1.02e+155) || !(y <= 220000000.0)) {
tmp = y * ((z - x) / z);
} else {
tmp = y - (x * ((y + -1.0) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.02e+155) or not (y <= 220000000.0): tmp = y * ((z - x) / z) else: tmp = y - (x * ((y + -1.0) / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.02e+155) || !(y <= 220000000.0)) tmp = Float64(y * Float64(Float64(z - 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 <= -1.02e+155) || ~((y <= 220000000.0))) tmp = y * ((z - x) / z); else tmp = y - (x * ((y + -1.0) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.02e+155], N[Not[LessEqual[y, 220000000.0]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $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.02 \cdot 10^{+155} \lor \neg \left(y \leq 220000000\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - x \cdot \frac{y + -1}{z}\\
\end{array}
\end{array}
if y < -1.02e155 or 2.2e8 < y Initial program 72.8%
Taylor expanded in y around inf 72.8%
*-commutative72.8%
associate-/l*87.9%
Simplified87.9%
associate-/r/99.9%
Applied egg-rr99.9%
if -1.02e155 < y < 2.2e8Initial program 96.2%
Taylor expanded in y around inf 91.7%
Taylor expanded in z around -inf 99.4%
mul-1-neg99.4%
unsub-neg99.4%
distribute-rgt-out99.3%
*-lft-identity99.3%
times-frac99.8%
/-rgt-identity99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.96) (not (<= x 1.04e+139))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.96) || !(x <= 1.04e+139)) {
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 <= (-0.96d0)) .or. (.not. (x <= 1.04d+139))) 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 <= -0.96) || !(x <= 1.04e+139)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.96) or not (x <= 1.04e+139): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.96) || !(x <= 1.04e+139)) 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 <= -0.96) || ~((x <= 1.04e+139))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.96], N[Not[LessEqual[x, 1.04e+139]], $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 -0.96 \lor \neg \left(x \leq 1.04 \cdot 10^{+139}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -0.95999999999999996 or 1.04e139 < x Initial program 87.7%
Taylor expanded in x around inf 82.0%
associate-/l*86.5%
associate-/r/86.6%
mul-1-neg86.6%
unsub-neg86.6%
Simplified86.6%
if -0.95999999999999996 < x < 1.04e139Initial program 86.6%
Taylor expanded in z around inf 73.4%
Taylor expanded in x around 0 86.8%
+-commutative86.8%
Simplified86.8%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4e+15) (not (<= y 1.0))) (* y (/ (- z x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+15) || !(y <= 1.0)) {
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 <= (-2.4d+15)) .or. (.not. (y <= 1.0d0))) 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 <= -2.4e+15) || !(y <= 1.0)) {
tmp = y * ((z - x) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4e+15) or not (y <= 1.0): tmp = y * ((z - x) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4e+15) || !(y <= 1.0)) 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 <= -2.4e+15) || ~((y <= 1.0))) tmp = y * ((z - x) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4e+15], N[Not[LessEqual[y, 1.0]], $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 -2.4 \cdot 10^{+15} \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.4e15 or 1 < y Initial program 74.4%
Taylor expanded in y around inf 73.5%
*-commutative73.5%
associate-/l*89.8%
Simplified89.8%
associate-/r/99.0%
Applied egg-rr99.0%
if -2.4e15 < y < 1Initial program 99.9%
Taylor expanded in z around inf 99.2%
Taylor expanded in x around 0 99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y 220000000.0) (+ y (/ (* (- 1.0 y) x) z)) (* y (/ (- z x) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 220000000.0) {
tmp = y + (((1.0 - 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 <= 220000000.0d0) then
tmp = y + (((1.0d0 - 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 <= 220000000.0) {
tmp = y + (((1.0 - y) * x) / z);
} else {
tmp = y * ((z - x) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 220000000.0: tmp = y + (((1.0 - y) * x) / z) else: tmp = y * ((z - x) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 220000000.0) tmp = Float64(y + Float64(Float64(Float64(1.0 - y) * 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 <= 220000000.0) tmp = y + (((1.0 - y) * x) / z); else tmp = y * ((z - x) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 220000000.0], N[(y + N[(N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 220000000:\\
\;\;\;\;y + \frac{\left(1 - y\right) \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\end{array}
\end{array}
if y < 2.2e8Initial program 93.3%
Taylor expanded in x around inf 98.5%
if 2.2e8 < y Initial program 70.4%
Taylor expanded in y around inf 70.4%
*-commutative70.4%
associate-/l*89.2%
Simplified89.2%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= x 7e+270) (+ y (/ x z)) (* y (/ (- x) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= 7e+270) {
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 <= 7d+270) 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 <= 7e+270) {
tmp = y + (x / z);
} else {
tmp = y * (-x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 7e+270: tmp = y + (x / z) else: tmp = y * (-x / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 7e+270) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(Float64(-x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 7e+270) tmp = y + (x / z); else tmp = y * (-x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 7e+270], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{+270}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{-x}{z}\\
\end{array}
\end{array}
if x < 6.9999999999999999e270Initial program 87.3%
Taylor expanded in z around inf 67.7%
Taylor expanded in x around 0 77.8%
+-commutative77.8%
Simplified77.8%
if 6.9999999999999999e270 < x Initial program 80.9%
Taylor expanded in y around inf 60.9%
*-commutative60.9%
associate-/l*80.0%
Simplified80.0%
associate-/r/79.7%
Applied egg-rr79.7%
Taylor expanded in z around 0 60.9%
mul-1-neg60.9%
associate-*l/79.9%
distribute-rgt-neg-out79.9%
associate-*l/60.9%
associate-*r/79.7%
Simplified79.7%
Final simplification77.9%
(FPCore (x y z) :precision binary64 (if (<= x 5.4e+268) (+ y (/ x z)) (* x (- (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5.4e+268) {
tmp = y + (x / z);
} else {
tmp = x * -(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 (x <= 5.4d+268) then
tmp = y + (x / z)
else
tmp = x * -(y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 5.4e+268) {
tmp = y + (x / z);
} else {
tmp = x * -(y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 5.4e+268: tmp = y + (x / z) else: tmp = x * -(y / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 5.4e+268) tmp = Float64(y + Float64(x / z)); else tmp = Float64(x * Float64(-Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 5.4e+268) tmp = y + (x / z); else tmp = x * -(y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 5.4e+268], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-N[(y / z), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.4 \cdot 10^{+268}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-\frac{y}{z}\right)\\
\end{array}
\end{array}
if x < 5.40000000000000022e268Initial program 87.3%
Taylor expanded in z around inf 67.7%
Taylor expanded in x around 0 77.8%
+-commutative77.8%
Simplified77.8%
if 5.40000000000000022e268 < x Initial program 80.9%
Taylor expanded in y around inf 60.9%
*-commutative60.9%
associate-/l*80.0%
Simplified80.0%
associate-/r/79.7%
Applied egg-rr79.7%
Taylor expanded in z around 0 60.9%
mul-1-neg60.9%
associate-*l/79.9%
distribute-rgt-neg-out79.9%
Simplified79.9%
Final simplification77.9%
(FPCore (x y z) :precision binary64 (if (<= y -0.0005) y (if (<= y 1.65e-52) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.0005) {
tmp = y;
} else if (y <= 1.65e-52) {
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 <= (-0.0005d0)) then
tmp = y
else if (y <= 1.65d-52) 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 <= -0.0005) {
tmp = y;
} else if (y <= 1.65e-52) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -0.0005: tmp = y elif y <= 1.65e-52: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -0.0005) tmp = y; elseif (y <= 1.65e-52) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -0.0005) tmp = y; elseif (y <= 1.65e-52) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -0.0005], y, If[LessEqual[y, 1.65e-52], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0005:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -5.0000000000000001e-4 or 1.64999999999999998e-52 < y Initial program 76.5%
Taylor expanded in x around 0 52.0%
if -5.0000000000000001e-4 < y < 1.64999999999999998e-52Initial program 99.9%
Taylor expanded in y around 0 71.6%
Final simplification60.8%
(FPCore (x y z) :precision binary64 (if (<= y -0.00048) (* z (/ y z)) (if (<= y 3.3e-52) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.00048) {
tmp = z * (y / z);
} else if (y <= 3.3e-52) {
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 <= (-0.00048d0)) then
tmp = z * (y / z)
else if (y <= 3.3d-52) 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 <= -0.00048) {
tmp = z * (y / z);
} else if (y <= 3.3e-52) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -0.00048: tmp = z * (y / z) elif y <= 3.3e-52: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -0.00048) tmp = Float64(z * Float64(y / z)); elseif (y <= 3.3e-52) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -0.00048) tmp = z * (y / z); elseif (y <= 3.3e-52) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -0.00048], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e-52], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00048:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -4.80000000000000012e-4Initial program 79.8%
Taylor expanded in z around inf 43.4%
Taylor expanded in x around 0 34.4%
*-commutative34.4%
Simplified34.4%
associate-/l*50.3%
div-inv51.8%
clear-num51.9%
Applied egg-rr51.9%
if -4.80000000000000012e-4 < y < 3.29999999999999995e-52Initial program 99.9%
Taylor expanded in y around 0 71.6%
if 3.29999999999999995e-52 < y Initial program 74.1%
Taylor expanded in x around 0 53.4%
Final simplification61.2%
(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 87.1%
Taylor expanded in z around inf 66.4%
Taylor expanded in x around 0 76.1%
+-commutative76.1%
Simplified76.1%
Final simplification76.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 87.1%
Taylor expanded in x around 0 41.9%
Final simplification41.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 2023238
(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))