
(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 7 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 (+ 2.0 (* (/ 4.0 y) (- x z))))
double code(double x, double y, double z) {
return 2.0 + ((4.0 / y) * (x - z));
}
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 + ((4.0d0 / y) * (x - z))
end function
public static double code(double x, double y, double z) {
return 2.0 + ((4.0 / y) * (x - z));
}
def code(x, y, z): return 2.0 + ((4.0 / y) * (x - z))
function code(x, y, z) return Float64(2.0 + Float64(Float64(4.0 / y) * Float64(x - z))) end
function tmp = code(x, y, z) tmp = 2.0 + ((4.0 / y) * (x - z)); end
code[x_, y_, z_] := N[(2.0 + N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \frac{4}{y} \cdot \left(x - z\right)
\end{array}
Initial program 99.2%
+-commutative99.2%
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
(if (or (<= x -2950.0)
(not (or (<= x 4.2e-32) (and (not (<= x 1.3e+30)) (<= x 3.5e+63)))))
(+ 2.0 (* 4.0 (/ x y)))
(+ 2.0 (* (/ z y) -4.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2950.0) || !((x <= 4.2e-32) || (!(x <= 1.3e+30) && (x <= 3.5e+63)))) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = 2.0 + ((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 <= (-2950.0d0)) .or. (.not. (x <= 4.2d-32) .or. (.not. (x <= 1.3d+30)) .and. (x <= 3.5d+63))) then
tmp = 2.0d0 + (4.0d0 * (x / y))
else
tmp = 2.0d0 + ((z / y) * (-4.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2950.0) || !((x <= 4.2e-32) || (!(x <= 1.3e+30) && (x <= 3.5e+63)))) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = 2.0 + ((z / y) * -4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2950.0) or not ((x <= 4.2e-32) or (not (x <= 1.3e+30) and (x <= 3.5e+63))): tmp = 2.0 + (4.0 * (x / y)) else: tmp = 2.0 + ((z / y) * -4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2950.0) || !((x <= 4.2e-32) || (!(x <= 1.3e+30) && (x <= 3.5e+63)))) tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2950.0) || ~(((x <= 4.2e-32) || (~((x <= 1.3e+30)) && (x <= 3.5e+63))))) tmp = 2.0 + (4.0 * (x / y)); else tmp = 2.0 + ((z / y) * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2950.0], N[Not[Or[LessEqual[x, 4.2e-32], And[N[Not[LessEqual[x, 1.3e+30]], $MachinePrecision], LessEqual[x, 3.5e+63]]]], $MachinePrecision]], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2950 \lor \neg \left(x \leq 4.2 \cdot 10^{-32} \lor \neg \left(x \leq 1.3 \cdot 10^{+30}\right) \land x \leq 3.5 \cdot 10^{+63}\right):\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -2950 or 4.1999999999999998e-32 < x < 1.29999999999999994e30 or 3.50000000000000029e63 < x Initial program 99.2%
+-commutative99.2%
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 z around 0 91.1%
if -2950 < x < 4.1999999999999998e-32 or 1.29999999999999994e30 < x < 3.50000000000000029e63Initial program 99.3%
+-commutative99.3%
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 97.1%
+-commutative97.1%
*-commutative97.1%
Simplified97.1%
Final simplification94.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -14500.0)
t_0
(if (<= x -7.2e-227) 2.0 (if (<= x 2.8e+63) (* (/ z y) -4.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -14500.0) {
tmp = t_0;
} else if (x <= -7.2e-227) {
tmp = 2.0;
} else if (x <= 2.8e+63) {
tmp = (z / y) * -4.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 = 4.0d0 * (x / y)
if (x <= (-14500.0d0)) then
tmp = t_0
else if (x <= (-7.2d-227)) then
tmp = 2.0d0
else if (x <= 2.8d+63) then
tmp = (z / y) * (-4.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -14500.0) {
tmp = t_0;
} else if (x <= -7.2e-227) {
tmp = 2.0;
} else if (x <= 2.8e+63) {
tmp = (z / y) * -4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) tmp = 0 if x <= -14500.0: tmp = t_0 elif x <= -7.2e-227: tmp = 2.0 elif x <= 2.8e+63: tmp = (z / y) * -4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -14500.0) tmp = t_0; elseif (x <= -7.2e-227) tmp = 2.0; elseif (x <= 2.8e+63) tmp = Float64(Float64(z / y) * -4.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); tmp = 0.0; if (x <= -14500.0) tmp = t_0; elseif (x <= -7.2e-227) tmp = 2.0; elseif (x <= 2.8e+63) tmp = (z / y) * -4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -14500.0], t$95$0, If[LessEqual[x, -7.2e-227], 2.0, If[LessEqual[x, 2.8e+63], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -14500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-227}:\\
\;\;\;\;2\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+63}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -14500 or 2.79999999999999987e63 < x Initial program 99.1%
+-commutative99.1%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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 y around 0 99.1%
Taylor expanded in x around inf 71.3%
if -14500 < x < -7.1999999999999999e-227Initial program 100.0%
+-commutative100.0%
associate-*l/100.0%
+-commutative100.0%
associate--l+100.0%
+-commutative100.0%
distribute-lft-in100.0%
associate-+l+100.0%
associate-*l/100.0%
*-commutative100.0%
associate-*l*100.0%
metadata-eval100.0%
*-rgt-identity100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 68.3%
if -7.1999999999999999e-227 < x < 2.79999999999999987e63Initial program 99.1%
+-commutative99.1%
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 y around 0 99.1%
Taylor expanded in z around inf 54.4%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -40000000000.0) (not (<= y 2.2e+38))) (+ 2.0 (* 4.0 (/ x y))) (* (/ 4.0 y) (- x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -40000000000.0) || !(y <= 2.2e+38)) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = (4.0 / y) * (x - 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 ((y <= (-40000000000.0d0)) .or. (.not. (y <= 2.2d+38))) then
tmp = 2.0d0 + (4.0d0 * (x / y))
else
tmp = (4.0d0 / y) * (x - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -40000000000.0) || !(y <= 2.2e+38)) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = (4.0 / y) * (x - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -40000000000.0) or not (y <= 2.2e+38): tmp = 2.0 + (4.0 * (x / y)) else: tmp = (4.0 / y) * (x - z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -40000000000.0) || !(y <= 2.2e+38)) tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(Float64(4.0 / y) * Float64(x - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -40000000000.0) || ~((y <= 2.2e+38))) tmp = 2.0 + (4.0 * (x / y)); else tmp = (4.0 / y) * (x - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -40000000000.0], N[Not[LessEqual[y, 2.2e+38]], $MachinePrecision]], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -40000000000 \lor \neg \left(y \leq 2.2 \cdot 10^{+38}\right):\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{4}{y} \cdot \left(x - z\right)\\
\end{array}
\end{array}
if y < -4e10 or 2.20000000000000006e38 < y Initial program 98.3%
+-commutative98.3%
associate-*l/99.9%
+-commutative99.9%
associate--l+99.9%
+-commutative99.9%
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 89.5%
if -4e10 < y < 2.20000000000000006e38Initial 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 y around 0 100.0%
Taylor expanded in y around 0 91.6%
associate-*r/91.6%
*-commutative91.6%
associate-*r/91.4%
Simplified91.4%
Final simplification90.5%
(FPCore (x y z) :precision binary64 (if (<= y -1.3e+44) 2.0 (if (<= y 1.45e+39) (* (/ 4.0 y) (- x z)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e+44) {
tmp = 2.0;
} else if (y <= 1.45e+39) {
tmp = (4.0 / y) * (x - z);
} 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+44)) then
tmp = 2.0d0
else if (y <= 1.45d+39) then
tmp = (4.0d0 / y) * (x - z)
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+44) {
tmp = 2.0;
} else if (y <= 1.45e+39) {
tmp = (4.0 / y) * (x - z);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.3e+44: tmp = 2.0 elif y <= 1.45e+39: tmp = (4.0 / y) * (x - z) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.3e+44) tmp = 2.0; elseif (y <= 1.45e+39) tmp = Float64(Float64(4.0 / y) * Float64(x - z)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.3e+44) tmp = 2.0; elseif (y <= 1.45e+39) tmp = (4.0 / y) * (x - z); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.3e+44], 2.0, If[LessEqual[y, 1.45e+39], N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+44}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+39}:\\
\;\;\;\;\frac{4}{y} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.3e44 or 1.45000000000000015e39 < y Initial program 98.3%
+-commutative98.3%
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 y around inf 68.9%
if -1.3e44 < y < 1.45000000000000015e39Initial 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 y around 0 100.0%
Taylor expanded in y around 0 90.8%
associate-*r/90.8%
*-commutative90.8%
associate-*r/90.7%
Simplified90.7%
Final simplification81.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.2e+16) 2.0 (if (<= y 1.02e+38) (* (/ z y) -4.0) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+16) {
tmp = 2.0;
} else if (y <= 1.02e+38) {
tmp = (z / y) * -4.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) :: tmp
if (y <= (-1.2d+16)) then
tmp = 2.0d0
else if (y <= 1.02d+38) then
tmp = (z / y) * (-4.0d0)
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.2e+16) {
tmp = 2.0;
} else if (y <= 1.02e+38) {
tmp = (z / y) * -4.0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.2e+16: tmp = 2.0 elif y <= 1.02e+38: tmp = (z / y) * -4.0 else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.2e+16) tmp = 2.0; elseif (y <= 1.02e+38) tmp = Float64(Float64(z / y) * -4.0); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.2e+16) tmp = 2.0; elseif (y <= 1.02e+38) tmp = (z / y) * -4.0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.2e+16], 2.0, If[LessEqual[y, 1.02e+38], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+16}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+38}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.2e16 or 1.02000000000000006e38 < y Initial program 98.3%
+-commutative98.3%
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 y around inf 67.3%
if -1.2e16 < y < 1.02000000000000006e38Initial 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 y around 0 100.0%
Taylor expanded in z around inf 52.5%
Final simplification59.2%
(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.2%
+-commutative99.2%
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 y around inf 36.7%
herbie shell --seed 2024100
(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)))