
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Initial program 99.9%
(FPCore (x y z t) :precision binary64 (* x (+ (+ (+ (+ y z) z) y) t)))
double code(double x, double y, double z, double t) {
return x * ((((y + z) + z) + y) + t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((((y + z) + z) + y) + t)
end function
public static double code(double x, double y, double z, double t) {
return x * ((((y + z) + z) + y) + t);
}
def code(x, y, z, t): return x * ((((y + z) + z) + y) + t)
function code(x, y, z, t) return Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) end
function tmp = code(x, y, z, t) tmp = x * ((((y + z) + z) + y) + t); end
code[x_, y_, z_, t_] := N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.8%
(FPCore (x y z t) :precision binary64 (+ (+ (+ y z) z) y))
double code(double x, double y, double z, double t) {
return ((y + z) + z) + y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((y + z) + z) + y
end function
public static double code(double x, double y, double z, double t) {
return ((y + z) + z) + y;
}
def code(x, y, z, t): return ((y + z) + z) + y
function code(x, y, z, t) return Float64(Float64(Float64(y + z) + z) + y) end
function tmp = code(x, y, z, t) tmp = ((y + z) + z) + y; end
code[x_, y_, z_, t_] := N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y + z\right) + z\right) + y
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites6.0%
(FPCore (x y z t) :precision binary64 (+ (+ y z) z))
double code(double x, double y, double z, double t) {
return (y + z) + z;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y + z) + z
end function
public static double code(double x, double y, double z, double t) {
return (y + z) + z;
}
def code(x, y, z, t): return (y + z) + z
function code(x, y, z, t) return Float64(Float64(y + z) + z) end
function tmp = code(x, y, z, t) tmp = (y + z) + z; end
code[x_, y_, z_, t_] := N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision]
\begin{array}{l}
\\
\left(y + z\right) + z
\end{array}
Initial program 99.9%
Taylor expanded in x around -inf
Applied rewrites5.7%
(FPCore (x y z t) :precision binary64 (+ y z))
double code(double x, double y, double z, double t) {
return y + z;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y + z
end function
public static double code(double x, double y, double z, double t) {
return y + z;
}
def code(x, y, z, t): return y + z
function code(x, y, z, t) return Float64(y + z) end
function tmp = code(x, y, z, t) tmp = y + z; end
code[x_, y_, z_, t_] := N[(y + z), $MachinePrecision]
\begin{array}{l}
\\
y + z
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.8%
Taylor expanded in y around 0
Applied rewrites5.7%
herbie shell --seed 2024321
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
:pre (TRUE)
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))