
(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 y) (* 4.0 (- x z))) y))
double code(double x, double y, double z) {
return ((2.0 * y) + (4.0 * (x - 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 = ((2.0d0 * y) + (4.0d0 * (x - z))) / y
end function
public static double code(double x, double y, double z) {
return ((2.0 * y) + (4.0 * (x - z))) / y;
}
def code(x, y, z): return ((2.0 * y) + (4.0 * (x - z))) / y
function code(x, y, z) return Float64(Float64(Float64(2.0 * y) + Float64(4.0 * Float64(x - z))) / y) end
function tmp = code(x, y, z) tmp = ((2.0 * y) + (4.0 * (x - z))) / y; end
code[x_, y_, z_] := N[(N[(N[(2.0 * y), $MachinePrecision] + N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 \cdot y + 4 \cdot \left(x - z\right)}{y}
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))) (t_1 (* (/ z y) -4.0)))
(if (<= y -1.9e+64)
2.0
(if (<= y -5e-128)
t_1
(if (<= y -1.12e-217)
t_0
(if (<= y 3.8e-261) t_1 (if (<= y 3e-25) t_0 2.0)))))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (z / y) * -4.0;
double tmp;
if (y <= -1.9e+64) {
tmp = 2.0;
} else if (y <= -5e-128) {
tmp = t_1;
} else if (y <= -1.12e-217) {
tmp = t_0;
} else if (y <= 3.8e-261) {
tmp = t_1;
} else if (y <= 3e-25) {
tmp = t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 4.0d0 * (x / y)
t_1 = (z / y) * (-4.0d0)
if (y <= (-1.9d+64)) then
tmp = 2.0d0
else if (y <= (-5d-128)) then
tmp = t_1
else if (y <= (-1.12d-217)) then
tmp = t_0
else if (y <= 3.8d-261) then
tmp = t_1
else if (y <= 3d-25) then
tmp = t_0
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (z / y) * -4.0;
double tmp;
if (y <= -1.9e+64) {
tmp = 2.0;
} else if (y <= -5e-128) {
tmp = t_1;
} else if (y <= -1.12e-217) {
tmp = t_0;
} else if (y <= 3.8e-261) {
tmp = t_1;
} else if (y <= 3e-25) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) t_1 = (z / y) * -4.0 tmp = 0 if y <= -1.9e+64: tmp = 2.0 elif y <= -5e-128: tmp = t_1 elif y <= -1.12e-217: tmp = t_0 elif y <= 3.8e-261: tmp = t_1 elif y <= 3e-25: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) t_1 = Float64(Float64(z / y) * -4.0) tmp = 0.0 if (y <= -1.9e+64) tmp = 2.0; elseif (y <= -5e-128) tmp = t_1; elseif (y <= -1.12e-217) tmp = t_0; elseif (y <= 3.8e-261) tmp = t_1; elseif (y <= 3e-25) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); t_1 = (z / y) * -4.0; tmp = 0.0; if (y <= -1.9e+64) tmp = 2.0; elseif (y <= -5e-128) tmp = t_1; elseif (y <= -1.12e-217) tmp = t_0; elseif (y <= 3.8e-261) tmp = t_1; elseif (y <= 3e-25) tmp = t_0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[y, -1.9e+64], 2.0, If[LessEqual[y, -5e-128], t$95$1, If[LessEqual[y, -1.12e-217], t$95$0, If[LessEqual[y, 3.8e-261], t$95$1, If[LessEqual[y, 3e-25], t$95$0, 2.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
t_1 := \frac{z}{y} \cdot -4\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{+64}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-217}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-261}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-25}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.9000000000000001e64 or 2.9999999999999998e-25 < y Initial program 99.9%
Taylor expanded in y around inf 68.5%
if -1.9000000000000001e64 < y < -5.0000000000000001e-128 or -1.12000000000000004e-217 < y < 3.8e-261Initial program 100.0%
Taylor expanded in z around inf 57.5%
*-commutative57.5%
Simplified57.5%
if -5.0000000000000001e-128 < y < -1.12000000000000004e-217 or 3.8e-261 < y < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in x around inf 61.2%
Final simplification63.4%
(FPCore (x y z)
:precision binary64
(if (<= y -2.9e+77)
2.0
(if (or (<= y 7.5e-7) (and (not (<= y 4.1e+42)) (<= y 7.5e+122)))
(* (- x z) (/ 4.0 y))
2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.9e+77) {
tmp = 2.0;
} else if ((y <= 7.5e-7) || (!(y <= 4.1e+42) && (y <= 7.5e+122))) {
tmp = (x - 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 <= (-2.9d+77)) then
tmp = 2.0d0
else if ((y <= 7.5d-7) .or. (.not. (y <= 4.1d+42)) .and. (y <= 7.5d+122)) then
tmp = (x - 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 <= -2.9e+77) {
tmp = 2.0;
} else if ((y <= 7.5e-7) || (!(y <= 4.1e+42) && (y <= 7.5e+122))) {
tmp = (x - z) * (4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.9e+77: tmp = 2.0 elif (y <= 7.5e-7) or (not (y <= 4.1e+42) and (y <= 7.5e+122)): tmp = (x - z) * (4.0 / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.9e+77) tmp = 2.0; elseif ((y <= 7.5e-7) || (!(y <= 4.1e+42) && (y <= 7.5e+122))) tmp = Float64(Float64(x - 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 <= -2.9e+77) tmp = 2.0; elseif ((y <= 7.5e-7) || (~((y <= 4.1e+42)) && (y <= 7.5e+122))) tmp = (x - z) * (4.0 / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.9e+77], 2.0, If[Or[LessEqual[y, 7.5e-7], And[N[Not[LessEqual[y, 4.1e+42]], $MachinePrecision], LessEqual[y, 7.5e+122]]], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+77}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-7} \lor \neg \left(y \leq 4.1 \cdot 10^{+42}\right) \land y \leq 7.5 \cdot 10^{+122}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -2.9000000000000002e77 or 7.5000000000000002e-7 < y < 4.1e42 or 7.5000000000000002e122 < y Initial program 99.9%
Taylor expanded in y around inf 77.7%
if -2.9000000000000002e77 < y < 7.5000000000000002e-7 or 4.1e42 < y < 7.5000000000000002e122Initial program 100.0%
Taylor expanded in y around 0 89.2%
associate-*r/89.2%
associate-*l/89.0%
Simplified89.0%
Final simplification85.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 2.0 (* (/ z y) -4.0))))
(if (<= y -2.2e+69)
t_0
(if (<= y 4.4e-32)
(* (- x z) (/ 4.0 y))
(if (<= y 6e+107) t_0 (+ 2.0 (* 4.0 (/ x y))))))))
double code(double x, double y, double z) {
double t_0 = 2.0 + ((z / y) * -4.0);
double tmp;
if (y <= -2.2e+69) {
tmp = t_0;
} else if (y <= 4.4e-32) {
tmp = (x - z) * (4.0 / y);
} else if (y <= 6e+107) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 + ((z / y) * (-4.0d0))
if (y <= (-2.2d+69)) then
tmp = t_0
else if (y <= 4.4d-32) then
tmp = (x - z) * (4.0d0 / y)
else if (y <= 6d+107) then
tmp = t_0
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 t_0 = 2.0 + ((z / y) * -4.0);
double tmp;
if (y <= -2.2e+69) {
tmp = t_0;
} else if (y <= 4.4e-32) {
tmp = (x - z) * (4.0 / y);
} else if (y <= 6e+107) {
tmp = t_0;
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): t_0 = 2.0 + ((z / y) * -4.0) tmp = 0 if y <= -2.2e+69: tmp = t_0 elif y <= 4.4e-32: tmp = (x - z) * (4.0 / y) elif y <= 6e+107: tmp = t_0 else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) t_0 = Float64(2.0 + Float64(Float64(z / y) * -4.0)) tmp = 0.0 if (y <= -2.2e+69) tmp = t_0; elseif (y <= 4.4e-32) tmp = Float64(Float64(x - z) * Float64(4.0 / y)); elseif (y <= 6e+107) tmp = t_0; else tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 2.0 + ((z / y) * -4.0); tmp = 0.0; if (y <= -2.2e+69) tmp = t_0; elseif (y <= 4.4e-32) tmp = (x - z) * (4.0 / y); elseif (y <= 6e+107) tmp = t_0; else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e+69], t$95$0, If[LessEqual[y, 4.4e-32], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+107], t$95$0, N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + \frac{z}{y} \cdot -4\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-32}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+107}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -2.2000000000000002e69 or 4.4e-32 < y < 6.00000000000000046e107Initial 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-*l*99.9%
metadata-eval99.9%
*-rgt-identity99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 88.6%
*-commutative88.6%
Simplified88.6%
if -2.2000000000000002e69 < y < 4.4e-32Initial program 100.0%
Taylor expanded in y around 0 92.6%
associate-*r/92.6%
associate-*l/92.3%
Simplified92.3%
if 6.00000000000000046e107 < y Initial program 99.9%
+-commutative99.9%
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%
Taylor expanded in z around 0 94.3%
+-commutative94.3%
Simplified94.3%
Final simplification91.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.6e+66) (not (<= y 5.8e-32))) (+ 2.0 (* (/ z y) -4.0)) (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.6e+66) || !(y <= 5.8e-32)) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = (x - z) * (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 <= (-1.6d+66)) .or. (.not. (y <= 5.8d-32))) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
else
tmp = (x - z) * (4.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.6e+66) || !(y <= 5.8e-32)) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = (x - z) * (4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.6e+66) or not (y <= 5.8e-32): tmp = 2.0 + ((z / y) * -4.0) else: tmp = (x - z) * (4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.6e+66) || !(y <= 5.8e-32)) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); else tmp = Float64(Float64(x - z) * Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.6e+66) || ~((y <= 5.8e-32))) tmp = 2.0 + ((z / y) * -4.0); else tmp = (x - z) * (4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.6e+66], N[Not[LessEqual[y, 5.8e-32]], $MachinePrecision]], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+66} \lor \neg \left(y \leq 5.8 \cdot 10^{-32}\right):\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\end{array}
\end{array}
if y < -1.6e66 or 5.79999999999999991e-32 < y Initial program 99.9%
+-commutative99.9%
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%
Taylor expanded in x around 0 84.5%
*-commutative84.5%
Simplified84.5%
if -1.6e66 < y < 5.79999999999999991e-32Initial program 100.0%
Taylor expanded in y around 0 92.6%
associate-*r/92.6%
associate-*l/92.3%
Simplified92.3%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (<= y -9e+70) 2.0 (if (<= y 3e-25) (* 4.0 (/ x y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9e+70) {
tmp = 2.0;
} else if (y <= 3e-25) {
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 <= (-9d+70)) then
tmp = 2.0d0
else if (y <= 3d-25) 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 <= -9e+70) {
tmp = 2.0;
} else if (y <= 3e-25) {
tmp = 4.0 * (x / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9e+70: tmp = 2.0 elif y <= 3e-25: tmp = 4.0 * (x / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9e+70) tmp = 2.0; elseif (y <= 3e-25) tmp = Float64(4.0 * Float64(x / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9e+70) tmp = 2.0; elseif (y <= 3e-25) tmp = 4.0 * (x / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9e+70], 2.0, If[LessEqual[y, 3e-25], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+70}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-25}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -8.9999999999999999e70 or 2.9999999999999998e-25 < y Initial program 99.9%
Taylor expanded in y around inf 69.1%
if -8.9999999999999999e70 < y < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in x around inf 49.5%
Final simplification58.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.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%
Final simplification99.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 35.6%
Final simplification35.6%
herbie shell --seed 2024059
(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)))