
(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 10 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 (+ 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}
Initial program 99.9%
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y))
double code(double x, double y, double z) {
return (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 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x + (y * 0.75)) - z)) / y;
}
def code(x, y, z): return (4.0 * ((x + (y * 0.75)) - z)) / y
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y) end
function tmp = code(x, y, z) tmp = (4.0 * ((x + (y * 0.75)) - z)) / y; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
(FPCore (x y z) :precision binary64 (/ (- (+ x (* y 0.75)) z) y))
double code(double x, double y, double z) {
return ((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 = ((x + (y * 0.75d0)) - z) / y
end function
public static double code(double x, double y, double z) {
return ((x + (y * 0.75)) - z) / y;
}
def code(x, y, z): return ((x + (y * 0.75)) - z) / y
function code(x, y, z) return Float64(Float64(Float64(x + Float64(y * 0.75)) - z) / y) end
function tmp = code(x, y, z) tmp = ((x + (y * 0.75)) - z) / y; end
code[x_, y_, z_] := N[(N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y \cdot 0.75\right) - z}{y}
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
Taylor expanded in x around inf
Applied rewrites22.9%
Taylor expanded in x around 0
Applied rewrites32.9%
(FPCore (x y z) :precision binary64 (/ (+ x (* y 0.75)) y))
double code(double x, double y, double z) {
return (x + (y * 0.75)) / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * 0.75d0)) / y
end function
public static double code(double x, double y, double z) {
return (x + (y * 0.75)) / y;
}
def code(x, y, z): return (x + (y * 0.75)) / y
function code(x, y, z) return Float64(Float64(x + Float64(y * 0.75)) / y) end
function tmp = code(x, y, z) tmp = (x + (y * 0.75)) / y; end
code[x_, y_, z_] := N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot 0.75}{y}
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
Taylor expanded in x around inf
Applied rewrites22.9%
(FPCore (x y z) :precision binary64 (/ (* y 0.75) y))
double code(double x, double y, double z) {
return (y * 0.75) / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y * 0.75d0) / y
end function
public static double code(double x, double y, double z) {
return (y * 0.75) / y;
}
def code(x, y, z): return (y * 0.75) / y
function code(x, y, z) return Float64(Float64(y * 0.75) / y) end
function tmp = code(x, y, z) tmp = (y * 0.75) / y; end
code[x_, y_, z_] := N[(N[(y * 0.75), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot 0.75}{y}
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
Taylor expanded in x around inf
Applied rewrites22.9%
Taylor expanded in x around 0
Applied rewrites7.3%
(FPCore (x y z) :precision binary64 (+ 1.0 (- (+ x (* y 0.75)) z)))
double code(double x, double y, double z) {
return 1.0 + ((x + (y * 0.75)) - z);
}
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 + ((x + (y * 0.75d0)) - z)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((x + (y * 0.75)) - z);
}
def code(x, y, z): return 1.0 + ((x + (y * 0.75)) - z)
function code(x, y, z) return Float64(1.0 + Float64(Float64(x + Float64(y * 0.75)) - z)) end
function tmp = code(x, y, z) tmp = 1.0 + ((x + (y * 0.75)) - z); end
code[x_, y_, z_] := N[(1.0 + N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(\left(x + y \cdot 0.75\right) - z\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites3.8%
(FPCore (x y z) :precision binary64 (- (- (+ x (* y 0.75)) z) z))
double code(double x, double y, double z) {
return ((x + (y * 0.75)) - z) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x + (y * 0.75d0)) - z) - z
end function
public static double code(double x, double y, double z) {
return ((x + (y * 0.75)) - z) - z;
}
def code(x, y, z): return ((x + (y * 0.75)) - z) - z
function code(x, y, z) return Float64(Float64(Float64(x + Float64(y * 0.75)) - z) - z) end
function tmp = code(x, y, z) tmp = ((x + (y * 0.75)) - z) - z; end
code[x_, y_, z_] := N[(N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot 0.75\right) - z\right) - z
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
Taylor expanded in x around 0
Applied rewrites3.3%
Taylor expanded in x around 0
Applied rewrites3.3%
(FPCore (x y z) :precision binary64 (- (+ x (* y 0.75)) z))
double code(double x, double y, double z) {
return (x + (y * 0.75)) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * 0.75d0)) - z
end function
public static double code(double x, double y, double z) {
return (x + (y * 0.75)) - z;
}
def code(x, y, z): return (x + (y * 0.75)) - z
function code(x, y, z) return Float64(Float64(x + Float64(y * 0.75)) - z) end
function tmp = code(x, y, z) tmp = (x + (y * 0.75)) - z; end
code[x_, y_, z_] := N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y \cdot 0.75\right) - z
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
Taylor expanded in x around 0
Applied rewrites3.3%
(FPCore (x y z) :precision binary64 (+ x (* y 0.75)))
double code(double x, double y, double z) {
return x + (y * 0.75);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y * 0.75d0)
end function
public static double code(double x, double y, double z) {
return x + (y * 0.75);
}
def code(x, y, z): return x + (y * 0.75)
function code(x, y, z) return Float64(x + Float64(y * 0.75)) end
function tmp = code(x, y, z) tmp = x + (y * 0.75); end
code[x_, y_, z_] := N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot 0.75
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
Taylor expanded in x around inf
Applied rewrites3.1%
(FPCore (x y z) :precision binary64 (* y 0.75))
double code(double x, double y, double z) {
return y * 0.75;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y * 0.75d0
end function
public static double code(double x, double y, double z) {
return y * 0.75;
}
def code(x, y, z): return y * 0.75
function code(x, y, z) return Float64(y * 0.75) end
function tmp = code(x, y, z) tmp = y * 0.75; end
code[x_, y_, z_] := N[(y * 0.75), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.75
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.0%
Taylor expanded in x around inf
Applied rewrites3.1%
Taylor expanded in x around 0
Applied rewrites2.6%
herbie shell --seed 2024321
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
:precision binary64
:pre (TRUE)
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))