
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Initial program 96.1%
(FPCore (x y z t) :precision binary64 (/ (* (- x y) t) (- z y)))
double code(double x, double y, double z, double t) {
return ((x - y) * t) / (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 = ((x - y) * t) / (z - y)
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) * t) / (z - y);
}
def code(x, y, z, t): return ((x - y) * t) / (z - y)
function code(x, y, z, t) return Float64(Float64(Float64(x - y) * t) / Float64(z - y)) end
function tmp = code(x, y, z, t) tmp = ((x - y) * t) / (z - y); end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x - y\right) \cdot t}{z - y}
\end{array}
Initial program 96.1%
Taylor expanded in x around 0
Applied rewrites6.9%
Taylor expanded in x around 0
Applied rewrites81.8%
(FPCore (x y z t) :precision binary64 (if (<= z 8.5e-235) (* (* (- z y) t) t) (* (- x y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 8.5e-235) {
tmp = ((z - y) * t) * t;
} else {
tmp = (x - y) * t;
}
return tmp;
}
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
real(8) :: tmp
if (z <= 8.5d-235) then
tmp = ((z - y) * t) * t
else
tmp = (x - y) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 8.5e-235) {
tmp = ((z - y) * t) * t;
} else {
tmp = (x - y) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 8.5e-235: tmp = ((z - y) * t) * t else: tmp = (x - y) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 8.5e-235) tmp = Float64(Float64(Float64(z - y) * t) * t); else tmp = Float64(Float64(x - y) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 8.5e-235) tmp = ((z - y) * t) * t; else tmp = (x - y) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 8.5e-235], N[(N[(N[(z - y), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.5 \cdot 10^{-235}:\\
\;\;\;\;\left(\left(z - y\right) \cdot t\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot t\\
\end{array}
\end{array}
if z < 8.49999999999999964e-235Initial program 94.5%
Taylor expanded in x around 0
Applied rewrites5.1%
Taylor expanded in x around 0
Applied rewrites8.9%
Taylor expanded in x around 0
Applied rewrites8.0%
if 8.49999999999999964e-235 < z Initial program 98.7%
Taylor expanded in x around 0
Applied rewrites14.8%
(FPCore (x y z t) :precision binary64 (* (* (* (- x y) t) t) t))
double code(double x, double y, double z, double t) {
return (((x - y) * t) * t) * 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) * t) * t) * t
end function
public static double code(double x, double y, double z, double t) {
return (((x - y) * t) * t) * t;
}
def code(x, y, z, t): return (((x - y) * t) * t) * t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - y) * t) * t) * t) end
function tmp = code(x, y, z, t) tmp = (((x - y) * t) * t) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - y\right) \cdot t\right) \cdot t\right) \cdot t
\end{array}
Initial program 96.1%
Taylor expanded in x around 0
Applied rewrites8.7%
Taylor expanded in x around 0
Applied rewrites12.0%
Taylor expanded in x around inf
Applied rewrites14.0%
(FPCore (x y z t) :precision binary64 (* (* (- x y) t) t))
double code(double x, double y, double z, double t) {
return ((x - y) * t) * 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) * t) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) * t) * t;
}
def code(x, y, z, t): return ((x - y) * t) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) * t) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) * t) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - y\right) \cdot t\right) \cdot t
\end{array}
Initial program 96.1%
Taylor expanded in x around 0
Applied rewrites8.7%
Taylor expanded in x around 0
Applied rewrites12.0%
(FPCore (x y z t) :precision binary64 (* (- x y) t))
double code(double x, double y, double z, double t) {
return (x - 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) * t
end function
public static double code(double x, double y, double z, double t) {
return (x - y) * t;
}
def code(x, y, z, t): return (x - y) * t
function code(x, y, z, t) return Float64(Float64(x - y) * t) end
function tmp = code(x, y, z, t) tmp = (x - y) * t; end
code[x_, y_, z_, t_] := N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(x - y\right) \cdot t
\end{array}
Initial program 96.1%
Taylor expanded in x around 0
Applied rewrites8.7%
(FPCore (x y z t) :precision binary64 (- x y))
double code(double x, double y, double z, double t) {
return x - 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 = x - y
end function
public static double code(double x, double y, double z, double t) {
return x - y;
}
def code(x, y, z, t): return x - y
function code(x, y, z, t) return Float64(x - y) end
function tmp = code(x, y, z, t) tmp = x - y; end
code[x_, y_, z_, t_] := N[(x - y), $MachinePrecision]
\begin{array}{l}
\\
x - y
\end{array}
Initial program 96.1%
Taylor expanded in x around 0
Applied rewrites6.9%
Taylor expanded in x around 0
Applied rewrites3.1%
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - 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 = t / ((z - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
def code(x, y, z, t): return t / ((z - y) / (x - y))
function code(x, y, z, t) return Float64(t / Float64(Float64(z - y) / Float64(x - y))) end
function tmp = code(x, y, z, t) tmp = t / ((z - y) / (x - y)); end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}
herbie shell --seed 2024321
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:pre (TRUE)
:alt
(! :herbie-platform default (/ t (/ (- z y) (- x y))))
(* (/ (- x y) (- z y)) t))