
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - 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.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\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.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - 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.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 1.0 (+ (* 4.0 (/ (- x z) y)) 3.0)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x - z) / y)) + 3.0);
}
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 - z) / y)) + 3.0d0)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x - z) / y)) + 3.0);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x - z) / y)) + 3.0)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x - z) / y)) + 3.0)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x - z) / y)) + 3.0); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(4 \cdot \frac{x - z}{y} + 3\right)
\end{array}
Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* z (/ -4.0 y)))) (t_1 (+ 1.0 (* 4.0 (/ x y)))))
(if (<= x -3e+81)
t_1
(if (<= x -1.25e-195)
t_0
(if (<= x -4.5e-279)
4.0
(if (<= x 1e-269)
t_0
(if (<= x 2.3e-213) 4.0 (if (<= x 2.7e+44) 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 + (4.0 * (x / y));
double tmp;
if (x <= -3e+81) {
tmp = t_1;
} else if (x <= -1.25e-195) {
tmp = t_0;
} else if (x <= -4.5e-279) {
tmp = 4.0;
} else if (x <= 1e-269) {
tmp = t_0;
} else if (x <= 2.3e-213) {
tmp = 4.0;
} else if (x <= 2.7e+44) {
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 + (4.0d0 * (x / y))
if (x <= (-3d+81)) then
tmp = t_1
else if (x <= (-1.25d-195)) then
tmp = t_0
else if (x <= (-4.5d-279)) then
tmp = 4.0d0
else if (x <= 1d-269) then
tmp = t_0
else if (x <= 2.3d-213) then
tmp = 4.0d0
else if (x <= 2.7d+44) 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 + (4.0 * (x / y));
double tmp;
if (x <= -3e+81) {
tmp = t_1;
} else if (x <= -1.25e-195) {
tmp = t_0;
} else if (x <= -4.5e-279) {
tmp = 4.0;
} else if (x <= 1e-269) {
tmp = t_0;
} else if (x <= 2.3e-213) {
tmp = 4.0;
} else if (x <= 2.7e+44) {
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 + (4.0 * (x / y)) tmp = 0 if x <= -3e+81: tmp = t_1 elif x <= -1.25e-195: tmp = t_0 elif x <= -4.5e-279: tmp = 4.0 elif x <= 1e-269: tmp = t_0 elif x <= 2.3e-213: tmp = 4.0 elif x <= 2.7e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * Float64(-4.0 / y))) t_1 = Float64(1.0 + Float64(4.0 * Float64(x / y))) tmp = 0.0 if (x <= -3e+81) tmp = t_1; elseif (x <= -1.25e-195) tmp = t_0; elseif (x <= -4.5e-279) tmp = 4.0; elseif (x <= 1e-269) tmp = t_0; elseif (x <= 2.3e-213) tmp = 4.0; elseif (x <= 2.7e+44) 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 + (4.0 * (x / y)); tmp = 0.0; if (x <= -3e+81) tmp = t_1; elseif (x <= -1.25e-195) tmp = t_0; elseif (x <= -4.5e-279) tmp = 4.0; elseif (x <= 1e-269) tmp = t_0; elseif (x <= 2.3e-213) tmp = 4.0; elseif (x <= 2.7e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+81], t$95$1, If[LessEqual[x, -1.25e-195], t$95$0, If[LessEqual[x, -4.5e-279], 4.0, If[LessEqual[x, 1e-269], t$95$0, If[LessEqual[x, 2.3e-213], 4.0, If[LessEqual[x, 2.7e+44], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot \frac{-4}{y}\\
t_1 := 1 + 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -3 \cdot 10^{+81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-195}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-279}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 10^{-269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-213}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.99999999999999997e81 or 2.7e44 < x Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in x around inf 77.9%
if -2.99999999999999997e81 < x < -1.25000000000000002e-195 or -4.49999999999999995e-279 < x < 9.9999999999999996e-270 or 2.30000000000000003e-213 < x < 2.7e44Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in z around inf 62.5%
*-commutative62.5%
Simplified62.5%
*-commutative62.5%
clear-num62.4%
un-div-inv62.4%
Applied egg-rr62.4%
associate-/r/62.4%
Applied egg-rr62.4%
if -1.25000000000000002e-195 < x < -4.49999999999999995e-279 or 9.9999999999999996e-270 < x < 2.30000000000000003e-213Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around inf 68.6%
Final simplification69.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* -4.0 (/ z y)))) (t_1 (+ 1.0 (* 4.0 (/ x y)))))
(if (<= x -9e+83)
t_1
(if (<= x -4.5e-196)
t_0
(if (<= x -2.9e-281)
4.0
(if (<= x 1.52e-270)
t_0
(if (<= x 2.05e-212) 4.0 (if (<= x 3.1e+46) t_0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (-4.0 * (z / y));
double t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (x <= -9e+83) {
tmp = t_1;
} else if (x <= -4.5e-196) {
tmp = t_0;
} else if (x <= -2.9e-281) {
tmp = 4.0;
} else if (x <= 1.52e-270) {
tmp = t_0;
} else if (x <= 2.05e-212) {
tmp = 4.0;
} else if (x <= 3.1e+46) {
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 + ((-4.0d0) * (z / y))
t_1 = 1.0d0 + (4.0d0 * (x / y))
if (x <= (-9d+83)) then
tmp = t_1
else if (x <= (-4.5d-196)) then
tmp = t_0
else if (x <= (-2.9d-281)) then
tmp = 4.0d0
else if (x <= 1.52d-270) then
tmp = t_0
else if (x <= 2.05d-212) then
tmp = 4.0d0
else if (x <= 3.1d+46) 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 + (-4.0 * (z / y));
double t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (x <= -9e+83) {
tmp = t_1;
} else if (x <= -4.5e-196) {
tmp = t_0;
} else if (x <= -2.9e-281) {
tmp = 4.0;
} else if (x <= 1.52e-270) {
tmp = t_0;
} else if (x <= 2.05e-212) {
tmp = 4.0;
} else if (x <= 3.1e+46) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (-4.0 * (z / y)) t_1 = 1.0 + (4.0 * (x / y)) tmp = 0 if x <= -9e+83: tmp = t_1 elif x <= -4.5e-196: tmp = t_0 elif x <= -2.9e-281: tmp = 4.0 elif x <= 1.52e-270: tmp = t_0 elif x <= 2.05e-212: tmp = 4.0 elif x <= 3.1e+46: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(-4.0 * Float64(z / y))) t_1 = Float64(1.0 + Float64(4.0 * Float64(x / y))) tmp = 0.0 if (x <= -9e+83) tmp = t_1; elseif (x <= -4.5e-196) tmp = t_0; elseif (x <= -2.9e-281) tmp = 4.0; elseif (x <= 1.52e-270) tmp = t_0; elseif (x <= 2.05e-212) tmp = 4.0; elseif (x <= 3.1e+46) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (-4.0 * (z / y)); t_1 = 1.0 + (4.0 * (x / y)); tmp = 0.0; if (x <= -9e+83) tmp = t_1; elseif (x <= -4.5e-196) tmp = t_0; elseif (x <= -2.9e-281) tmp = 4.0; elseif (x <= 1.52e-270) tmp = t_0; elseif (x <= 2.05e-212) tmp = 4.0; elseif (x <= 3.1e+46) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+83], t$95$1, If[LessEqual[x, -4.5e-196], t$95$0, If[LessEqual[x, -2.9e-281], 4.0, If[LessEqual[x, 1.52e-270], t$95$0, If[LessEqual[x, 2.05e-212], 4.0, If[LessEqual[x, 3.1e+46], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + -4 \cdot \frac{z}{y}\\
t_1 := 1 + 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -9 \cdot 10^{+83}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-196}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-281}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 1.52 \cdot 10^{-270}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-212}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -8.9999999999999999e83 or 3.09999999999999975e46 < x Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in x around inf 77.9%
if -8.9999999999999999e83 < x < -4.5e-196 or -2.8999999999999999e-281 < x < 1.52000000000000004e-270 or 2.05000000000000007e-212 < x < 3.09999999999999975e46Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in z around inf 62.5%
*-commutative62.5%
Simplified62.5%
if -4.5e-196 < x < -2.8999999999999999e-281 or 1.52000000000000004e-270 < x < 2.05000000000000007e-212Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around inf 68.6%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -23.0) (not (<= y 2.8e+125))) (+ 1.0 (+ 3.0 (* x (/ 4.0 y)))) (+ 1.0 (* 4.0 (/ (- x z) y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -23.0) || !(y <= 2.8e+125)) {
tmp = 1.0 + (3.0 + (x * (4.0 / y)));
} else {
tmp = 1.0 + (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 <= (-23.0d0)) .or. (.not. (y <= 2.8d+125))) then
tmp = 1.0d0 + (3.0d0 + (x * (4.0d0 / y)))
else
tmp = 1.0d0 + (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 <= -23.0) || !(y <= 2.8e+125)) {
tmp = 1.0 + (3.0 + (x * (4.0 / y)));
} else {
tmp = 1.0 + (4.0 * ((x - z) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -23.0) or not (y <= 2.8e+125): tmp = 1.0 + (3.0 + (x * (4.0 / y))) else: tmp = 1.0 + (4.0 * ((x - z) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -23.0) || !(y <= 2.8e+125)) tmp = Float64(1.0 + Float64(3.0 + Float64(x * Float64(4.0 / y)))); else tmp = Float64(1.0 + Float64(4.0 * Float64(Float64(x - z) / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -23.0) || ~((y <= 2.8e+125))) tmp = 1.0 + (3.0 + (x * (4.0 / y))); else tmp = 1.0 + (4.0 * ((x - z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -23.0], N[Not[LessEqual[y, 2.8e+125]], $MachinePrecision]], N[(1.0 + N[(3.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -23 \lor \neg \left(y \leq 2.8 \cdot 10^{+125}\right):\\
\;\;\;\;1 + \left(3 + x \cdot \frac{4}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -23 or 2.8000000000000001e125 < y Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 90.8%
associate-*r/90.8%
associate-*l/90.7%
*-commutative90.7%
Simplified90.7%
if -23 < y < 2.8000000000000001e125Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 91.9%
Final simplification91.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.25e+78) (not (<= x 1.15e+44))) (+ 1.0 (+ 3.0 (* x (/ 4.0 y)))) (+ 1.0 (+ 3.0 (/ -4.0 (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.25e+78) || !(x <= 1.15e+44)) {
tmp = 1.0 + (3.0 + (x * (4.0 / y)));
} else {
tmp = 1.0 + (3.0 + (-4.0 / (y / z)));
}
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.25d+78)) .or. (.not. (x <= 1.15d+44))) then
tmp = 1.0d0 + (3.0d0 + (x * (4.0d0 / y)))
else
tmp = 1.0d0 + (3.0d0 + ((-4.0d0) / (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.25e+78) || !(x <= 1.15e+44)) {
tmp = 1.0 + (3.0 + (x * (4.0 / y)));
} else {
tmp = 1.0 + (3.0 + (-4.0 / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.25e+78) or not (x <= 1.15e+44): tmp = 1.0 + (3.0 + (x * (4.0 / y))) else: tmp = 1.0 + (3.0 + (-4.0 / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.25e+78) || !(x <= 1.15e+44)) tmp = Float64(1.0 + Float64(3.0 + Float64(x * Float64(4.0 / y)))); else tmp = Float64(1.0 + Float64(3.0 + Float64(-4.0 / Float64(y / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.25e+78) || ~((x <= 1.15e+44))) tmp = 1.0 + (3.0 + (x * (4.0 / y))); else tmp = 1.0 + (3.0 + (-4.0 / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.25e+78], N[Not[LessEqual[x, 1.15e+44]], $MachinePrecision]], N[(1.0 + N[(3.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(3.0 + N[(-4.0 / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+78} \lor \neg \left(x \leq 1.15 \cdot 10^{+44}\right):\\
\;\;\;\;1 + \left(3 + x \cdot \frac{4}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(3 + \frac{-4}{\frac{y}{z}}\right)\\
\end{array}
\end{array}
if x < -1.24999999999999996e78 or 1.15000000000000002e44 < x Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 91.6%
associate-*r/91.6%
associate-*l/91.5%
*-commutative91.5%
Simplified91.5%
if -1.24999999999999996e78 < x < 1.15000000000000002e44Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 91.7%
associate-*r/91.7%
associate-/l*91.6%
Simplified91.6%
Final simplification91.5%
(FPCore (x y z) :precision binary64 (if (<= y -6.6e+127) 4.0 (if (<= y 7.6e+167) (+ 1.0 (* 4.0 (/ (- x z) y))) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.6e+127) {
tmp = 4.0;
} else if (y <= 7.6e+167) {
tmp = 1.0 + (4.0 * ((x - z) / y));
} else {
tmp = 4.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 <= (-6.6d+127)) then
tmp = 4.0d0
else if (y <= 7.6d+167) then
tmp = 1.0d0 + (4.0d0 * ((x - z) / y))
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6.6e+127) {
tmp = 4.0;
} else if (y <= 7.6e+167) {
tmp = 1.0 + (4.0 * ((x - z) / y));
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.6e+127: tmp = 4.0 elif y <= 7.6e+167: tmp = 1.0 + (4.0 * ((x - z) / y)) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.6e+127) tmp = 4.0; elseif (y <= 7.6e+167) tmp = Float64(1.0 + Float64(4.0 * Float64(Float64(x - z) / y))); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.6e+127) tmp = 4.0; elseif (y <= 7.6e+167) tmp = 1.0 + (4.0 * ((x - z) / y)); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.6e+127], 4.0, If[LessEqual[y, 7.6e+167], N[(1.0 + N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.6 \cdot 10^{+127}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+167}:\\
\;\;\;\;1 + 4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -6.59999999999999953e127 or 7.59999999999999987e167 < y Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 79.5%
if -6.59999999999999953e127 < y < 7.59999999999999987e167Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 86.3%
Final simplification84.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.7e+80) (not (<= x 8.6e+55))) (+ 1.0 (* 4.0 (/ x y))) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e+80) || !(x <= 8.6e+55)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 4.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 <= (-3.7d+80)) .or. (.not. (x <= 8.6d+55))) then
tmp = 1.0d0 + (4.0d0 * (x / y))
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e+80) || !(x <= 8.6e+55)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.7e+80) or not (x <= 8.6e+55): tmp = 1.0 + (4.0 * (x / y)) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.7e+80) || !(x <= 8.6e+55)) tmp = Float64(1.0 + Float64(4.0 * Float64(x / y))); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.7e+80) || ~((x <= 8.6e+55))) tmp = 1.0 + (4.0 * (x / y)); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.7e+80], N[Not[LessEqual[x, 8.6e+55]], $MachinePrecision]], N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+80} \lor \neg \left(x \leq 8.6 \cdot 10^{+55}\right):\\
\;\;\;\;1 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if x < -3.69999999999999996e80 or 8.5999999999999998e55 < x Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in x around inf 78.4%
if -3.69999999999999996e80 < x < 8.5999999999999998e55Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 42.6%
Final simplification57.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.05e+81) (not (<= x 1.7e+56))) (* 4.0 (/ x y)) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.05e+81) || !(x <= 1.7e+56)) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.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.05d+81)) .or. (.not. (x <= 1.7d+56))) then
tmp = 4.0d0 * (x / y)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.05e+81) || !(x <= 1.7e+56)) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.05e+81) or not (x <= 1.7e+56): tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.05e+81) || !(x <= 1.7e+56)) tmp = Float64(4.0 * Float64(x / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.05e+81) || ~((x <= 1.7e+56))) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.05e+81], N[Not[LessEqual[x, 1.7e+56]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+81} \lor \neg \left(x \leq 1.7 \cdot 10^{+56}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if x < -1.0499999999999999e81 or 1.7e56 < x Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in x around inf 78.3%
*-commutative78.3%
associate-*r/78.4%
Applied egg-rr78.4%
Taylor expanded in x around inf 76.6%
if -1.0499999999999999e81 < x < 1.7e56Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 42.6%
Final simplification57.1%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
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
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in x around inf 42.7%
Taylor expanded in y around inf 7.2%
Final simplification7.2%
(FPCore (x y z) :precision binary64 4.0)
double code(double x, double y, double z) {
return 4.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
end function
public static double code(double x, double y, double z) {
return 4.0;
}
def code(x, y, z): return 4.0
function code(x, y, z) return 4.0 end
function tmp = code(x, y, z) tmp = 4.0; end
code[x_, y_, z_] := 4.0
\begin{array}{l}
\\
4
\end{array}
Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 31.4%
Final simplification31.4%
herbie shell --seed 2023274
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))