
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Initial program 81.8%
(FPCore (x y z t a) :precision binary64 (/ (* y (- z t)) (- a t)))
double code(double x, double y, double z, double t, double a) {
return (y * (z - t)) / (a - t);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (y * (z - t)) / (a - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return (y * (z - t)) / (a - t);
}
def code(x, y, z, t, a): return (y * (z - t)) / (a - t)
function code(x, y, z, t, a) return Float64(Float64(y * Float64(z - t)) / Float64(a - t)) end
function tmp = code(x, y, z, t, a) tmp = (y * (z - t)) / (a - t); end
code[x_, y_, z_, t_, a_] := N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Initial program 81.8%
Taylor expanded in x around 0
Applied rewrites35.8%
(FPCore (x y z t a) :precision binary64 (* y (- z t)))
double code(double x, double y, double z, double t, double a) {
return y * (z - t);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y * (z - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return y * (z - t);
}
def code(x, y, z, t, a): return y * (z - t)
function code(x, y, z, t, a) return Float64(y * Float64(z - t)) end
function tmp = code(x, y, z, t, a) tmp = y * (z - t); end
code[x_, y_, z_, t_, a_] := N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(z - t\right)
\end{array}
Initial program 81.8%
Taylor expanded in x around inf
Applied rewrites5.8%
(FPCore (x y z t a) :precision binary64 (- z t))
double code(double x, double y, double z, double t, double a) {
return z - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = z - t
end function
public static double code(double x, double y, double z, double t, double a) {
return z - t;
}
def code(x, y, z, t, a): return z - t
function code(x, y, z, t, a) return Float64(z - t) end
function tmp = code(x, y, z, t, a) tmp = z - t; end
code[x_, y_, z_, t_, a_] := N[(z - t), $MachinePrecision]
\begin{array}{l}
\\
z - t
\end{array}
Initial program 81.8%
Taylor expanded in x around inf
Applied rewrites3.6%
(FPCore (x y z t a) :precision binary64 (- a t))
double code(double x, double y, double z, double t, double a) {
return a - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = a - t
end function
public static double code(double x, double y, double z, double t, double a) {
return a - t;
}
def code(x, y, z, t, a): return a - t
function code(x, y, z, t, a) return Float64(a - t) end
function tmp = code(x, y, z, t, a) tmp = a - t; end
code[x_, y_, z_, t_, a_] := N[(a - t), $MachinePrecision]
\begin{array}{l}
\\
a - t
\end{array}
Initial program 81.8%
Taylor expanded in x around -inf
Applied rewrites3.1%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2024321
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:pre (TRUE)
:alt
(! :herbie-platform default (+ x (/ y (/ (- a t) (- z t)))))
(+ x (/ (* y (- z t)) (- a t))))