
(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 9 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)) (t_1 (/ (* 4.0 x) y)))
(if (<= y -9e+70)
2.0
(if (<= y -65.0)
t_1
(if (<= y -1.2e-94)
t_0
(if (<= y 3.3e-157) t_1 (if (<= y 6.5e+132) t_0 2.0)))))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double t_1 = (4.0 * x) / y;
double tmp;
if (y <= -9e+70) {
tmp = 2.0;
} else if (y <= -65.0) {
tmp = t_1;
} else if (y <= -1.2e-94) {
tmp = t_0;
} else if (y <= 3.3e-157) {
tmp = t_1;
} else if (y <= 6.5e+132) {
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 / y) * (-4.0d0)
t_1 = (4.0d0 * x) / y
if (y <= (-9d+70)) then
tmp = 2.0d0
else if (y <= (-65.0d0)) then
tmp = t_1
else if (y <= (-1.2d-94)) then
tmp = t_0
else if (y <= 3.3d-157) then
tmp = t_1
else if (y <= 6.5d+132) 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 t_1 = (4.0 * x) / y;
double tmp;
if (y <= -9e+70) {
tmp = 2.0;
} else if (y <= -65.0) {
tmp = t_1;
} else if (y <= -1.2e-94) {
tmp = t_0;
} else if (y <= 3.3e-157) {
tmp = t_1;
} else if (y <= 6.5e+132) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 t_1 = (4.0 * x) / y tmp = 0 if y <= -9e+70: tmp = 2.0 elif y <= -65.0: tmp = t_1 elif y <= -1.2e-94: tmp = t_0 elif y <= 3.3e-157: tmp = t_1 elif y <= 6.5e+132: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) t_1 = Float64(Float64(4.0 * x) / y) tmp = 0.0 if (y <= -9e+70) tmp = 2.0; elseif (y <= -65.0) tmp = t_1; elseif (y <= -1.2e-94) tmp = t_0; elseif (y <= 3.3e-157) tmp = t_1; elseif (y <= 6.5e+132) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; t_1 = (4.0 * x) / y; tmp = 0.0; if (y <= -9e+70) tmp = 2.0; elseif (y <= -65.0) tmp = t_1; elseif (y <= -1.2e-94) tmp = t_0; elseif (y <= 3.3e-157) tmp = t_1; elseif (y <= 6.5e+132) 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]}, Block[{t$95$1 = N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -9e+70], 2.0, If[LessEqual[y, -65.0], t$95$1, If[LessEqual[y, -1.2e-94], t$95$0, If[LessEqual[y, 3.3e-157], t$95$1, If[LessEqual[y, 6.5e+132], t$95$0, 2.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
t_1 := \frac{4 \cdot x}{y}\\
\mathbf{if}\;y \leq -9 \cdot 10^{+70}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -65:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{-94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+132}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -8.9999999999999999e70 or 6.4999999999999994e132 < y Initial program 100.0%
Taylor expanded in y around inf 68.7%
if -8.9999999999999999e70 < y < -65 or -1.2e-94 < y < 3.29999999999999999e-157Initial program 100.0%
Taylor expanded in x around inf 70.0%
associate-*r/70.0%
Simplified70.0%
if -65 < y < -1.2e-94 or 3.29999999999999999e-157 < y < 6.4999999999999994e132Initial program 100.0%
Taylor expanded in z around inf 56.4%
*-commutative56.4%
Simplified56.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ z y) -4.0)) (t_1 (* x (/ 4.0 y))))
(if (<= y -8.6e+70)
2.0
(if (<= y -30000.0)
t_1
(if (<= y -1.7e-94)
t_0
(if (<= y 8.8e-157) t_1 (if (<= y 2.45e+132) t_0 2.0)))))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double t_1 = x * (4.0 / y);
double tmp;
if (y <= -8.6e+70) {
tmp = 2.0;
} else if (y <= -30000.0) {
tmp = t_1;
} else if (y <= -1.7e-94) {
tmp = t_0;
} else if (y <= 8.8e-157) {
tmp = t_1;
} else if (y <= 2.45e+132) {
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 / y) * (-4.0d0)
t_1 = x * (4.0d0 / y)
if (y <= (-8.6d+70)) then
tmp = 2.0d0
else if (y <= (-30000.0d0)) then
tmp = t_1
else if (y <= (-1.7d-94)) then
tmp = t_0
else if (y <= 8.8d-157) then
tmp = t_1
else if (y <= 2.45d+132) 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 t_1 = x * (4.0 / y);
double tmp;
if (y <= -8.6e+70) {
tmp = 2.0;
} else if (y <= -30000.0) {
tmp = t_1;
} else if (y <= -1.7e-94) {
tmp = t_0;
} else if (y <= 8.8e-157) {
tmp = t_1;
} else if (y <= 2.45e+132) {
tmp = t_0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 t_1 = x * (4.0 / y) tmp = 0 if y <= -8.6e+70: tmp = 2.0 elif y <= -30000.0: tmp = t_1 elif y <= -1.7e-94: tmp = t_0 elif y <= 8.8e-157: tmp = t_1 elif y <= 2.45e+132: tmp = t_0 else: tmp = 2.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) t_1 = Float64(x * Float64(4.0 / y)) tmp = 0.0 if (y <= -8.6e+70) tmp = 2.0; elseif (y <= -30000.0) tmp = t_1; elseif (y <= -1.7e-94) tmp = t_0; elseif (y <= 8.8e-157) tmp = t_1; elseif (y <= 2.45e+132) tmp = t_0; else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; t_1 = x * (4.0 / y); tmp = 0.0; if (y <= -8.6e+70) tmp = 2.0; elseif (y <= -30000.0) tmp = t_1; elseif (y <= -1.7e-94) tmp = t_0; elseif (y <= 8.8e-157) tmp = t_1; elseif (y <= 2.45e+132) 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]}, Block[{t$95$1 = N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.6e+70], 2.0, If[LessEqual[y, -30000.0], t$95$1, If[LessEqual[y, -1.7e-94], t$95$0, If[LessEqual[y, 8.8e-157], t$95$1, If[LessEqual[y, 2.45e+132], t$95$0, 2.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
t_1 := x \cdot \frac{4}{y}\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{+70}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -30000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.7 \cdot 10^{-94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{+132}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -8.6000000000000002e70 or 2.4500000000000001e132 < y Initial program 100.0%
Taylor expanded in y around inf 68.7%
if -8.6000000000000002e70 < y < -3e4 or -1.6999999999999999e-94 < y < 8.80000000000000041e-157Initial program 100.0%
Taylor expanded in x around inf 70.0%
associate-*r/70.0%
associate-*l/69.9%
*-commutative69.9%
Simplified69.9%
if -3e4 < y < -1.6999999999999999e-94 or 8.80000000000000041e-157 < y < 2.4500000000000001e132Initial program 100.0%
Taylor expanded in z around inf 56.4%
*-commutative56.4%
Simplified56.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.2e+82) (not (<= y 2.4e+132))) (+ 2.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.2e+82) || !(y <= 2.4e+132)) {
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 <= (-5.2d+82)) .or. (.not. (y <= 2.4d+132))) 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 <= -5.2e+82) || !(y <= 2.4e+132)) {
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 <= -5.2e+82) or not (y <= 2.4e+132): 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 <= -5.2e+82) || !(y <= 2.4e+132)) 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 <= -5.2e+82) || ~((y <= 2.4e+132))) 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, -5.2e+82], N[Not[LessEqual[y, 2.4e+132]], $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 -5.2 \cdot 10^{+82} \lor \neg \left(y \leq 2.4 \cdot 10^{+132}\right):\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -5.1999999999999997e82 or 2.4000000000000001e132 < y Initial program 100.0%
+-commutative100.0%
associate-*l/99.9%
+-commutative99.9%
associate--l+99.9%
+-commutative99.9%
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 z around 0 87.9%
if -5.1999999999999997e82 < y < 2.4000000000000001e132Initial program 100.0%
Taylor expanded in y around 0 90.2%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (if (<= y -5.6e+70) (+ 2.0 (* (/ z y) -4.0)) (if (<= y 6.5e+132) (* 4.0 (/ (- x z) y)) (+ 2.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.6e+70) {
tmp = 2.0 + ((z / y) * -4.0);
} else if (y <= 6.5e+132) {
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 <= (-5.6d+70)) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
else if (y <= 6.5d+132) 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 <= -5.6e+70) {
tmp = 2.0 + ((z / y) * -4.0);
} else if (y <= 6.5e+132) {
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 <= -5.6e+70: tmp = 2.0 + ((z / y) * -4.0) elif y <= 6.5e+132: 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 <= -5.6e+70) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); elseif (y <= 6.5e+132) 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 <= -5.6e+70) tmp = 2.0 + ((z / y) * -4.0); elseif (y <= 6.5e+132) 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, -5.6e+70], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+132], 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 -5.6 \cdot 10^{+70}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+132}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -5.59999999999999979e70Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.7%
associate-+l+99.8%
associate-*l/99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
*-rgt-identity99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 84.9%
*-commutative84.9%
Simplified84.9%
if -5.59999999999999979e70 < y < 6.4999999999999994e132Initial program 100.0%
Taylor expanded in y around 0 91.0%
if 6.4999999999999994e132 < 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 100.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.2e+178) 2.0 (if (<= y 9e+158) (* 4.0 (/ (- x z) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.2e+178) {
tmp = 2.0;
} else if (y <= 9e+158) {
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.2d+178)) then
tmp = 2.0d0
else if (y <= 9d+158) 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.2e+178) {
tmp = 2.0;
} else if (y <= 9e+158) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.2e+178: tmp = 2.0 elif y <= 9e+158: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.2e+178) tmp = 2.0; elseif (y <= 9e+158) 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.2e+178) tmp = 2.0; elseif (y <= 9e+158) tmp = 4.0 * ((x - z) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.2e+178], 2.0, If[LessEqual[y, 9e+158], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+178}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+158}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -2.19999999999999997e178 or 9.00000000000000092e158 < y Initial program 100.0%
Taylor expanded in y around inf 80.7%
if -2.19999999999999997e178 < y < 9.00000000000000092e158Initial program 100.0%
Taylor expanded in y around 0 86.5%
(FPCore (x y z) :precision binary64 (if (<= y -9.5e+70) 2.0 (if (<= y 7e+89) (* x (/ 4.0 y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.5e+70) {
tmp = 2.0;
} else if (y <= 7e+89) {
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 <= (-9.5d+70)) then
tmp = 2.0d0
else if (y <= 7d+89) 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 <= -9.5e+70) {
tmp = 2.0;
} else if (y <= 7e+89) {
tmp = x * (4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.5e+70: tmp = 2.0 elif y <= 7e+89: tmp = x * (4.0 / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.5e+70) tmp = 2.0; elseif (y <= 7e+89) 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 <= -9.5e+70) tmp = 2.0; elseif (y <= 7e+89) tmp = x * (4.0 / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.5e+70], 2.0, If[LessEqual[y, 7e+89], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+70}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -9.5000000000000002e70 or 7.0000000000000001e89 < y Initial program 100.0%
Taylor expanded in y around inf 64.7%
if -9.5000000000000002e70 < y < 7.0000000000000001e89Initial program 100.0%
Taylor expanded in x around inf 54.8%
associate-*r/54.8%
associate-*l/54.6%
*-commutative54.6%
Simplified54.6%
(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 29.0%
herbie shell --seed 2024129
(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)))