
(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 (+ (/ (- 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 99.6%
+-commutative99.6%
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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* z -4.0) y)) (t_1 (+ 1.0 (* 4.0 (/ x y)))))
(if (<= y -7e+43)
2.0
(if (<= y -7.2e-185)
t_1
(if (<= y 1.2e-292)
t_0
(if (<= y 2.65e-43) t_1 (if (<= y 0.058) (+ 1.0 t_0) 2.0)))))))
double code(double x, double y, double z) {
double t_0 = (z * -4.0) / y;
double t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (y <= -7e+43) {
tmp = 2.0;
} else if (y <= -7.2e-185) {
tmp = t_1;
} else if (y <= 1.2e-292) {
tmp = t_0;
} else if (y <= 2.65e-43) {
tmp = t_1;
} else if (y <= 0.058) {
tmp = 1.0 + 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 = (z * (-4.0d0)) / y
t_1 = 1.0d0 + (4.0d0 * (x / y))
if (y <= (-7d+43)) then
tmp = 2.0d0
else if (y <= (-7.2d-185)) then
tmp = t_1
else if (y <= 1.2d-292) then
tmp = t_0
else if (y <= 2.65d-43) then
tmp = t_1
else if (y <= 0.058d0) then
tmp = 1.0d0 + 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 t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (y <= -7e+43) {
tmp = 2.0;
} else if (y <= -7.2e-185) {
tmp = t_1;
} else if (y <= 1.2e-292) {
tmp = t_0;
} else if (y <= 2.65e-43) {
tmp = t_1;
} else if (y <= 0.058) {
tmp = 1.0 + t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * -4.0) / y t_1 = 1.0 + (4.0 * (x / y)) tmp = 0 if y <= -7e+43: tmp = 2.0 elif y <= -7.2e-185: tmp = t_1 elif y <= 1.2e-292: tmp = t_0 elif y <= 2.65e-43: tmp = t_1 elif y <= 0.058: tmp = 1.0 + t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * -4.0) / y) t_1 = Float64(1.0 + Float64(4.0 * Float64(x / y))) tmp = 0.0 if (y <= -7e+43) tmp = 2.0; elseif (y <= -7.2e-185) tmp = t_1; elseif (y <= 1.2e-292) tmp = t_0; elseif (y <= 2.65e-43) tmp = t_1; elseif (y <= 0.058) tmp = Float64(1.0 + t_0); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * -4.0) / y; t_1 = 1.0 + (4.0 * (x / y)); tmp = 0.0; if (y <= -7e+43) tmp = 2.0; elseif (y <= -7.2e-185) tmp = t_1; elseif (y <= 1.2e-292) tmp = t_0; elseif (y <= 2.65e-43) tmp = t_1; elseif (y <= 0.058) tmp = 1.0 + t_0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7e+43], 2.0, If[LessEqual[y, -7.2e-185], t$95$1, If[LessEqual[y, 1.2e-292], t$95$0, If[LessEqual[y, 2.65e-43], t$95$1, If[LessEqual[y, 0.058], N[(1.0 + t$95$0), $MachinePrecision], 2.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z \cdot -4}{y}\\
t_1 := 1 + 4 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -7 \cdot 10^{+43}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-185}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-292}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 0.058:\\
\;\;\;\;1 + t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -7.0000000000000002e43 or 0.0580000000000000029 < y Initial program 99.1%
Taylor expanded in y around inf 68.5%
if -7.0000000000000002e43 < y < -7.1999999999999997e-185 or 1.2000000000000001e-292 < y < 2.6500000000000002e-43Initial program 100.0%
Taylor expanded in x around inf 62.5%
if -7.1999999999999997e-185 < y < 1.2000000000000001e-292Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around inf 76.2%
*-commutative76.2%
associate-*l/76.2%
Simplified76.2%
if 2.6500000000000002e-43 < y < 0.0580000000000000029Initial program 100.0%
Taylor expanded in z around inf 76.8%
*-commutative76.8%
Simplified76.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* z -4.0) y)) (t_1 (+ 1.0 (* 4.0 (/ x y)))))
(if (<= y -3.1e+43)
2.0
(if (<= y -7.1e-186)
t_1
(if (<= y 1.95e-292)
t_0
(if (<= y 1.4e-42) t_1 (if (<= y 0.058) t_0 2.0)))))))
double code(double x, double y, double z) {
double t_0 = (z * -4.0) / y;
double t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (y <= -3.1e+43) {
tmp = 2.0;
} else if (y <= -7.1e-186) {
tmp = t_1;
} else if (y <= 1.95e-292) {
tmp = t_0;
} else if (y <= 1.4e-42) {
tmp = t_1;
} else if (y <= 0.058) {
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 = (z * (-4.0d0)) / y
t_1 = 1.0d0 + (4.0d0 * (x / y))
if (y <= (-3.1d+43)) then
tmp = 2.0d0
else if (y <= (-7.1d-186)) then
tmp = t_1
else if (y <= 1.95d-292) then
tmp = t_0
else if (y <= 1.4d-42) then
tmp = t_1
else if (y <= 0.058d0) 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 t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (y <= -3.1e+43) {
tmp = 2.0;
} else if (y <= -7.1e-186) {
tmp = t_1;
} else if (y <= 1.95e-292) {
tmp = t_0;
} else if (y <= 1.4e-42) {
tmp = t_1;
} else if (y <= 0.058) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * -4.0) / y t_1 = 1.0 + (4.0 * (x / y)) tmp = 0 if y <= -3.1e+43: tmp = 2.0 elif y <= -7.1e-186: tmp = t_1 elif y <= 1.95e-292: tmp = t_0 elif y <= 1.4e-42: tmp = t_1 elif y <= 0.058: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * -4.0) / y) t_1 = Float64(1.0 + Float64(4.0 * Float64(x / y))) tmp = 0.0 if (y <= -3.1e+43) tmp = 2.0; elseif (y <= -7.1e-186) tmp = t_1; elseif (y <= 1.95e-292) tmp = t_0; elseif (y <= 1.4e-42) tmp = t_1; elseif (y <= 0.058) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * -4.0) / y; t_1 = 1.0 + (4.0 * (x / y)); tmp = 0.0; if (y <= -3.1e+43) tmp = 2.0; elseif (y <= -7.1e-186) tmp = t_1; elseif (y <= 1.95e-292) tmp = t_0; elseif (y <= 1.4e-42) tmp = t_1; elseif (y <= 0.058) tmp = t_0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e+43], 2.0, If[LessEqual[y, -7.1e-186], t$95$1, If[LessEqual[y, 1.95e-292], t$95$0, If[LessEqual[y, 1.4e-42], t$95$1, If[LessEqual[y, 0.058], t$95$0, 2.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z \cdot -4}{y}\\
t_1 := 1 + 4 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+43}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -7.1 \cdot 10^{-186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-292}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 0.058:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -3.1000000000000002e43 or 0.0580000000000000029 < y Initial program 99.1%
Taylor expanded in y around inf 68.5%
if -3.1000000000000002e43 < y < -7.10000000000000014e-186 or 1.95e-292 < y < 1.39999999999999999e-42Initial program 100.0%
Taylor expanded in x around inf 62.5%
if -7.10000000000000014e-186 < y < 1.95e-292 or 1.39999999999999999e-42 < y < 0.0580000000000000029Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around inf 75.8%
*-commutative75.8%
associate-*l/75.8%
Simplified75.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* z -4.0) y)) (t_1 (* 4.0 (/ x y))))
(if (<= y -4.8e+43)
2.0
(if (<= y -3.4e-185)
t_1
(if (<= y 3.1e-291)
t_0
(if (<= y 2.15e-42) t_1 (if (<= y 0.118) t_0 2.0)))))))
double code(double x, double y, double z) {
double t_0 = (z * -4.0) / y;
double t_1 = 4.0 * (x / y);
double tmp;
if (y <= -4.8e+43) {
tmp = 2.0;
} else if (y <= -3.4e-185) {
tmp = t_1;
} else if (y <= 3.1e-291) {
tmp = t_0;
} else if (y <= 2.15e-42) {
tmp = t_1;
} else if (y <= 0.118) {
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 = (z * (-4.0d0)) / y
t_1 = 4.0d0 * (x / y)
if (y <= (-4.8d+43)) then
tmp = 2.0d0
else if (y <= (-3.4d-185)) then
tmp = t_1
else if (y <= 3.1d-291) then
tmp = t_0
else if (y <= 2.15d-42) then
tmp = t_1
else if (y <= 0.118d0) 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 t_1 = 4.0 * (x / y);
double tmp;
if (y <= -4.8e+43) {
tmp = 2.0;
} else if (y <= -3.4e-185) {
tmp = t_1;
} else if (y <= 3.1e-291) {
tmp = t_0;
} else if (y <= 2.15e-42) {
tmp = t_1;
} else if (y <= 0.118) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * -4.0) / y t_1 = 4.0 * (x / y) tmp = 0 if y <= -4.8e+43: tmp = 2.0 elif y <= -3.4e-185: tmp = t_1 elif y <= 3.1e-291: tmp = t_0 elif y <= 2.15e-42: tmp = t_1 elif y <= 0.118: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * -4.0) / y) t_1 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (y <= -4.8e+43) tmp = 2.0; elseif (y <= -3.4e-185) tmp = t_1; elseif (y <= 3.1e-291) tmp = t_0; elseif (y <= 2.15e-42) tmp = t_1; elseif (y <= 0.118) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * -4.0) / y; t_1 = 4.0 * (x / y); tmp = 0.0; if (y <= -4.8e+43) tmp = 2.0; elseif (y <= -3.4e-185) tmp = t_1; elseif (y <= 3.1e-291) tmp = t_0; elseif (y <= 2.15e-42) tmp = t_1; elseif (y <= 0.118) tmp = t_0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e+43], 2.0, If[LessEqual[y, -3.4e-185], t$95$1, If[LessEqual[y, 3.1e-291], t$95$0, If[LessEqual[y, 2.15e-42], t$95$1, If[LessEqual[y, 0.118], t$95$0, 2.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z \cdot -4}{y}\\
t_1 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+43}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -3.4 \cdot 10^{-185}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-291}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 0.118:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -4.80000000000000046e43 or 0.11799999999999999 < y Initial program 99.1%
Taylor expanded in y around inf 68.5%
if -4.80000000000000046e43 < y < -3.3999999999999998e-185 or 3.10000000000000011e-291 < y < 2.1500000000000001e-42Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around inf 61.0%
if -3.3999999999999998e-185 < y < 3.10000000000000011e-291 or 2.1500000000000001e-42 < y < 0.11799999999999999Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around inf 75.8%
*-commutative75.8%
associate-*l/75.8%
Simplified75.8%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.8e+87)
(not (or (<= z -0.27) (and (not (<= z -4.6e-30)) (<= z 1.12e+147)))))
(+ 1.0 (/ (* z -4.0) y))
(+ 2.0 (* x (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+87) || !((z <= -0.27) || (!(z <= -4.6e-30) && (z <= 1.12e+147)))) {
tmp = 1.0 + ((z * -4.0) / 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 ((z <= (-1.8d+87)) .or. (.not. (z <= (-0.27d0)) .or. (.not. (z <= (-4.6d-30))) .and. (z <= 1.12d+147))) then
tmp = 1.0d0 + ((z * (-4.0d0)) / 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 ((z <= -1.8e+87) || !((z <= -0.27) || (!(z <= -4.6e-30) && (z <= 1.12e+147)))) {
tmp = 1.0 + ((z * -4.0) / y);
} else {
tmp = 2.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.8e+87) or not ((z <= -0.27) or (not (z <= -4.6e-30) and (z <= 1.12e+147))): tmp = 1.0 + ((z * -4.0) / y) else: tmp = 2.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.8e+87) || !((z <= -0.27) || (!(z <= -4.6e-30) && (z <= 1.12e+147)))) tmp = Float64(1.0 + Float64(Float64(z * -4.0) / 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 ((z <= -1.8e+87) || ~(((z <= -0.27) || (~((z <= -4.6e-30)) && (z <= 1.12e+147))))) tmp = 1.0 + ((z * -4.0) / y); else tmp = 2.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e+87], N[Not[Or[LessEqual[z, -0.27], And[N[Not[LessEqual[z, -4.6e-30]], $MachinePrecision], LessEqual[z, 1.12e+147]]]], $MachinePrecision]], N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+87} \lor \neg \left(z \leq -0.27 \lor \neg \left(z \leq -4.6 \cdot 10^{-30}\right) \land z \leq 1.12 \cdot 10^{+147}\right):\\
\;\;\;\;1 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -1.79999999999999997e87 or -0.27000000000000002 < z < -4.59999999999999968e-30 or 1.12e147 < z Initial program 98.8%
Taylor expanded in z around inf 76.8%
*-commutative76.8%
Simplified76.8%
if -1.79999999999999997e87 < z < -0.27000000000000002 or -4.59999999999999968e-30 < z < 1.12e147Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.8%
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 inf 88.7%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.95e-15) (not (<= y 0.48))) (+ 2.0 (/ (/ x y) 0.25)) (/ (* (- x z) 4.0) y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.95e-15) || !(y <= 0.48)) {
tmp = 2.0 + ((x / y) / 0.25);
} 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 <= (-2.95d-15)) .or. (.not. (y <= 0.48d0))) then
tmp = 2.0d0 + ((x / y) / 0.25d0)
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 <= -2.95e-15) || !(y <= 0.48)) {
tmp = 2.0 + ((x / y) / 0.25);
} else {
tmp = ((x - z) * 4.0) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.95e-15) or not (y <= 0.48): tmp = 2.0 + ((x / y) / 0.25) else: tmp = ((x - z) * 4.0) / y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.95e-15) || !(y <= 0.48)) tmp = Float64(2.0 + Float64(Float64(x / y) / 0.25)); else tmp = Float64(Float64(Float64(x - z) * 4.0) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.95e-15) || ~((y <= 0.48))) tmp = 2.0 + ((x / y) / 0.25); else tmp = ((x - z) * 4.0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.95e-15], N[Not[LessEqual[y, 0.48]], $MachinePrecision]], N[(2.0 + N[(N[(x / y), $MachinePrecision] / 0.25), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - z), $MachinePrecision] * 4.0), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{-15} \lor \neg \left(y \leq 0.48\right):\\
\;\;\;\;2 + \frac{\frac{x}{y}}{0.25}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - z\right) \cdot 4}{y}\\
\end{array}
\end{array}
if y < -2.94999999999999982e-15 or 0.47999999999999998 < y Initial program 99.2%
+-commutative99.2%
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 inf 88.9%
*-commutative88.9%
metadata-eval88.9%
associate-/r*88.9%
*-commutative88.9%
div-inv89.0%
associate-/r*89.0%
Applied egg-rr89.0%
if -2.94999999999999982e-15 < y < 0.47999999999999998Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 95.2%
associate-*r/95.2%
Simplified95.2%
Final simplification92.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.4e+63) (not (<= x 3.5e-17))) (+ 2.0 (/ (/ x y) 0.25)) (+ 2.0 (/ (* z -4.0) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e+63) || !(x <= 3.5e-17)) {
tmp = 2.0 + ((x / y) / 0.25);
} else {
tmp = 2.0 + ((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 ((x <= (-4.4d+63)) .or. (.not. (x <= 3.5d-17))) then
tmp = 2.0d0 + ((x / y) / 0.25d0)
else
tmp = 2.0d0 + ((z * (-4.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e+63) || !(x <= 3.5e-17)) {
tmp = 2.0 + ((x / y) / 0.25);
} else {
tmp = 2.0 + ((z * -4.0) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.4e+63) or not (x <= 3.5e-17): tmp = 2.0 + ((x / y) / 0.25) else: tmp = 2.0 + ((z * -4.0) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.4e+63) || !(x <= 3.5e-17)) tmp = Float64(2.0 + Float64(Float64(x / y) / 0.25)); else tmp = Float64(2.0 + Float64(Float64(z * -4.0) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.4e+63) || ~((x <= 3.5e-17))) tmp = 2.0 + ((x / y) / 0.25); else tmp = 2.0 + ((z * -4.0) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.4e+63], N[Not[LessEqual[x, 3.5e-17]], $MachinePrecision]], N[(2.0 + N[(N[(x / y), $MachinePrecision] / 0.25), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+63} \lor \neg \left(x \leq 3.5 \cdot 10^{-17}\right):\\
\;\;\;\;2 + \frac{\frac{x}{y}}{0.25}\\
\mathbf{else}:\\
\;\;\;\;2 + \frac{z \cdot -4}{y}\\
\end{array}
\end{array}
if x < -4.3999999999999997e63 or 3.5000000000000002e-17 < x Initial program 99.2%
+-commutative99.2%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.8%
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 inf 87.1%
*-commutative87.1%
metadata-eval87.1%
associate-/r*87.1%
*-commutative87.1%
div-inv87.2%
associate-/r*87.2%
Applied egg-rr87.2%
if -4.3999999999999997e63 < x < 3.5000000000000002e-17Initial 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 89.3%
associate-*r/89.3%
Simplified89.3%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.02e+64) (not (<= x 6.2e-19))) (+ 2.0 (* x (/ 4.0 y))) (+ 2.0 (/ (* z -4.0) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.02e+64) || !(x <= 6.2e-19)) {
tmp = 2.0 + (x * (4.0 / y));
} else {
tmp = 2.0 + ((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 ((x <= (-1.02d+64)) .or. (.not. (x <= 6.2d-19))) then
tmp = 2.0d0 + (x * (4.0d0 / y))
else
tmp = 2.0d0 + ((z * (-4.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.02e+64) || !(x <= 6.2e-19)) {
tmp = 2.0 + (x * (4.0 / y));
} else {
tmp = 2.0 + ((z * -4.0) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.02e+64) or not (x <= 6.2e-19): tmp = 2.0 + (x * (4.0 / y)) else: tmp = 2.0 + ((z * -4.0) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.02e+64) || !(x <= 6.2e-19)) tmp = Float64(2.0 + Float64(x * Float64(4.0 / y))); else tmp = Float64(2.0 + Float64(Float64(z * -4.0) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.02e+64) || ~((x <= 6.2e-19))) tmp = 2.0 + (x * (4.0 / y)); else tmp = 2.0 + ((z * -4.0) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.02e+64], N[Not[LessEqual[x, 6.2e-19]], $MachinePrecision]], N[(2.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+64} \lor \neg \left(x \leq 6.2 \cdot 10^{-19}\right):\\
\;\;\;\;2 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + \frac{z \cdot -4}{y}\\
\end{array}
\end{array}
if x < -1.01999999999999996e64 or 6.1999999999999998e-19 < x Initial program 99.2%
+-commutative99.2%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.8%
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 inf 87.1%
if -1.01999999999999996e64 < x < 6.1999999999999998e-19Initial 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 89.3%
associate-*r/89.3%
Simplified89.3%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (if (<= y -3.4e+43) 2.0 (if (<= y 1.25e+88) (* 4.0 (/ x y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.4e+43) {
tmp = 2.0;
} else if (y <= 1.25e+88) {
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 <= (-3.4d+43)) then
tmp = 2.0d0
else if (y <= 1.25d+88) 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 <= -3.4e+43) {
tmp = 2.0;
} else if (y <= 1.25e+88) {
tmp = 4.0 * (x / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.4e+43: tmp = 2.0 elif y <= 1.25e+88: tmp = 4.0 * (x / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.4e+43) tmp = 2.0; elseif (y <= 1.25e+88) 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 <= -3.4e+43) tmp = 2.0; elseif (y <= 1.25e+88) tmp = 4.0 * (x / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.4e+43], 2.0, If[LessEqual[y, 1.25e+88], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+43}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+88}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -3.40000000000000012e43 or 1.24999999999999999e88 < y Initial program 100.0%
Taylor expanded in y around inf 72.9%
if -3.40000000000000012e43 < y < 1.24999999999999999e88Initial program 99.4%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around inf 51.6%
(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.6%
+-commutative99.6%
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 99.6%
Taylor expanded in y around inf 34.4%
herbie shell --seed 2024111
(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)))