
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (+ y (* 4.0 (- x z))) y)))
double code(double x, double y, double z) {
return 1.0 + ((y + (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 = 1.0d0 + ((y + (4.0d0 * (x - z))) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((y + (4.0 * (x - z))) / y);
}
def code(x, y, z): return 1.0 + ((y + (4.0 * (x - z))) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(y + Float64(4.0 * Float64(x - z))) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((y + (4.0 * (x - z))) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(y + N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{y + 4 \cdot \left(x - z\right)}{y}
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ z y) -4.0)))
(if (<= z -8.5e+44)
t_0
(if (<= z 1.95e-305) (/ (* 4.0 x) y) (if (<= z 1.15e+64) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double tmp;
if (z <= -8.5e+44) {
tmp = t_0;
} else if (z <= 1.95e-305) {
tmp = (4.0 * x) / y;
} else if (z <= 1.15e+64) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z / y) * (-4.0d0)
if (z <= (-8.5d+44)) then
tmp = t_0
else if (z <= 1.95d-305) then
tmp = (4.0d0 * x) / y
else if (z <= 1.15d+64) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double tmp;
if (z <= -8.5e+44) {
tmp = t_0;
} else if (z <= 1.95e-305) {
tmp = (4.0 * x) / y;
} else if (z <= 1.15e+64) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 tmp = 0 if z <= -8.5e+44: tmp = t_0 elif z <= 1.95e-305: tmp = (4.0 * x) / y elif z <= 1.15e+64: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) tmp = 0.0 if (z <= -8.5e+44) tmp = t_0; elseif (z <= 1.95e-305) tmp = Float64(Float64(4.0 * x) / y); elseif (z <= 1.15e+64) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; tmp = 0.0; if (z <= -8.5e+44) tmp = t_0; elseif (z <= 1.95e-305) tmp = (4.0 * x) / y; elseif (z <= 1.15e+64) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[z, -8.5e+44], t$95$0, If[LessEqual[z, 1.95e-305], N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 1.15e+64], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-305}:\\
\;\;\;\;\frac{4 \cdot x}{y}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+64}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -8.5e44 or 1.15e64 < z Initial program 100.0%
Taylor expanded in z around inf 74.9%
*-commutative74.9%
Simplified74.9%
if -8.5e44 < z < 1.95000000000000013e-305Initial program 99.9%
Taylor expanded in x around inf 55.5%
associate-*r/55.5%
Simplified55.5%
if 1.95000000000000013e-305 < z < 1.15e64Initial program 100.0%
Taylor expanded in y around inf 52.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ z y) -4.0)))
(if (<= z -7.8e+46)
t_0
(if (<= z 7e-305) (* x (/ 4.0 y)) (if (<= z 1.15e+62) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double tmp;
if (z <= -7.8e+46) {
tmp = t_0;
} else if (z <= 7e-305) {
tmp = x * (4.0 / y);
} else if (z <= 1.15e+62) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z / y) * (-4.0d0)
if (z <= (-7.8d+46)) then
tmp = t_0
else if (z <= 7d-305) then
tmp = x * (4.0d0 / y)
else if (z <= 1.15d+62) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double tmp;
if (z <= -7.8e+46) {
tmp = t_0;
} else if (z <= 7e-305) {
tmp = x * (4.0 / y);
} else if (z <= 1.15e+62) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 tmp = 0 if z <= -7.8e+46: tmp = t_0 elif z <= 7e-305: tmp = x * (4.0 / y) elif z <= 1.15e+62: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) tmp = 0.0 if (z <= -7.8e+46) tmp = t_0; elseif (z <= 7e-305) tmp = Float64(x * Float64(4.0 / y)); elseif (z <= 1.15e+62) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; tmp = 0.0; if (z <= -7.8e+46) tmp = t_0; elseif (z <= 7e-305) tmp = x * (4.0 / y); elseif (z <= 1.15e+62) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[z, -7.8e+46], t$95$0, If[LessEqual[z, 7e-305], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e+62], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-305}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+62}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.7999999999999999e46 or 1.14999999999999992e62 < z Initial program 100.0%
Taylor expanded in z around inf 74.9%
*-commutative74.9%
Simplified74.9%
if -7.7999999999999999e46 < z < 6.9999999999999996e-305Initial program 99.9%
Taylor expanded in x around inf 55.5%
associate-*r/55.5%
associate-*l/55.4%
*-commutative55.4%
Simplified55.4%
if 6.9999999999999996e-305 < z < 1.14999999999999992e62Initial program 100.0%
Taylor expanded in y around inf 52.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (/ -4.0 y))))
(if (<= z -2.6e+44)
t_0
(if (<= z 3.5e-306) (* x (/ 4.0 y)) (if (<= z 8.8e+61) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (z <= -2.6e+44) {
tmp = t_0;
} else if (z <= 3.5e-306) {
tmp = x * (4.0 / y);
} else if (z <= 8.8e+61) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * ((-4.0d0) / y)
if (z <= (-2.6d+44)) then
tmp = t_0
else if (z <= 3.5d-306) then
tmp = x * (4.0d0 / y)
else if (z <= 8.8d+61) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (z <= -2.6e+44) {
tmp = t_0;
} else if (z <= 3.5e-306) {
tmp = x * (4.0 / y);
} else if (z <= 8.8e+61) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-4.0 / y) tmp = 0 if z <= -2.6e+44: tmp = t_0 elif z <= 3.5e-306: tmp = x * (4.0 / y) elif z <= 8.8e+61: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-4.0 / y)) tmp = 0.0 if (z <= -2.6e+44) tmp = t_0; elseif (z <= 3.5e-306) tmp = Float64(x * Float64(4.0 / y)); elseif (z <= 8.8e+61) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-4.0 / y); tmp = 0.0; if (z <= -2.6e+44) tmp = t_0; elseif (z <= 3.5e-306) tmp = x * (4.0 / y); elseif (z <= 8.8e+61) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.6e+44], t$95$0, If[LessEqual[z, 3.5e-306], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e+61], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{-4}{y}\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-306}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{+61}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.5999999999999999e44 or 8.8000000000000001e61 < z Initial program 100.0%
Taylor expanded in z around inf 74.9%
associate-*r/74.9%
*-commutative74.9%
associate-/l*74.7%
Simplified74.7%
if -2.5999999999999999e44 < z < 3.50000000000000018e-306Initial program 99.9%
Taylor expanded in x around inf 55.5%
associate-*r/55.5%
associate-*l/55.4%
*-commutative55.4%
Simplified55.4%
if 3.50000000000000018e-306 < z < 8.8000000000000001e61Initial program 100.0%
Taylor expanded in y around inf 52.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.25e+44) (not (<= z 1.3e+57))) (+ 2.0 (* (/ z y) -4.0)) (+ 2.0 (* x (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e+44) || !(z <= 1.3e+57)) {
tmp = 2.0 + ((z / y) * -4.0);
} 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.25d+44)) .or. (.not. (z <= 1.3d+57))) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
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.25e+44) || !(z <= 1.3e+57)) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 2.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.25e+44) or not (z <= 1.3e+57): tmp = 2.0 + ((z / y) * -4.0) else: tmp = 2.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.25e+44) || !(z <= 1.3e+57)) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); 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.25e+44) || ~((z <= 1.3e+57))) tmp = 2.0 + ((z / y) * -4.0); else tmp = 2.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25e+44], N[Not[LessEqual[z, 1.3e+57]], $MachinePrecision]], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $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.25 \cdot 10^{+44} \lor \neg \left(z \leq 1.3 \cdot 10^{+57}\right):\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -1.2499999999999999e44 or 1.3e57 < z 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%
Taylor expanded in x around 0 91.7%
*-commutative91.7%
Simplified91.7%
if -1.2499999999999999e44 < z < 1.3e57Initial 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%
Taylor expanded in x around inf 90.1%
Final simplification90.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.5e-71) (not (<= y 7e+138))) (+ 2.0 (* (/ z y) -4.0)) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.5e-71) || !(y <= 7e+138)) {
tmp = 2.0 + ((z / y) * -4.0);
} 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 <= (-2.5d-71)) .or. (.not. (y <= 7d+138))) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
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 <= -2.5e-71) || !(y <= 7e+138)) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.5e-71) or not (y <= 7e+138): tmp = 2.0 + ((z / y) * -4.0) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.5e-71) || !(y <= 7e+138)) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); 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 <= -2.5e-71) || ~((y <= 7e+138))) tmp = 2.0 + ((z / y) * -4.0); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.5e-71], N[Not[LessEqual[y, 7e+138]], $MachinePrecision]], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-71} \lor \neg \left(y \leq 7 \cdot 10^{+138}\right):\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -2.49999999999999999e-71 or 6.9999999999999996e138 < 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 x around 0 83.0%
*-commutative83.0%
Simplified83.0%
if -2.49999999999999999e-71 < y < 6.9999999999999996e138Initial program 100.0%
Taylor expanded in y around 0 87.8%
Final simplification85.6%
(FPCore (x y z) :precision binary64 (if (<= y -5.1e+141) 2.0 (if (<= y 2.05e+139) (* 4.0 (/ (- x z) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.1e+141) {
tmp = 2.0;
} else if (y <= 2.05e+139) {
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 <= (-5.1d+141)) then
tmp = 2.0d0
else if (y <= 2.05d+139) 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 <= -5.1e+141) {
tmp = 2.0;
} else if (y <= 2.05e+139) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.1e+141: tmp = 2.0 elif y <= 2.05e+139: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.1e+141) tmp = 2.0; elseif (y <= 2.05e+139) 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 <= -5.1e+141) tmp = 2.0; elseif (y <= 2.05e+139) tmp = 4.0 * ((x - z) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.1e+141], 2.0, If[LessEqual[y, 2.05e+139], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.1 \cdot 10^{+141}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+139}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -5.0999999999999997e141 or 2.0500000000000001e139 < y Initial program 100.0%
Taylor expanded in y around inf 82.0%
if -5.0999999999999997e141 < y < 2.0500000000000001e139Initial program 100.0%
Taylor expanded in y around 0 80.5%
(FPCore (x y z) :precision binary64 (if (<= y -1.3e-73) 2.0 (if (<= y 7e+138) (* x (/ 4.0 y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e-73) {
tmp = 2.0;
} else if (y <= 7e+138) {
tmp = x * (4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.3d-73)) then
tmp = 2.0d0
else if (y <= 7d+138) then
tmp = x * (4.0d0 / y)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e-73) {
tmp = 2.0;
} else if (y <= 7e+138) {
tmp = x * (4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.3e-73: tmp = 2.0 elif y <= 7e+138: tmp = x * (4.0 / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.3e-73) tmp = 2.0; elseif (y <= 7e+138) tmp = Float64(x * Float64(4.0 / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.3e-73) tmp = 2.0; elseif (y <= 7e+138) tmp = x * (4.0 / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.3e-73], 2.0, If[LessEqual[y, 7e+138], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-73}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+138}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.3e-73 or 6.9999999999999996e138 < y Initial program 100.0%
Taylor expanded in y around inf 61.3%
if -1.3e-73 < y < 6.9999999999999996e138Initial program 100.0%
Taylor expanded in x around inf 48.9%
associate-*r/48.9%
associate-*l/48.8%
*-commutative48.8%
Simplified48.8%
(FPCore (x y z) :precision binary64 (+ (* (- x z) (/ 4.0 y)) 2.0))
double code(double x, double y, double z) {
return ((x - z) * (4.0 / y)) + 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) * (4.0d0 / y)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return ((x - z) * (4.0 / y)) + 2.0;
}
def code(x, y, z): return ((x - z) * (4.0 / y)) + 2.0
function code(x, y, z) return Float64(Float64(Float64(x - z) * Float64(4.0 / y)) + 2.0) end
function tmp = code(x, y, z) tmp = ((x - z) * (4.0 / y)) + 2.0; end
code[x_, y_, z_] := N[(N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(x - z\right) \cdot \frac{4}{y} + 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%
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 100.0%
Taylor expanded in y around inf 35.1%
herbie shell --seed 2024139
(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)))