
(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 9 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%
(FPCore (x y z)
:precision binary64
(if (<= y -1.25e+138)
2.0
(if (<= y 4.6e-153)
(* (/ z y) -4.0)
(if (<= y 3.8e+44) (/ (* 4.0 x) y) 2.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e+138) {
tmp = 2.0;
} else if (y <= 4.6e-153) {
tmp = (z / y) * -4.0;
} else if (y <= 3.8e+44) {
tmp = (4.0 * x) / 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 (y <= (-1.25d+138)) then
tmp = 2.0d0
else if (y <= 4.6d-153) then
tmp = (z / y) * (-4.0d0)
else if (y <= 3.8d+44) then
tmp = (4.0d0 * x) / y
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e+138) {
tmp = 2.0;
} else if (y <= 4.6e-153) {
tmp = (z / y) * -4.0;
} else if (y <= 3.8e+44) {
tmp = (4.0 * x) / y;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.25e+138: tmp = 2.0 elif y <= 4.6e-153: tmp = (z / y) * -4.0 elif y <= 3.8e+44: tmp = (4.0 * x) / y else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.25e+138) tmp = 2.0; elseif (y <= 4.6e-153) tmp = Float64(Float64(z / y) * -4.0); elseif (y <= 3.8e+44) tmp = Float64(Float64(4.0 * x) / y); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.25e+138) tmp = 2.0; elseif (y <= 4.6e-153) tmp = (z / y) * -4.0; elseif (y <= 3.8e+44) tmp = (4.0 * x) / y; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.25e+138], 2.0, If[LessEqual[y, 4.6e-153], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[y, 3.8e+44], N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision], 2.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+138}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-153}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+44}:\\
\;\;\;\;\frac{4 \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.25000000000000004e138 or 3.8000000000000002e44 < y Initial program 100.0%
Taylor expanded in y around inf 82.2%
if -1.25000000000000004e138 < y < 4.59999999999999994e-153Initial program 100.0%
Taylor expanded in z around inf 62.3%
*-commutative62.3%
Simplified62.3%
if 4.59999999999999994e-153 < y < 3.8000000000000002e44Initial program 100.0%
Taylor expanded in x around inf 55.2%
associate-*r/55.2%
Simplified55.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -4e+110) (not (<= y 8.5e+44))) (+ 2.0 (* (/ z y) -4.0)) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4e+110) || !(y <= 8.5e+44)) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 4.0 * ((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 ((y <= (-4d+110)) .or. (.not. (y <= 8.5d+44))) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
else
tmp = 4.0d0 * ((x - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4e+110) || !(y <= 8.5e+44)) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4e+110) or not (y <= 8.5e+44): tmp = 2.0 + ((z / y) * -4.0) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4e+110) || !(y <= 8.5e+44)) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); else tmp = Float64(4.0 * Float64(Float64(x - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4e+110) || ~((y <= 8.5e+44))) tmp = 2.0 + ((z / y) * -4.0); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4e+110], N[Not[LessEqual[y, 8.5e+44]], $MachinePrecision]], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+110} \lor \neg \left(y \leq 8.5 \cdot 10^{+44}\right):\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -4.0000000000000001e110 or 8.5e44 < y Initial program 100.0%
+-commutative100.0%
associate-*l/99.9%
+-commutative99.9%
associate--l+99.9%
+-commutative99.9%
distribute-lft-in99.9%
associate-+l+99.9%
associate-*l/99.9%
*-commutative99.9%
associate-*r*99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 91.3%
*-commutative91.3%
Simplified91.3%
if -4.0000000000000001e110 < y < 8.5e44Initial program 100.0%
Taylor expanded in y around 0 91.4%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (<= y -6.5e+110) (+ 2.0 (* (/ z y) -4.0)) (if (<= y 1.3e+45) (* 4.0 (/ (- x z) y)) (+ 2.0 (* x (/ 4.0 y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e+110) {
tmp = 2.0 + ((z / y) * -4.0);
} else if (y <= 1.3e+45) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0 + (x * (4.0 / 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 <= (-6.5d+110)) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
else if (y <= 1.3d+45) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 2.0d0 + (x * (4.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e+110) {
tmp = 2.0 + ((z / y) * -4.0);
} else if (y <= 1.3e+45) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.5e+110: tmp = 2.0 + ((z / y) * -4.0) elif y <= 1.3e+45: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.5e+110) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); elseif (y <= 1.3e+45) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(2.0 + Float64(x * Float64(4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.5e+110) tmp = 2.0 + ((z / y) * -4.0); elseif (y <= 1.3e+45) tmp = 4.0 * ((x - z) / y); else tmp = 2.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.5e+110], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+45], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+110}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+45}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if y < -6.4999999999999997e110Initial program 99.9%
+-commutative99.9%
associate-*l/99.9%
+-commutative99.9%
associate--l+99.9%
+-commutative99.9%
distribute-lft-in99.9%
associate-+l+99.9%
associate-*l/99.9%
*-commutative99.9%
associate-*r*99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 95.3%
*-commutative95.3%
Simplified95.3%
if -6.4999999999999997e110 < y < 1.30000000000000004e45Initial program 100.0%
Taylor expanded in y around 0 91.4%
if 1.30000000000000004e45 < y Initial program 100.0%
+-commutative100.0%
associate-*l/99.9%
+-commutative99.9%
associate--l+99.9%
+-commutative99.9%
distribute-lft-in99.8%
associate-+l+99.9%
associate-*l/99.9%
*-commutative99.9%
associate-*r*99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 89.2%
Final simplification91.5%
(FPCore (x y z) :precision binary64 (if (<= y -1.35e+138) 2.0 (if (<= y 1.3e+45) (* 4.0 (/ (- x z) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.35e+138) {
tmp = 2.0;
} else if (y <= 1.3e+45) {
tmp = 4.0 * ((x - 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 (y <= (-1.35d+138)) then
tmp = 2.0d0
else if (y <= 1.3d+45) then
tmp = 4.0d0 * ((x - 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 (y <= -1.35e+138) {
tmp = 2.0;
} else if (y <= 1.3e+45) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.35e+138: tmp = 2.0 elif y <= 1.3e+45: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.35e+138) tmp = 2.0; elseif (y <= 1.3e+45) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.35e+138) tmp = 2.0; elseif (y <= 1.3e+45) tmp = 4.0 * ((x - z) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.35e+138], 2.0, If[LessEqual[y, 1.3e+45], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+138}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+45}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.35000000000000004e138 or 1.30000000000000004e45 < y Initial program 100.0%
Taylor expanded in y around inf 82.2%
if -1.35000000000000004e138 < y < 1.30000000000000004e45Initial program 100.0%
Taylor expanded in y around 0 91.0%
(FPCore (x y z) :precision binary64 (if (<= y -1.16e+138) 2.0 (if (<= y 5.8e+44) (* (/ z y) -4.0) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.16e+138) {
tmp = 2.0;
} else if (y <= 5.8e+44) {
tmp = (z / y) * -4.0;
} 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 (y <= (-1.16d+138)) then
tmp = 2.0d0
else if (y <= 5.8d+44) then
tmp = (z / y) * (-4.0d0)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.16e+138) {
tmp = 2.0;
} else if (y <= 5.8e+44) {
tmp = (z / y) * -4.0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.16e+138: tmp = 2.0 elif y <= 5.8e+44: tmp = (z / y) * -4.0 else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.16e+138) tmp = 2.0; elseif (y <= 5.8e+44) tmp = Float64(Float64(z / y) * -4.0); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.16e+138) tmp = 2.0; elseif (y <= 5.8e+44) tmp = (z / y) * -4.0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.16e+138], 2.0, If[LessEqual[y, 5.8e+44], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.16 \cdot 10^{+138}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+44}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.15999999999999994e138 or 5.8000000000000004e44 < y Initial program 100.0%
Taylor expanded in y around inf 82.2%
if -1.15999999999999994e138 < y < 5.8000000000000004e44Initial program 100.0%
Taylor expanded in z around inf 54.5%
*-commutative54.5%
Simplified54.5%
(FPCore (x y z) :precision binary64 (if (<= y -1.15e+139) 2.0 (if (<= y 1.05e+45) (* z (/ -4.0 y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+139) {
tmp = 2.0;
} else if (y <= 1.05e+45) {
tmp = 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 (y <= (-1.15d+139)) then
tmp = 2.0d0
else if (y <= 1.05d+45) then
tmp = 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 (y <= -1.15e+139) {
tmp = 2.0;
} else if (y <= 1.05e+45) {
tmp = z * (-4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+139: tmp = 2.0 elif y <= 1.05e+45: tmp = z * (-4.0 / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+139) tmp = 2.0; elseif (y <= 1.05e+45) tmp = 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 (y <= -1.15e+139) tmp = 2.0; elseif (y <= 1.05e+45) tmp = z * (-4.0 / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+139], 2.0, If[LessEqual[y, 1.05e+45], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+139}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+45}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.15e139 or 1.04999999999999997e45 < y Initial program 100.0%
Taylor expanded in y around inf 82.2%
if -1.15e139 < y < 1.04999999999999997e45Initial program 100.0%
Taylor expanded in z around inf 54.5%
associate-*r/54.5%
*-commutative54.5%
associate-/l*54.3%
Simplified54.3%
(FPCore (x y z) :precision binary64 (+ (* (/ 4.0 y) (- x z)) 2.0))
double code(double x, double y, double z) {
return ((4.0 / y) * (x - z)) + 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 = ((4.0d0 / y) * (x - z)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return ((4.0 / y) * (x - z)) + 2.0;
}
def code(x, y, z): return ((4.0 / y) * (x - z)) + 2.0
function code(x, y, z) return Float64(Float64(Float64(4.0 / y) * Float64(x - z)) + 2.0) end
function tmp = code(x, y, z) tmp = ((4.0 / y) * (x - z)) + 2.0; end
code[x_, y_, z_] := N[(N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{4}{y} \cdot \left(x - z\right) + 2
\end{array}
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-*r*99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
(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 37.8%
herbie shell --seed 2024158
(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)))