
(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 8 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 97.6%
(FPCore (x y z t) :precision binary64 (if (<= t 4.2e-132) (* (* (* (- x y) t) t) t) (/ (- x y) (- z y))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 4.2e-132) {
tmp = (((x - y) * t) * t) * t;
} else {
tmp = (x - y) / (z - y);
}
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 (t <= 4.2d-132) then
tmp = (((x - y) * t) * t) * t
else
tmp = (x - y) / (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 4.2e-132) {
tmp = (((x - y) * t) * t) * t;
} else {
tmp = (x - y) / (z - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 4.2e-132: tmp = (((x - y) * t) * t) * t else: tmp = (x - y) / (z - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 4.2e-132) tmp = Float64(Float64(Float64(Float64(x - y) * t) * t) * t); else tmp = Float64(Float64(x - y) / Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 4.2e-132) tmp = (((x - y) * t) * t) * t; else tmp = (x - y) / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 4.2e-132], N[(N[(N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.2 \cdot 10^{-132}:\\
\;\;\;\;\left(\left(\left(x - y\right) \cdot t\right) \cdot t\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{z - y}\\
\end{array}
\end{array}
if t < 4.2000000000000002e-132Initial program 97.6%
Taylor expanded in x around 0
Applied rewrites10.1%
Taylor expanded in x around 0
Applied rewrites15.6%
Taylor expanded in x around inf
Applied rewrites16.1%
if 4.2000000000000002e-132 < t Initial program 97.6%
Taylor expanded in x around 0
Applied rewrites13.5%
(FPCore (x y z t) :precision binary64 (if (<= t 1.32e-129) (* (* (- x y) t) t) (/ (- x y) (- z y))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.32e-129) {
tmp = ((x - y) * t) * t;
} else {
tmp = (x - y) / (z - y);
}
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 (t <= 1.32d-129) then
tmp = ((x - y) * t) * t
else
tmp = (x - y) / (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.32e-129) {
tmp = ((x - y) * t) * t;
} else {
tmp = (x - y) / (z - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.32e-129: tmp = ((x - y) * t) * t else: tmp = (x - y) / (z - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.32e-129) tmp = Float64(Float64(Float64(x - y) * t) * t); else tmp = Float64(Float64(x - y) / Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.32e-129) tmp = ((x - y) * t) * t; else tmp = (x - y) / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.32e-129], N[(N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.32 \cdot 10^{-129}:\\
\;\;\;\;\left(\left(x - y\right) \cdot t\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{z - y}\\
\end{array}
\end{array}
if t < 1.31999999999999992e-129Initial program 97.6%
Taylor expanded in x around 0
Applied rewrites10.1%
Taylor expanded in x around 0
Applied rewrites15.6%
if 1.31999999999999992e-129 < t Initial program 97.5%
Taylor expanded in x around 0
Applied rewrites13.6%
(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 97.6%
Taylor expanded in x around 0
Applied rewrites8.7%
Taylor expanded in x around 0
Applied rewrites82.2%
(FPCore (x y z t) :precision binary64 (if (<= z 3.5e-69) (* (* (- z y) t) t) (* (- x y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.5e-69) {
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 <= 3.5d-69) 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 <= 3.5e-69) {
tmp = ((z - y) * t) * t;
} else {
tmp = (x - y) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 3.5e-69: tmp = ((z - y) * t) * t else: tmp = (x - y) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 3.5e-69) 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 <= 3.5e-69) tmp = ((z - y) * t) * t; else tmp = (x - y) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 3.5e-69], 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 3.5 \cdot 10^{-69}:\\
\;\;\;\;\left(\left(z - y\right) \cdot t\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot t\\
\end{array}
\end{array}
if z < 3.5000000000000001e-69Initial program 96.6%
Taylor expanded in x around 0
Applied rewrites6.4%
Taylor expanded in x around 0
Applied rewrites10.8%
Taylor expanded in x around 0
Applied rewrites10.0%
if 3.5000000000000001e-69 < z Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites13.8%
(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 97.6%
Taylor expanded in x around 0
Applied rewrites8.8%
Taylor expanded in x around 0
Applied rewrites12.7%
(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 97.6%
Taylor expanded in x around 0
Applied rewrites8.8%
(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 97.6%
Taylor expanded in x around 0
Applied rewrites8.7%
Taylor expanded in x around 0
Applied rewrites3.3%
(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 2024313
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (/ t (/ (- z y) (- x y))))
(* (/ (- x y) (- z y)) t))