
(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 8 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 (+ 2.0 (/ (- x z) (* y 0.25))))
double code(double x, double y, double z) {
return 2.0 + ((x - z) / (y * 0.25));
}
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) / (y * 0.25d0))
end function
public static double code(double x, double y, double z) {
return 2.0 + ((x - z) / (y * 0.25));
}
def code(x, y, z): return 2.0 + ((x - z) / (y * 0.25))
function code(x, y, z) return Float64(2.0 + Float64(Float64(x - z) / Float64(y * 0.25))) end
function tmp = code(x, y, z) tmp = 2.0 + ((x - z) / (y * 0.25)); end
code[x_, y_, z_] := N[(2.0 + N[(N[(x - z), $MachinePrecision] / N[(y * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \frac{x - z}{y \cdot 0.25}
\end{array}
Initial program 99.9%
associate-*l/99.4%
+-commutative99.4%
associate--l+99.4%
distribute-lft-in99.4%
associate-+r+99.4%
Simplified99.4%
clear-num99.4%
div-inv99.4%
metadata-eval99.4%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (* z -4.0) y))) (t_1 (+ 1.0 (/ (* x 4.0) y))))
(if (<= x -4.15e-50)
t_1
(if (<= x -2.6e-81)
t_0
(if (<= x -3.5e-165)
2.0
(if (<= x -1.6e-238)
t_0
(if (<= x 2e-234)
2.0
(if (<= x 6.2e-150)
t_0
(if (<= x 4.3e-99) 2.0 (if (<= x 5e-26) t_0 t_1))))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((z * -4.0) / y);
double t_1 = 1.0 + ((x * 4.0) / y);
double tmp;
if (x <= -4.15e-50) {
tmp = t_1;
} else if (x <= -2.6e-81) {
tmp = t_0;
} else if (x <= -3.5e-165) {
tmp = 2.0;
} else if (x <= -1.6e-238) {
tmp = t_0;
} else if (x <= 2e-234) {
tmp = 2.0;
} else if (x <= 6.2e-150) {
tmp = t_0;
} else if (x <= 4.3e-99) {
tmp = 2.0;
} else if (x <= 5e-26) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((z * (-4.0d0)) / y)
t_1 = 1.0d0 + ((x * 4.0d0) / y)
if (x <= (-4.15d-50)) then
tmp = t_1
else if (x <= (-2.6d-81)) then
tmp = t_0
else if (x <= (-3.5d-165)) then
tmp = 2.0d0
else if (x <= (-1.6d-238)) then
tmp = t_0
else if (x <= 2d-234) then
tmp = 2.0d0
else if (x <= 6.2d-150) then
tmp = t_0
else if (x <= 4.3d-99) then
tmp = 2.0d0
else if (x <= 5d-26) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + ((z * -4.0) / y);
double t_1 = 1.0 + ((x * 4.0) / y);
double tmp;
if (x <= -4.15e-50) {
tmp = t_1;
} else if (x <= -2.6e-81) {
tmp = t_0;
} else if (x <= -3.5e-165) {
tmp = 2.0;
} else if (x <= -1.6e-238) {
tmp = t_0;
} else if (x <= 2e-234) {
tmp = 2.0;
} else if (x <= 6.2e-150) {
tmp = t_0;
} else if (x <= 4.3e-99) {
tmp = 2.0;
} else if (x <= 5e-26) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((z * -4.0) / y) t_1 = 1.0 + ((x * 4.0) / y) tmp = 0 if x <= -4.15e-50: tmp = t_1 elif x <= -2.6e-81: tmp = t_0 elif x <= -3.5e-165: tmp = 2.0 elif x <= -1.6e-238: tmp = t_0 elif x <= 2e-234: tmp = 2.0 elif x <= 6.2e-150: tmp = t_0 elif x <= 4.3e-99: tmp = 2.0 elif x <= 5e-26: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(z * -4.0) / y)) t_1 = Float64(1.0 + Float64(Float64(x * 4.0) / y)) tmp = 0.0 if (x <= -4.15e-50) tmp = t_1; elseif (x <= -2.6e-81) tmp = t_0; elseif (x <= -3.5e-165) tmp = 2.0; elseif (x <= -1.6e-238) tmp = t_0; elseif (x <= 2e-234) tmp = 2.0; elseif (x <= 6.2e-150) tmp = t_0; elseif (x <= 4.3e-99) tmp = 2.0; elseif (x <= 5e-26) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((z * -4.0) / y); t_1 = 1.0 + ((x * 4.0) / y); tmp = 0.0; if (x <= -4.15e-50) tmp = t_1; elseif (x <= -2.6e-81) tmp = t_0; elseif (x <= -3.5e-165) tmp = 2.0; elseif (x <= -1.6e-238) tmp = t_0; elseif (x <= 2e-234) tmp = 2.0; elseif (x <= 6.2e-150) tmp = t_0; elseif (x <= 4.3e-99) tmp = 2.0; elseif (x <= 5e-26) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.15e-50], t$95$1, If[LessEqual[x, -2.6e-81], t$95$0, If[LessEqual[x, -3.5e-165], 2.0, If[LessEqual[x, -1.6e-238], t$95$0, If[LessEqual[x, 2e-234], 2.0, If[LessEqual[x, 6.2e-150], t$95$0, If[LessEqual[x, 4.3e-99], 2.0, If[LessEqual[x, 5e-26], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{z \cdot -4}{y}\\
t_1 := 1 + \frac{x \cdot 4}{y}\\
\mathbf{if}\;x \leq -4.15 \cdot 10^{-50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-165}:\\
\;\;\;\;2\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-238}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-234}:\\
\;\;\;\;2\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-99}:\\
\;\;\;\;2\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-26}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -4.1499999999999998e-50 or 5.00000000000000019e-26 < x Initial program 100.0%
Taylor expanded in x around inf 71.4%
associate-*r/71.4%
Simplified71.4%
if -4.1499999999999998e-50 < x < -2.5999999999999999e-81 or -3.5000000000000002e-165 < x < -1.6000000000000001e-238 or 1.9999999999999999e-234 < x < 6.19999999999999996e-150 or 4.2999999999999999e-99 < x < 5.00000000000000019e-26Initial program 99.9%
Taylor expanded in z around inf 71.1%
*-commutative71.1%
associate-*l/71.1%
Simplified71.1%
if -2.5999999999999999e-81 < x < -3.5000000000000002e-165 or -1.6000000000000001e-238 < x < 1.9999999999999999e-234 or 6.19999999999999996e-150 < x < 4.2999999999999999e-99Initial program 100.0%
Taylor expanded in y around inf 71.8%
Final simplification71.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -200000000.0) (not (<= x 2.2e-7))) (+ 1.0 (* x (/ 4.0 y))) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -200000000.0) || !(x <= 2.2e-7)) {
tmp = 1.0 + (x * (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 ((x <= (-200000000.0d0)) .or. (.not. (x <= 2.2d-7))) then
tmp = 1.0d0 + (x * (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 ((x <= -200000000.0) || !(x <= 2.2e-7)) {
tmp = 1.0 + (x * (4.0 / y));
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -200000000.0) or not (x <= 2.2e-7): tmp = 1.0 + (x * (4.0 / y)) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -200000000.0) || !(x <= 2.2e-7)) tmp = Float64(1.0 + Float64(x * Float64(4.0 / y))); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -200000000.0) || ~((x <= 2.2e-7))) tmp = 1.0 + (x * (4.0 / y)); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -200000000.0], N[Not[LessEqual[x, 2.2e-7]], $MachinePrecision]], N[(1.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -200000000 \lor \neg \left(x \leq 2.2 \cdot 10^{-7}\right):\\
\;\;\;\;1 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if x < -2e8 or 2.2000000000000001e-7 < x Initial program 99.9%
Taylor expanded in x around inf 77.0%
associate-*r/77.0%
associate-*l/76.7%
*-commutative76.7%
Simplified76.7%
if -2e8 < x < 2.2000000000000001e-7Initial program 99.9%
Taylor expanded in y around inf 53.1%
Final simplification63.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.45e+16) (not (<= x 1.45e-5))) (+ 1.0 (/ 4.0 (/ y x))) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.45e+16) || !(x <= 1.45e-5)) {
tmp = 1.0 + (4.0 / (y / x));
} 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 ((x <= (-1.45d+16)) .or. (.not. (x <= 1.45d-5))) then
tmp = 1.0d0 + (4.0d0 / (y / x))
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.45e+16) || !(x <= 1.45e-5)) {
tmp = 1.0 + (4.0 / (y / x));
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.45e+16) or not (x <= 1.45e-5): tmp = 1.0 + (4.0 / (y / x)) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.45e+16) || !(x <= 1.45e-5)) tmp = Float64(1.0 + Float64(4.0 / Float64(y / x))); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.45e+16) || ~((x <= 1.45e-5))) tmp = 1.0 + (4.0 / (y / x)); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.45e+16], N[Not[LessEqual[x, 1.45e-5]], $MachinePrecision]], N[(1.0 + N[(4.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+16} \lor \neg \left(x \leq 1.45 \cdot 10^{-5}\right):\\
\;\;\;\;1 + \frac{4}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if x < -1.45e16 or 1.45e-5 < x Initial program 99.9%
Taylor expanded in x around inf 77.0%
associate-*r/77.0%
associate-*l/76.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in x around 0 77.0%
associate-*r/77.0%
associate-/l*76.9%
Simplified76.9%
if -1.45e16 < x < 1.45e-5Initial program 99.9%
Taylor expanded in y around inf 53.1%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -430000000000.0) (not (<= x 5.2e-6))) (+ 1.0 (/ (* x 4.0) y)) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -430000000000.0) || !(x <= 5.2e-6)) {
tmp = 1.0 + ((x * 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 ((x <= (-430000000000.0d0)) .or. (.not. (x <= 5.2d-6))) then
tmp = 1.0d0 + ((x * 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 ((x <= -430000000000.0) || !(x <= 5.2e-6)) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -430000000000.0) or not (x <= 5.2e-6): tmp = 1.0 + ((x * 4.0) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -430000000000.0) || !(x <= 5.2e-6)) tmp = Float64(1.0 + Float64(Float64(x * 4.0) / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -430000000000.0) || ~((x <= 5.2e-6))) tmp = 1.0 + ((x * 4.0) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -430000000000.0], N[Not[LessEqual[x, 5.2e-6]], $MachinePrecision]], N[(1.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -430000000000 \lor \neg \left(x \leq 5.2 \cdot 10^{-6}\right):\\
\;\;\;\;1 + \frac{x \cdot 4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if x < -4.3e11 or 5.20000000000000019e-6 < x Initial program 99.9%
Taylor expanded in x around inf 77.0%
associate-*r/77.0%
Simplified77.0%
if -4.3e11 < x < 5.20000000000000019e-6Initial program 99.9%
Taylor expanded in y around inf 53.1%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -350000000000.0) (not (<= x 8.8e+179))) (+ 1.0 (/ (* x 4.0) y)) (+ 2.0 (* -4.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -350000000000.0) || !(x <= 8.8e+179)) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = 2.0 + (-4.0 * (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 <= (-350000000000.0d0)) .or. (.not. (x <= 8.8d+179))) then
tmp = 1.0d0 + ((x * 4.0d0) / y)
else
tmp = 2.0d0 + ((-4.0d0) * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -350000000000.0) || !(x <= 8.8e+179)) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -350000000000.0) or not (x <= 8.8e+179): tmp = 1.0 + ((x * 4.0) / y) else: tmp = 2.0 + (-4.0 * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -350000000000.0) || !(x <= 8.8e+179)) tmp = Float64(1.0 + Float64(Float64(x * 4.0) / y)); else tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -350000000000.0) || ~((x <= 8.8e+179))) tmp = 1.0 + ((x * 4.0) / y); else tmp = 2.0 + (-4.0 * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -350000000000.0], N[Not[LessEqual[x, 8.8e+179]], $MachinePrecision]], N[(1.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -350000000000 \lor \neg \left(x \leq 8.8 \cdot 10^{+179}\right):\\
\;\;\;\;1 + \frac{x \cdot 4}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\end{array}
\end{array}
if x < -3.5e11 or 8.8000000000000002e179 < x Initial program 99.9%
Taylor expanded in x around inf 84.1%
associate-*r/84.1%
Simplified84.1%
if -3.5e11 < x < 8.8000000000000002e179Initial program 99.9%
associate-*l/99.2%
+-commutative99.2%
associate--l+99.2%
distribute-lft-in99.2%
associate-+r+99.2%
Simplified99.2%
clear-num99.2%
div-inv99.2%
metadata-eval99.2%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 87.5%
Final simplification86.3%
(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 99.9%
associate-*l/99.4%
+-commutative99.4%
associate--l+99.4%
distribute-lft-in99.4%
associate-+r+99.4%
Simplified99.4%
Final simplification99.4%
(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 99.9%
Taylor expanded in y around inf 34.5%
Final simplification34.5%
herbie shell --seed 2024021
(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)))