
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e-85) (not (<= z 2.9e+110))) (+ 1.0 (* z (/ -4.0 y))) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e-85) || !(z <= 2.9e+110)) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = 2.0;
}
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 <= (-4.2d-85)) .or. (.not. (z <= 2.9d+110))) then
tmp = 1.0d0 + (z * ((-4.0d0) / y))
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e-85) || !(z <= 2.9e+110)) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e-85) or not (z <= 2.9e+110): tmp = 1.0 + (z * (-4.0 / y)) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e-85) || !(z <= 2.9e+110)) tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y))); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.2e-85) || ~((z <= 2.9e+110))) tmp = 1.0 + (z * (-4.0 / y)); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e-85], N[Not[LessEqual[z, 2.9e+110]], $MachinePrecision]], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-85} \lor \neg \left(z \leq 2.9 \cdot 10^{+110}\right):\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if z < -4.2e-85 or 2.9e110 < z Initial program 100.0%
Taylor expanded in z around inf 71.8%
associate-*r/71.8%
metadata-eval71.8%
associate-*r*71.8%
neg-mul-171.8%
associate-*l/71.6%
*-commutative71.6%
distribute-lft-neg-out71.6%
distribute-rgt-neg-in71.6%
distribute-neg-frac71.6%
metadata-eval71.6%
Simplified71.6%
if -4.2e-85 < z < 2.9e110Initial program 100.0%
Taylor expanded in y around inf 39.9%
Final simplification55.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.8e+51) (not (<= z 1.7e+77))) (+ 1.0 (* z (/ -4.0 y))) (+ 1.0 (/ (* 4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+51) || !(z <= 1.7e+77)) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = 1.0 + ((4.0 * x) / 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 ((z <= (-1.8d+51)) .or. (.not. (z <= 1.7d+77))) then
tmp = 1.0d0 + (z * ((-4.0d0) / y))
else
tmp = 1.0d0 + ((4.0d0 * x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+51) || !(z <= 1.7e+77)) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = 1.0 + ((4.0 * x) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.8e+51) or not (z <= 1.7e+77): tmp = 1.0 + (z * (-4.0 / y)) else: tmp = 1.0 + ((4.0 * x) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.8e+51) || !(z <= 1.7e+77)) tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y))); else tmp = Float64(1.0 + Float64(Float64(4.0 * x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.8e+51) || ~((z <= 1.7e+77))) tmp = 1.0 + (z * (-4.0 / y)); else tmp = 1.0 + ((4.0 * x) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e+51], N[Not[LessEqual[z, 1.7e+77]], $MachinePrecision]], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+51} \lor \neg \left(z \leq 1.7 \cdot 10^{+77}\right):\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if z < -1.80000000000000005e51 or 1.69999999999999998e77 < z Initial program 100.0%
Taylor expanded in z around inf 80.2%
associate-*r/80.2%
metadata-eval80.2%
associate-*r*80.2%
neg-mul-180.2%
associate-*l/80.0%
*-commutative80.0%
distribute-lft-neg-out80.0%
distribute-rgt-neg-in80.0%
distribute-neg-frac80.0%
metadata-eval80.0%
Simplified80.0%
if -1.80000000000000005e51 < z < 1.69999999999999998e77Initial program 100.0%
Taylor expanded in x around inf 59.8%
associate-*r/59.8%
Simplified59.8%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.4e+51) (not (<= z 1.15e+71))) (+ 1.0 (/ (* z -4.0) y)) (+ 1.0 (/ (* 4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.4e+51) || !(z <= 1.15e+71)) {
tmp = 1.0 + ((z * -4.0) / y);
} else {
tmp = 1.0 + ((4.0 * x) / 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 ((z <= (-4.4d+51)) .or. (.not. (z <= 1.15d+71))) then
tmp = 1.0d0 + ((z * (-4.0d0)) / y)
else
tmp = 1.0d0 + ((4.0d0 * x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.4e+51) || !(z <= 1.15e+71)) {
tmp = 1.0 + ((z * -4.0) / y);
} else {
tmp = 1.0 + ((4.0 * x) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.4e+51) or not (z <= 1.15e+71): tmp = 1.0 + ((z * -4.0) / y) else: tmp = 1.0 + ((4.0 * x) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.4e+51) || !(z <= 1.15e+71)) tmp = Float64(1.0 + Float64(Float64(z * -4.0) / y)); else tmp = Float64(1.0 + Float64(Float64(4.0 * x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.4e+51) || ~((z <= 1.15e+71))) tmp = 1.0 + ((z * -4.0) / y); else tmp = 1.0 + ((4.0 * x) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.4e+51], N[Not[LessEqual[z, 1.15e+71]], $MachinePrecision]], N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+51} \lor \neg \left(z \leq 1.15 \cdot 10^{+71}\right):\\
\;\;\;\;1 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if z < -4.39999999999999984e51 or 1.1500000000000001e71 < z Initial program 100.0%
Taylor expanded in z around inf 80.2%
*-commutative80.2%
associate-*l/80.2%
Simplified80.2%
if -4.39999999999999984e51 < z < 1.1500000000000001e71Initial program 100.0%
Taylor expanded in x around inf 59.8%
associate-*r/59.8%
Simplified59.8%
Final simplification67.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.15e+119) (not (<= z 1.5e+111))) (+ 1.0 (/ (* z -4.0) y)) (+ 2.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+119) || !(z <= 1.5e+111)) {
tmp = 1.0 + ((z * -4.0) / y);
} else {
tmp = 2.0 + (4.0 * (x / 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 ((z <= (-1.15d+119)) .or. (.not. (z <= 1.5d+111))) then
tmp = 1.0d0 + ((z * (-4.0d0)) / y)
else
tmp = 2.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+119) || !(z <= 1.5e+111)) {
tmp = 1.0 + ((z * -4.0) / y);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.15e+119) or not (z <= 1.5e+111): tmp = 1.0 + ((z * -4.0) / y) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.15e+119) || !(z <= 1.5e+111)) tmp = Float64(1.0 + Float64(Float64(z * -4.0) / y)); else tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.15e+119) || ~((z <= 1.5e+111))) tmp = 1.0 + ((z * -4.0) / y); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.15e+119], N[Not[LessEqual[z, 1.5e+111]], $MachinePrecision]], N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+119} \lor \neg \left(z \leq 1.5 \cdot 10^{+111}\right):\\
\;\;\;\;1 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -1.15e119 or 1.5e111 < z Initial program 100.0%
Taylor expanded in z around inf 89.1%
*-commutative89.1%
associate-*l/89.1%
Simplified89.1%
if -1.15e119 < z < 1.5e111Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
div-inv99.7%
metadata-eval99.7%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 86.3%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.8e+44) (not (<= z 2.3e+68))) (+ 2.0 (/ (* z -4.0) y)) (+ 2.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.8e+44) || !(z <= 2.3e+68)) {
tmp = 2.0 + ((z * -4.0) / y);
} else {
tmp = 2.0 + (4.0 * (x / 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 ((z <= (-4.8d+44)) .or. (.not. (z <= 2.3d+68))) then
tmp = 2.0d0 + ((z * (-4.0d0)) / y)
else
tmp = 2.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.8e+44) || !(z <= 2.3e+68)) {
tmp = 2.0 + ((z * -4.0) / y);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.8e+44) or not (z <= 2.3e+68): tmp = 2.0 + ((z * -4.0) / y) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.8e+44) || !(z <= 2.3e+68)) tmp = Float64(2.0 + Float64(Float64(z * -4.0) / y)); else tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.8e+44) || ~((z <= 2.3e+68))) tmp = 2.0 + ((z * -4.0) / y); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.8e+44], N[Not[LessEqual[z, 2.3e+68]], $MachinePrecision]], N[(2.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+44} \lor \neg \left(z \leq 2.3 \cdot 10^{+68}\right):\\
\;\;\;\;2 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -4.80000000000000026e44 or 2.3e68 < z Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+l+99.8%
associate-*l/99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
*-rgt-identity99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
div-inv99.8%
metadata-eval99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 93.4%
associate-*r/93.4%
Simplified93.4%
if -4.80000000000000026e44 < z < 2.3e68Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
div-inv99.7%
metadata-eval99.7%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 88.4%
Final simplification90.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e-85) (not (<= z 2.9e+110))) (* -4.0 (/ z y)) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e-85) || !(z <= 2.9e+110)) {
tmp = -4.0 * (z / y);
} else {
tmp = 2.0;
}
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 <= (-4.2d-85)) .or. (.not. (z <= 2.9d+110))) then
tmp = (-4.0d0) * (z / y)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e-85) || !(z <= 2.9e+110)) {
tmp = -4.0 * (z / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e-85) or not (z <= 2.9e+110): tmp = -4.0 * (z / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e-85) || !(z <= 2.9e+110)) tmp = Float64(-4.0 * Float64(z / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.2e-85) || ~((z <= 2.9e+110))) tmp = -4.0 * (z / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e-85], N[Not[LessEqual[z, 2.9e+110]], $MachinePrecision]], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-85} \lor \neg \left(z \leq 2.9 \cdot 10^{+110}\right):\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if z < -4.2e-85 or 2.9e110 < z Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
div-inv99.7%
metadata-eval99.7%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 84.0%
associate-*r/84.0%
Simplified84.0%
Taylor expanded in z around inf 69.6%
if -4.2e-85 < z < 2.9e110Initial program 100.0%
Taylor expanded in y around inf 39.9%
Final simplification54.0%
(FPCore (x y z) :precision binary64 (+ 2.0 (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 + ((x - z) * (4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
def code(x, y, z): return 2.0 + ((x - z) * (4.0 / y))
function code(x, y, z) return Float64(2.0 + Float64(Float64(x - z) * Float64(4.0 / y))) end
function tmp = code(x, y, z) tmp = 2.0 + ((x - z) * (4.0 / y)); end
code[x_, y_, z_] := N[(2.0 + N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \left(x - z\right) \cdot \frac{4}{y}
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (+ (/ (- x z) (* y 0.25)) 2.0))
double code(double x, double y, double z) {
return ((x - z) / (y * 0.25)) + 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - z) / (y * 0.25d0)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return ((x - z) / (y * 0.25)) + 2.0;
}
def code(x, y, z): return ((x - z) / (y * 0.25)) + 2.0
function code(x, y, z) return Float64(Float64(Float64(x - z) / Float64(y * 0.25)) + 2.0) end
function tmp = code(x, y, z) tmp = ((x - z) / (y * 0.25)) + 2.0; end
code[x_, y_, z_] := N[(N[(N[(x - z), $MachinePrecision] / N[(y * 0.25), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - z}{y \cdot 0.25} + 2
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
div-inv99.7%
metadata-eval99.7%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 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 = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in z around inf 42.8%
associate-*r/42.8%
metadata-eval42.8%
associate-*r*42.8%
neg-mul-142.8%
associate-*l/42.7%
*-commutative42.7%
distribute-lft-neg-out42.7%
distribute-rgt-neg-in42.7%
distribute-neg-frac42.7%
metadata-eval42.7%
Simplified42.7%
Taylor expanded in z around 0 7.1%
Final simplification7.1%
(FPCore (x y z) :precision binary64 2.0)
double code(double x, double y, double z) {
return 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0
end function
public static double code(double x, double y, double z) {
return 2.0;
}
def code(x, y, z): return 2.0
function code(x, y, z) return 2.0 end
function tmp = code(x, y, z) tmp = 2.0; end
code[x_, y_, z_] := 2.0
\begin{array}{l}
\\
2
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 28.3%
Final simplification28.3%
herbie shell --seed 2024039
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, C"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))