
(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 8 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 (+ 4.0 (/ (* 4.0 (- x z)) y)))
double code(double x, double y, double z) {
return 4.0 + ((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 = 4.0d0 + ((4.0d0 * (x - z)) / y)
end function
public static double code(double x, double y, double z) {
return 4.0 + ((4.0 * (x - z)) / y);
}
def code(x, y, z): return 4.0 + ((4.0 * (x - z)) / y)
function code(x, y, z) return Float64(4.0 + Float64(Float64(4.0 * Float64(x - z)) / y)) end
function tmp = code(x, y, z) tmp = 4.0 + ((4.0 * (x - z)) / y); end
code[x_, y_, z_] := N[(4.0 + N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 + \frac{4 \cdot \left(x - z\right)}{y}
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
*-commutative99.8%
fma-def99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l-99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
+-commutative99.8%
distribute-neg-in99.8%
distribute-lft-neg-out99.8%
sub-neg99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
fma-neg99.8%
metadata-eval99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* -4.0 (/ z y)) 1.0)) (t_1 (+ 1.0 (* x (/ 4.0 y)))))
(if (<= y -1650000000.0)
4.0
(if (<= y -2.2e-308)
t_1
(if (<= y 5.6e-251)
t_0
(if (<= y 8.6e-157) t_1 (if (<= y 1.8e+36) t_0 4.0)))))))
double code(double x, double y, double z) {
double t_0 = (-4.0 * (z / y)) + 1.0;
double t_1 = 1.0 + (x * (4.0 / y));
double tmp;
if (y <= -1650000000.0) {
tmp = 4.0;
} else if (y <= -2.2e-308) {
tmp = t_1;
} else if (y <= 5.6e-251) {
tmp = t_0;
} else if (y <= 8.6e-157) {
tmp = t_1;
} else if (y <= 1.8e+36) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((-4.0d0) * (z / y)) + 1.0d0
t_1 = 1.0d0 + (x * (4.0d0 / y))
if (y <= (-1650000000.0d0)) then
tmp = 4.0d0
else if (y <= (-2.2d-308)) then
tmp = t_1
else if (y <= 5.6d-251) then
tmp = t_0
else if (y <= 8.6d-157) then
tmp = t_1
else if (y <= 1.8d+36) then
tmp = t_0
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (-4.0 * (z / y)) + 1.0;
double t_1 = 1.0 + (x * (4.0 / y));
double tmp;
if (y <= -1650000000.0) {
tmp = 4.0;
} else if (y <= -2.2e-308) {
tmp = t_1;
} else if (y <= 5.6e-251) {
tmp = t_0;
} else if (y <= 8.6e-157) {
tmp = t_1;
} else if (y <= 1.8e+36) {
tmp = t_0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): t_0 = (-4.0 * (z / y)) + 1.0 t_1 = 1.0 + (x * (4.0 / y)) tmp = 0 if y <= -1650000000.0: tmp = 4.0 elif y <= -2.2e-308: tmp = t_1 elif y <= 5.6e-251: tmp = t_0 elif y <= 8.6e-157: tmp = t_1 elif y <= 1.8e+36: tmp = t_0 else: tmp = 4.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-4.0 * Float64(z / y)) + 1.0) t_1 = Float64(1.0 + Float64(x * Float64(4.0 / y))) tmp = 0.0 if (y <= -1650000000.0) tmp = 4.0; elseif (y <= -2.2e-308) tmp = t_1; elseif (y <= 5.6e-251) tmp = t_0; elseif (y <= 8.6e-157) tmp = t_1; elseif (y <= 1.8e+36) tmp = t_0; else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-4.0 * (z / y)) + 1.0; t_1 = 1.0 + (x * (4.0 / y)); tmp = 0.0; if (y <= -1650000000.0) tmp = 4.0; elseif (y <= -2.2e-308) tmp = t_1; elseif (y <= 5.6e-251) tmp = t_0; elseif (y <= 8.6e-157) tmp = t_1; elseif (y <= 1.8e+36) tmp = t_0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1650000000.0], 4.0, If[LessEqual[y, -2.2e-308], t$95$1, If[LessEqual[y, 5.6e-251], t$95$0, If[LessEqual[y, 8.6e-157], t$95$1, If[LessEqual[y, 1.8e+36], t$95$0, 4.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{z}{y} + 1\\
t_1 := 1 + x \cdot \frac{4}{y}\\
\mathbf{if}\;y \leq -1650000000:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-308}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-251}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-157}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+36}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.65e9 or 1.7999999999999999e36 < y Initial program 99.9%
+-commutative99.9%
associate-*l/99.7%
*-commutative99.7%
fma-def99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l-99.7%
sub-neg99.7%
remove-double-neg99.7%
distribute-neg-in99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-lft-neg-out99.7%
sub-neg99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
fma-neg99.7%
metadata-eval99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in y around inf 70.3%
if -1.65e9 < y < -2.2000000000000002e-308 or 5.59999999999999978e-251 < y < 8.5999999999999995e-157Initial program 100.0%
associate-*l/99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around inf 64.3%
if -2.2000000000000002e-308 < y < 5.59999999999999978e-251 or 8.5999999999999995e-157 < y < 1.7999999999999999e36Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around inf 64.6%
*-commutative64.6%
Simplified64.6%
Final simplification67.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* -4.0 (/ z y)) 1.0)) (t_1 (+ 1.0 (/ (* 4.0 x) y))))
(if (<= y -3100000000.0)
4.0
(if (<= y 1.32e-301)
t_1
(if (<= y 3.5e-253)
t_0
(if (<= y 1.6e-158) t_1 (if (<= y 1.15e+37) t_0 4.0)))))))
double code(double x, double y, double z) {
double t_0 = (-4.0 * (z / y)) + 1.0;
double t_1 = 1.0 + ((4.0 * x) / y);
double tmp;
if (y <= -3100000000.0) {
tmp = 4.0;
} else if (y <= 1.32e-301) {
tmp = t_1;
} else if (y <= 3.5e-253) {
tmp = t_0;
} else if (y <= 1.6e-158) {
tmp = t_1;
} else if (y <= 1.15e+37) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((-4.0d0) * (z / y)) + 1.0d0
t_1 = 1.0d0 + ((4.0d0 * x) / y)
if (y <= (-3100000000.0d0)) then
tmp = 4.0d0
else if (y <= 1.32d-301) then
tmp = t_1
else if (y <= 3.5d-253) then
tmp = t_0
else if (y <= 1.6d-158) then
tmp = t_1
else if (y <= 1.15d+37) then
tmp = t_0
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (-4.0 * (z / y)) + 1.0;
double t_1 = 1.0 + ((4.0 * x) / y);
double tmp;
if (y <= -3100000000.0) {
tmp = 4.0;
} else if (y <= 1.32e-301) {
tmp = t_1;
} else if (y <= 3.5e-253) {
tmp = t_0;
} else if (y <= 1.6e-158) {
tmp = t_1;
} else if (y <= 1.15e+37) {
tmp = t_0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): t_0 = (-4.0 * (z / y)) + 1.0 t_1 = 1.0 + ((4.0 * x) / y) tmp = 0 if y <= -3100000000.0: tmp = 4.0 elif y <= 1.32e-301: tmp = t_1 elif y <= 3.5e-253: tmp = t_0 elif y <= 1.6e-158: tmp = t_1 elif y <= 1.15e+37: tmp = t_0 else: tmp = 4.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-4.0 * Float64(z / y)) + 1.0) t_1 = Float64(1.0 + Float64(Float64(4.0 * x) / y)) tmp = 0.0 if (y <= -3100000000.0) tmp = 4.0; elseif (y <= 1.32e-301) tmp = t_1; elseif (y <= 3.5e-253) tmp = t_0; elseif (y <= 1.6e-158) tmp = t_1; elseif (y <= 1.15e+37) tmp = t_0; else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-4.0 * (z / y)) + 1.0; t_1 = 1.0 + ((4.0 * x) / y); tmp = 0.0; if (y <= -3100000000.0) tmp = 4.0; elseif (y <= 1.32e-301) tmp = t_1; elseif (y <= 3.5e-253) tmp = t_0; elseif (y <= 1.6e-158) tmp = t_1; elseif (y <= 1.15e+37) tmp = t_0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3100000000.0], 4.0, If[LessEqual[y, 1.32e-301], t$95$1, If[LessEqual[y, 3.5e-253], t$95$0, If[LessEqual[y, 1.6e-158], t$95$1, If[LessEqual[y, 1.15e+37], t$95$0, 4.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{z}{y} + 1\\
t_1 := 1 + \frac{4 \cdot x}{y}\\
\mathbf{if}\;y \leq -3100000000:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{-301}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-253}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+37}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -3.1e9 or 1.15000000000000001e37 < y Initial program 99.9%
+-commutative99.9%
associate-*l/99.7%
*-commutative99.7%
fma-def99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l-99.7%
sub-neg99.7%
remove-double-neg99.7%
distribute-neg-in99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-lft-neg-out99.7%
sub-neg99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
fma-neg99.7%
metadata-eval99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in y around inf 70.3%
if -3.1e9 < y < 1.3200000000000001e-301 or 3.50000000000000022e-253 < y < 1.59999999999999998e-158Initial program 100.0%
associate-*l/99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around inf 64.4%
associate-*r/64.4%
*-commutative64.4%
Simplified64.4%
if 1.3200000000000001e-301 < y < 3.50000000000000022e-253 or 1.59999999999999998e-158 < y < 1.15000000000000001e37Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around inf 64.6%
*-commutative64.6%
Simplified64.6%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.6e+130) (not (<= z 2.2e+101))) (+ (* -4.0 (/ z y)) 1.0) (+ 4.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e+130) || !(z <= 2.2e+101)) {
tmp = (-4.0 * (z / y)) + 1.0;
} else {
tmp = 4.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 ((z <= (-3.6d+130)) .or. (.not. (z <= 2.2d+101))) then
tmp = ((-4.0d0) * (z / y)) + 1.0d0
else
tmp = 4.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e+130) || !(z <= 2.2e+101)) {
tmp = (-4.0 * (z / y)) + 1.0;
} else {
tmp = 4.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.6e+130) or not (z <= 2.2e+101): tmp = (-4.0 * (z / y)) + 1.0 else: tmp = 4.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.6e+130) || !(z <= 2.2e+101)) tmp = Float64(Float64(-4.0 * Float64(z / y)) + 1.0); else tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.6e+130) || ~((z <= 2.2e+101))) tmp = (-4.0 * (z / y)) + 1.0; else tmp = 4.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.6e+130], N[Not[LessEqual[z, 2.2e+101]], $MachinePrecision]], N[(N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+130} \lor \neg \left(z \leq 2.2 \cdot 10^{+101}\right):\\
\;\;\;\;-4 \cdot \frac{z}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -3.6000000000000001e130 or 2.2000000000000001e101 < z Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around inf 76.6%
*-commutative76.6%
Simplified76.6%
if -3.6000000000000001e130 < z < 2.2000000000000001e101Initial program 99.9%
+-commutative99.9%
associate-*l/99.8%
*-commutative99.8%
fma-def99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l-99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
+-commutative99.8%
distribute-neg-in99.8%
distribute-lft-neg-out99.8%
sub-neg99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
fma-neg99.8%
metadata-eval99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 92.5%
Final simplification87.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.02e+46) (not (<= z 3.1e+97))) (+ 4.0 (* -4.0 (/ z y))) (+ 4.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.02e+46) || !(z <= 3.1e+97)) {
tmp = 4.0 + (-4.0 * (z / y));
} else {
tmp = 4.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 ((z <= (-1.02d+46)) .or. (.not. (z <= 3.1d+97))) then
tmp = 4.0d0 + ((-4.0d0) * (z / y))
else
tmp = 4.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.02e+46) || !(z <= 3.1e+97)) {
tmp = 4.0 + (-4.0 * (z / y));
} else {
tmp = 4.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.02e+46) or not (z <= 3.1e+97): tmp = 4.0 + (-4.0 * (z / y)) else: tmp = 4.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.02e+46) || !(z <= 3.1e+97)) tmp = Float64(4.0 + Float64(-4.0 * Float64(z / y))); else tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.02e+46) || ~((z <= 3.1e+97))) tmp = 4.0 + (-4.0 * (z / y)); else tmp = 4.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.02e+46], N[Not[LessEqual[z, 3.1e+97]], $MachinePrecision]], N[(4.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+46} \lor \neg \left(z \leq 3.1 \cdot 10^{+97}\right):\\
\;\;\;\;4 + -4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -1.0199999999999999e46 or 3.09999999999999981e97 < z Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
*-commutative99.8%
fma-def99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l-99.7%
sub-neg99.7%
remove-double-neg99.7%
distribute-neg-in99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-lft-neg-out99.7%
sub-neg99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
fma-neg99.7%
metadata-eval99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 88.2%
+-commutative88.2%
Simplified88.2%
if -1.0199999999999999e46 < z < 3.09999999999999981e97Initial program 99.9%
+-commutative99.9%
associate-*l/99.8%
*-commutative99.8%
fma-def99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l-99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
+-commutative99.8%
distribute-neg-in99.8%
distribute-lft-neg-out99.8%
sub-neg99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
fma-neg99.8%
metadata-eval99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 94.9%
Final simplification92.3%
(FPCore (x y z) :precision binary64 (if (<= y -5600000000.0) 4.0 (if (<= y 1.5e+67) (+ 1.0 (* x (/ 4.0 y))) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5600000000.0) {
tmp = 4.0;
} else if (y <= 1.5e+67) {
tmp = 1.0 + (x * (4.0 / 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 <= (-5600000000.0d0)) then
tmp = 4.0d0
else if (y <= 1.5d+67) then
tmp = 1.0d0 + (x * (4.0d0 / 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 <= -5600000000.0) {
tmp = 4.0;
} else if (y <= 1.5e+67) {
tmp = 1.0 + (x * (4.0 / y));
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5600000000.0: tmp = 4.0 elif y <= 1.5e+67: tmp = 1.0 + (x * (4.0 / y)) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5600000000.0) tmp = 4.0; elseif (y <= 1.5e+67) tmp = Float64(1.0 + Float64(x * Float64(4.0 / y))); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5600000000.0) tmp = 4.0; elseif (y <= 1.5e+67) tmp = 1.0 + (x * (4.0 / y)); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5600000000.0], 4.0, If[LessEqual[y, 1.5e+67], N[(1.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5600000000:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+67}:\\
\;\;\;\;1 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -5.6e9 or 1.50000000000000005e67 < y Initial program 99.9%
+-commutative99.9%
associate-*l/99.7%
*-commutative99.7%
fma-def99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l-99.7%
sub-neg99.7%
remove-double-neg99.7%
distribute-neg-in99.7%
+-commutative99.7%
distribute-neg-in99.7%
distribute-lft-neg-out99.7%
sub-neg99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
fma-neg99.7%
metadata-eval99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in y around inf 70.9%
if -5.6e9 < y < 1.50000000000000005e67Initial program 100.0%
associate-*l/99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around inf 51.6%
Final simplification61.8%
(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.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in x around inf 38.1%
Taylor expanded in y around inf 8.8%
Final simplification8.8%
(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%
+-commutative100.0%
associate-*l/99.8%
*-commutative99.8%
fma-def99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l-99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
+-commutative99.8%
distribute-neg-in99.8%
distribute-lft-neg-out99.8%
sub-neg99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
fma-neg99.8%
metadata-eval99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in y around inf 41.8%
Final simplification41.8%
herbie shell --seed 2024013
(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)))