
(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 (+ (* (/ 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 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%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+157) (not (<= y 1.9e+104))) (+ 2.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+157) || !(y <= 1.9e+104)) {
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 <= (-2.9d+157)) .or. (.not. (y <= 1.9d+104))) 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 <= -2.9e+157) || !(y <= 1.9e+104)) {
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 <= -2.9e+157) or not (y <= 1.9e+104): 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 <= -2.9e+157) || !(y <= 1.9e+104)) 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 <= -2.9e+157) || ~((y <= 1.9e+104))) 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, -2.9e+157], N[Not[LessEqual[y, 1.9e+104]], $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 -2.9 \cdot 10^{+157} \lor \neg \left(y \leq 1.9 \cdot 10^{+104}\right):\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -2.89999999999999988e157 or 1.89999999999999984e104 < y Initial program 98.8%
+-commutative98.8%
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 87.9%
if -2.89999999999999988e157 < y < 1.89999999999999984e104Initial program 100.0%
Taylor expanded in y around 0 87.0%
Final simplification87.3%
(FPCore (x y z) :precision binary64 (if (<= x -2.7e+124) (* 4.0 (/ (- x z) y)) (if (<= x 3.65e-22) (+ 2.0 (* (/ z y) -4.0)) (+ 2.0 (/ (* 4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e+124) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.65e-22) {
tmp = 2.0 + ((z / y) * -4.0);
} 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 (x <= (-2.7d+124)) then
tmp = 4.0d0 * ((x - z) / y)
else if (x <= 3.65d-22) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
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 (x <= -2.7e+124) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.65e-22) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 2.0 + ((4.0 * x) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.7e+124: tmp = 4.0 * ((x - z) / y) elif x <= 3.65e-22: tmp = 2.0 + ((z / y) * -4.0) else: tmp = 2.0 + ((4.0 * x) / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.7e+124) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); elseif (x <= 3.65e-22) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); else tmp = Float64(2.0 + Float64(Float64(4.0 * x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.7e+124) tmp = 4.0 * ((x - z) / y); elseif (x <= 3.65e-22) tmp = 2.0 + ((z / y) * -4.0); else tmp = 2.0 + ((4.0 * x) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.7e+124], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.65e-22], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+124}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{elif}\;x \leq 3.65 \cdot 10^{-22}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if x < -2.69999999999999978e124Initial program 97.1%
Taylor expanded in y around 0 91.2%
if -2.69999999999999978e124 < x < 3.65000000000000014e-22Initial 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.9%
*-commutative91.9%
Simplified91.9%
if 3.65000000000000014e-22 < x Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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 96.3%
Taylor expanded in z around 0 88.1%
associate-*r/88.1%
Simplified88.1%
Final simplification90.6%
(FPCore (x y z) :precision binary64 (if (<= x -3e+136) (* 4.0 (/ (- x z) y)) (if (<= x 3.8e-22) (+ 2.0 (* (/ z y) -4.0)) (+ 2.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3e+136) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.8e-22) {
tmp = 2.0 + ((z / y) * -4.0);
} 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 (x <= (-3d+136)) then
tmp = 4.0d0 * ((x - z) / y)
else if (x <= 3.8d-22) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
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 (x <= -3e+136) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.8e-22) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3e+136: tmp = 4.0 * ((x - z) / y) elif x <= 3.8e-22: tmp = 2.0 + ((z / y) * -4.0) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3e+136) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); elseif (x <= 3.8e-22) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); 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 (x <= -3e+136) tmp = 4.0 * ((x - z) / y); elseif (x <= 3.8e-22) tmp = 2.0 + ((z / y) * -4.0); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3e+136], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.8e-22], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+136}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-22}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < -2.99999999999999979e136Initial program 97.1%
Taylor expanded in y around 0 91.2%
if -2.99999999999999979e136 < x < 3.80000000000000023e-22Initial 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.9%
*-commutative91.9%
Simplified91.9%
if 3.80000000000000023e-22 < x Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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 z around 0 88.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.9e+159) 2.0 (if (<= y 4.7e+107) (* 4.0 (/ (- x z) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.9e+159) {
tmp = 2.0;
} else if (y <= 4.7e+107) {
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 <= (-1.9d+159)) then
tmp = 2.0d0
else if (y <= 4.7d+107) 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 <= -1.9e+159) {
tmp = 2.0;
} else if (y <= 4.7e+107) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.9e+159: tmp = 2.0 elif y <= 4.7e+107: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.9e+159) tmp = 2.0; elseif (y <= 4.7e+107) 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 <= -1.9e+159) tmp = 2.0; elseif (y <= 4.7e+107) tmp = 4.0 * ((x - z) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.9e+159], 2.0, If[LessEqual[y, 4.7e+107], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+159}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{+107}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.89999999999999983e159 or 4.7000000000000001e107 < y Initial program 98.8%
Taylor expanded in y around inf 75.2%
if -1.89999999999999983e159 < y < 4.7000000000000001e107Initial program 100.0%
Taylor expanded in y around 0 87.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -4e+69) (not (<= x 2.7e-22))) (* 4.0 (/ x y)) (* (/ z y) -4.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4e+69) || !(x <= 2.7e-22)) {
tmp = 4.0 * (x / y);
} else {
tmp = (z / y) * -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 <= (-4d+69)) .or. (.not. (x <= 2.7d-22))) then
tmp = 4.0d0 * (x / y)
else
tmp = (z / y) * (-4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4e+69) || !(x <= 2.7e-22)) {
tmp = 4.0 * (x / y);
} else {
tmp = (z / y) * -4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4e+69) or not (x <= 2.7e-22): tmp = 4.0 * (x / y) else: tmp = (z / y) * -4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4e+69) || !(x <= 2.7e-22)) tmp = Float64(4.0 * Float64(x / y)); else tmp = Float64(Float64(z / y) * -4.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4e+69) || ~((x <= 2.7e-22))) tmp = 4.0 * (x / y); else tmp = (z / y) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4e+69], N[Not[LessEqual[x, 2.7e-22]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+69} \lor \neg \left(x \leq 2.7 \cdot 10^{-22}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -4.0000000000000003e69 or 2.7000000000000002e-22 < x Initial program 99.2%
Taylor expanded in x around inf 63.6%
if -4.0000000000000003e69 < x < 2.7000000000000002e-22Initial program 100.0%
Taylor expanded in z around inf 54.0%
*-commutative54.0%
Simplified54.0%
Final simplification58.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.75e+69) (not (<= x 2.65e-23))) (* 4.0 (/ x y)) (* z (/ -4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.75e+69) || !(x <= 2.65e-23)) {
tmp = 4.0 * (x / y);
} else {
tmp = 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 <= (-2.75d+69)) .or. (.not. (x <= 2.65d-23))) then
tmp = 4.0d0 * (x / y)
else
tmp = z * ((-4.0d0) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.75e+69) || !(x <= 2.65e-23)) {
tmp = 4.0 * (x / y);
} else {
tmp = z * (-4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.75e+69) or not (x <= 2.65e-23): tmp = 4.0 * (x / y) else: tmp = z * (-4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.75e+69) || !(x <= 2.65e-23)) tmp = Float64(4.0 * Float64(x / y)); else tmp = Float64(z * Float64(-4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.75e+69) || ~((x <= 2.65e-23))) tmp = 4.0 * (x / y); else tmp = z * (-4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.75e+69], N[Not[LessEqual[x, 2.65e-23]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.75 \cdot 10^{+69} \lor \neg \left(x \leq 2.65 \cdot 10^{-23}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\end{array}
\end{array}
if x < -2.75000000000000001e69 or 2.65000000000000021e-23 < x Initial program 99.2%
Taylor expanded in x around inf 63.6%
if -2.75000000000000001e69 < x < 2.65000000000000021e-23Initial program 100.0%
Taylor expanded in z around inf 54.0%
associate-*r/54.0%
*-commutative54.0%
associate-/l*53.8%
Simplified53.8%
Final simplification58.6%
(FPCore (x y z) :precision binary64 (if (<= y -7.8e+99) 2.0 (if (<= y 8.5e-42) (* 4.0 (/ x y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.8e+99) {
tmp = 2.0;
} else if (y <= 8.5e-42) {
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 <= (-7.8d+99)) then
tmp = 2.0d0
else if (y <= 8.5d-42) 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 <= -7.8e+99) {
tmp = 2.0;
} else if (y <= 8.5e-42) {
tmp = 4.0 * (x / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.8e+99: tmp = 2.0 elif y <= 8.5e-42: tmp = 4.0 * (x / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.8e+99) tmp = 2.0; elseif (y <= 8.5e-42) 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 <= -7.8e+99) tmp = 2.0; elseif (y <= 8.5e-42) tmp = 4.0 * (x / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.8e+99], 2.0, If[LessEqual[y, 8.5e-42], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+99}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-42}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -7.79999999999999989e99 or 8.4999999999999996e-42 < y Initial program 99.1%
Taylor expanded in y around inf 62.4%
if -7.79999999999999989e99 < y < 8.4999999999999996e-42Initial program 100.0%
Taylor expanded in x around inf 50.7%
(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 32.8%
herbie shell --seed 2024137
(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)))