
(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 10 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
(let* ((t_0 (* (/ z y) -4.0)))
(if (<= y -8.5e+40)
2.0
(if (<= y -6.4e-289)
t_0
(if (<= y 2.35e-79) (/ (* 4.0 x) y) (if (<= y 9.6e+66) t_0 2.0))))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double tmp;
if (y <= -8.5e+40) {
tmp = 2.0;
} else if (y <= -6.4e-289) {
tmp = t_0;
} else if (y <= 2.35e-79) {
tmp = (4.0 * x) / y;
} else if (y <= 9.6e+66) {
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) :: tmp
t_0 = (z / y) * (-4.0d0)
if (y <= (-8.5d+40)) then
tmp = 2.0d0
else if (y <= (-6.4d-289)) then
tmp = t_0
else if (y <= 2.35d-79) then
tmp = (4.0d0 * x) / y
else if (y <= 9.6d+66) 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 = (z / y) * -4.0;
double tmp;
if (y <= -8.5e+40) {
tmp = 2.0;
} else if (y <= -6.4e-289) {
tmp = t_0;
} else if (y <= 2.35e-79) {
tmp = (4.0 * x) / y;
} else if (y <= 9.6e+66) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 tmp = 0 if y <= -8.5e+40: tmp = 2.0 elif y <= -6.4e-289: tmp = t_0 elif y <= 2.35e-79: tmp = (4.0 * x) / y elif y <= 9.6e+66: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) tmp = 0.0 if (y <= -8.5e+40) tmp = 2.0; elseif (y <= -6.4e-289) tmp = t_0; elseif (y <= 2.35e-79) tmp = Float64(Float64(4.0 * x) / y); elseif (y <= 9.6e+66) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; tmp = 0.0; if (y <= -8.5e+40) tmp = 2.0; elseif (y <= -6.4e-289) tmp = t_0; elseif (y <= 2.35e-79) tmp = (4.0 * x) / y; elseif (y <= 9.6e+66) tmp = t_0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[y, -8.5e+40], 2.0, If[LessEqual[y, -6.4e-289], t$95$0, If[LessEqual[y, 2.35e-79], N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 9.6e+66], t$95$0, 2.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+40}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -6.4 \cdot 10^{-289}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-79}:\\
\;\;\;\;\frac{4 \cdot x}{y}\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{+66}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -8.49999999999999996e40 or 9.6000000000000007e66 < y Initial program 100.0%
Taylor expanded in y around inf 71.5%
if -8.49999999999999996e40 < y < -6.4000000000000004e-289 or 2.3500000000000001e-79 < y < 9.6000000000000007e66Initial program 100.0%
Taylor expanded in z around inf 55.3%
*-commutative55.3%
Simplified55.3%
if -6.4000000000000004e-289 < y < 2.3500000000000001e-79Initial program 100.0%
Taylor expanded in x around inf 63.9%
associate-*r/63.9%
Simplified63.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ z y) -4.0)))
(if (<= y -1.7e+40)
2.0
(if (<= y -1.1e-287)
t_0
(if (<= y 1.08e-79) (* x (/ 4.0 y)) (if (<= y 1.4e+65) t_0 2.0))))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double tmp;
if (y <= -1.7e+40) {
tmp = 2.0;
} else if (y <= -1.1e-287) {
tmp = t_0;
} else if (y <= 1.08e-79) {
tmp = x * (4.0 / y);
} else if (y <= 1.4e+65) {
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) :: tmp
t_0 = (z / y) * (-4.0d0)
if (y <= (-1.7d+40)) then
tmp = 2.0d0
else if (y <= (-1.1d-287)) then
tmp = t_0
else if (y <= 1.08d-79) then
tmp = x * (4.0d0 / y)
else if (y <= 1.4d+65) 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 = (z / y) * -4.0;
double tmp;
if (y <= -1.7e+40) {
tmp = 2.0;
} else if (y <= -1.1e-287) {
tmp = t_0;
} else if (y <= 1.08e-79) {
tmp = x * (4.0 / y);
} else if (y <= 1.4e+65) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 tmp = 0 if y <= -1.7e+40: tmp = 2.0 elif y <= -1.1e-287: tmp = t_0 elif y <= 1.08e-79: tmp = x * (4.0 / y) elif y <= 1.4e+65: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) tmp = 0.0 if (y <= -1.7e+40) tmp = 2.0; elseif (y <= -1.1e-287) tmp = t_0; elseif (y <= 1.08e-79) tmp = Float64(x * Float64(4.0 / y)); elseif (y <= 1.4e+65) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; tmp = 0.0; if (y <= -1.7e+40) tmp = 2.0; elseif (y <= -1.1e-287) tmp = t_0; elseif (y <= 1.08e-79) tmp = x * (4.0 / y); elseif (y <= 1.4e+65) tmp = t_0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[y, -1.7e+40], 2.0, If[LessEqual[y, -1.1e-287], t$95$0, If[LessEqual[y, 1.08e-79], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+65], t$95$0, 2.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+40}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-287}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{-79}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.69999999999999994e40 or 1.3999999999999999e65 < y Initial program 100.0%
Taylor expanded in y around inf 71.5%
if -1.69999999999999994e40 < y < -1.1e-287 or 1.0800000000000001e-79 < y < 1.3999999999999999e65Initial program 100.0%
Taylor expanded in z around inf 55.3%
*-commutative55.3%
Simplified55.3%
if -1.1e-287 < y < 1.0800000000000001e-79Initial program 100.0%
Taylor expanded in x around inf 63.9%
associate-*r/63.9%
associate-*l/63.9%
*-commutative63.9%
Simplified63.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (/ -4.0 y))))
(if (<= y -1.4e+40)
2.0
(if (<= y -6e-288)
t_0
(if (<= y 8.4e-76) (* x (/ 4.0 y)) (if (<= y 1.2e+65) t_0 2.0))))))
double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (y <= -1.4e+40) {
tmp = 2.0;
} else if (y <= -6e-288) {
tmp = t_0;
} else if (y <= 8.4e-76) {
tmp = x * (4.0 / y);
} else if (y <= 1.2e+65) {
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) :: tmp
t_0 = z * ((-4.0d0) / y)
if (y <= (-1.4d+40)) then
tmp = 2.0d0
else if (y <= (-6d-288)) then
tmp = t_0
else if (y <= 8.4d-76) then
tmp = x * (4.0d0 / y)
else if (y <= 1.2d+65) 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 = z * (-4.0 / y);
double tmp;
if (y <= -1.4e+40) {
tmp = 2.0;
} else if (y <= -6e-288) {
tmp = t_0;
} else if (y <= 8.4e-76) {
tmp = x * (4.0 / y);
} else if (y <= 1.2e+65) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-4.0 / y) tmp = 0 if y <= -1.4e+40: tmp = 2.0 elif y <= -6e-288: tmp = t_0 elif y <= 8.4e-76: tmp = x * (4.0 / y) elif y <= 1.2e+65: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-4.0 / y)) tmp = 0.0 if (y <= -1.4e+40) tmp = 2.0; elseif (y <= -6e-288) tmp = t_0; elseif (y <= 8.4e-76) tmp = Float64(x * Float64(4.0 / y)); elseif (y <= 1.2e+65) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-4.0 / y); tmp = 0.0; if (y <= -1.4e+40) tmp = 2.0; elseif (y <= -6e-288) tmp = t_0; elseif (y <= 8.4e-76) tmp = x * (4.0 / y); elseif (y <= 1.2e+65) tmp = t_0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.4e+40], 2.0, If[LessEqual[y, -6e-288], t$95$0, If[LessEqual[y, 8.4e-76], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+65], t$95$0, 2.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{-4}{y}\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{+40}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-288}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{-76}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.4000000000000001e40 or 1.2000000000000001e65 < y Initial program 100.0%
Taylor expanded in y around inf 71.5%
if -1.4000000000000001e40 < y < -5.99999999999999998e-288 or 8.39999999999999969e-76 < y < 1.2000000000000001e65Initial program 100.0%
Taylor expanded in z around inf 55.3%
associate-*r/55.3%
*-commutative55.3%
associate-/l*55.2%
Simplified55.2%
if -5.99999999999999998e-288 < y < 8.39999999999999969e-76Initial program 100.0%
Taylor expanded in x around inf 63.9%
associate-*r/63.9%
associate-*l/63.9%
*-commutative63.9%
Simplified63.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.15e+42) (not (<= y 1.26e+66))) (+ 2.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.15e+42) || !(y <= 1.26e+66)) {
tmp = 2.0 + (4.0 * (x / y));
} 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 <= (-1.15d+42)) .or. (.not. (y <= 1.26d+66))) then
tmp = 2.0d0 + (4.0d0 * (x / y))
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 <= -1.15e+42) || !(y <= 1.26e+66)) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.15e+42) or not (y <= 1.26e+66): tmp = 2.0 + (4.0 * (x / y)) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.15e+42) || !(y <= 1.26e+66)) tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); 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 <= -1.15e+42) || ~((y <= 1.26e+66))) tmp = 2.0 + (4.0 * (x / y)); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.15e+42], N[Not[LessEqual[y, 1.26e+66]], $MachinePrecision]], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+42} \lor \neg \left(y \leq 1.26 \cdot 10^{+66}\right):\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -1.15e42 or 1.25999999999999999e66 < 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-*l*99.9%
metadata-eval99.9%
*-rgt-identity99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 86.9%
if -1.15e42 < y < 1.25999999999999999e66Initial program 100.0%
Taylor expanded in y around 0 91.0%
Final simplification89.2%
(FPCore (x y z) :precision binary64 (if (<= y -2.85e+22) (+ 2.0 (* (/ z y) -4.0)) (if (<= y 4.9e+67) (* 4.0 (/ (- x z) y)) (+ 2.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.85e+22) {
tmp = 2.0 + ((z / y) * -4.0);
} else if (y <= 4.9e+67) {
tmp = 4.0 * ((x - z) / 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 (y <= (-2.85d+22)) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
else if (y <= 4.9d+67) then
tmp = 4.0d0 * ((x - z) / 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 (y <= -2.85e+22) {
tmp = 2.0 + ((z / y) * -4.0);
} else if (y <= 4.9e+67) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.85e+22: tmp = 2.0 + ((z / y) * -4.0) elif y <= 4.9e+67: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.85e+22) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); elseif (y <= 4.9e+67) tmp = Float64(4.0 * Float64(Float64(x - z) / 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 (y <= -2.85e+22) tmp = 2.0 + ((z / y) * -4.0); elseif (y <= 4.9e+67) tmp = 4.0 * ((x - z) / y); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.85e+22], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e+67], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+22}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+67}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -2.8499999999999999e22Initial 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 84.0%
*-commutative84.0%
Simplified84.0%
if -2.8499999999999999e22 < y < 4.8999999999999999e67Initial program 100.0%
Taylor expanded in y around 0 92.6%
if 4.8999999999999999e67 < 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-*l*99.9%
metadata-eval99.9%
*-rgt-identity99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 90.2%
(FPCore (x y z) :precision binary64 (if (<= y -2.6e+143) 2.0 (if (<= y 5.4e+66) (* 4.0 (/ (- x z) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.6e+143) {
tmp = 2.0;
} else if (y <= 5.4e+66) {
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 <= (-2.6d+143)) then
tmp = 2.0d0
else if (y <= 5.4d+66) 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 <= -2.6e+143) {
tmp = 2.0;
} else if (y <= 5.4e+66) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.6e+143: tmp = 2.0 elif y <= 5.4e+66: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.6e+143) tmp = 2.0; elseif (y <= 5.4e+66) 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 <= -2.6e+143) tmp = 2.0; elseif (y <= 5.4e+66) tmp = 4.0 * ((x - z) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.6e+143], 2.0, If[LessEqual[y, 5.4e+66], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+143}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+66}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -2.5999999999999999e143 or 5.4e66 < y Initial program 100.0%
Taylor expanded in y around inf 76.5%
if -2.5999999999999999e143 < y < 5.4e66Initial program 100.0%
Taylor expanded in y around 0 87.3%
(FPCore (x y z) :precision binary64 (if (<= y -1.16e+23) 2.0 (if (<= y 1.3e+60) (* x (/ 4.0 y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.16e+23) {
tmp = 2.0;
} else if (y <= 1.3e+60) {
tmp = 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 (y <= (-1.16d+23)) then
tmp = 2.0d0
else if (y <= 1.3d+60) then
tmp = 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 (y <= -1.16e+23) {
tmp = 2.0;
} else if (y <= 1.3e+60) {
tmp = x * (4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.16e+23: tmp = 2.0 elif y <= 1.3e+60: tmp = x * (4.0 / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.16e+23) tmp = 2.0; elseif (y <= 1.3e+60) tmp = 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 (y <= -1.16e+23) tmp = 2.0; elseif (y <= 1.3e+60) tmp = x * (4.0 / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.16e+23], 2.0, If[LessEqual[y, 1.3e+60], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.16 \cdot 10^{+23}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+60}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.16e23 or 1.30000000000000004e60 < y Initial program 100.0%
Taylor expanded in y around inf 68.7%
if -1.16e23 < y < 1.30000000000000004e60Initial program 100.0%
Taylor expanded in x around inf 51.0%
associate-*r/51.0%
associate-*l/50.9%
*-commutative50.9%
Simplified50.9%
(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-*l*99.8%
metadata-eval99.8%
*-rgt-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 36.9%
herbie shell --seed 2024146
(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)))