
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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 - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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 - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (- x (/ a (/ (- -1.0 (- t z)) (- z y)))))
double code(double x, double y, double z, double t, double a) {
return x - (a / ((-1.0 - (t - z)) / (z - y)));
}
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 - (a / (((-1.0d0) - (t - z)) / (z - y)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (a / ((-1.0 - (t - z)) / (z - y)));
}
def code(x, y, z, t, a): return x - (a / ((-1.0 - (t - z)) / (z - y)))
function code(x, y, z, t, a) return Float64(x - Float64(a / Float64(Float64(-1.0 - Float64(t - z)) / Float64(z - y)))) end
function tmp = code(x, y, z, t, a) tmp = x - (a / ((-1.0 - (t - z)) / (z - y))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(a / N[(N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{a}{\frac{-1 - \left(t - z\right)}{z - y}}
\end{array}
Initial program 96.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- z y) (/ (- -1.0 (- t z)) a)) 1e+308) (- x a) (* (- a) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - y) / ((-1.0 - (t - z)) / a)) <= 1e+308) {
tmp = x - a;
} else {
tmp = -a * y;
}
return tmp;
}
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
real(8) :: tmp
if (((z - y) / (((-1.0d0) - (t - z)) / a)) <= 1d+308) then
tmp = x - a
else
tmp = -a * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - y) / ((-1.0 - (t - z)) / a)) <= 1e+308) {
tmp = x - a;
} else {
tmp = -a * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((z - y) / ((-1.0 - (t - z)) / a)) <= 1e+308: tmp = x - a else: tmp = -a * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z - y) / Float64(Float64(-1.0 - Float64(t - z)) / a)) <= 1e+308) tmp = Float64(x - a); else tmp = Float64(Float64(-a) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((z - y) / ((-1.0 - (t - z)) / a)) <= 1e+308) tmp = x - a; else tmp = -a * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z - y), $MachinePrecision] / N[(N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], 1e+308], N[(x - a), $MachinePrecision], N[((-a) * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z - y}{\frac{-1 - \left(t - z\right)}{a}} \leq 10^{+308}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\left(-a\right) \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 1e308Initial program 97.1%
Taylor expanded in z around inf
lower--.f6462.5
Applied rewrites62.5%
if 1e308 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 100.0%
Taylor expanded in y around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
associate-+r+N/A
+-commutativeN/A
associate-+r+N/A
sub-negN/A
lower-+.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in t around 0
Applied rewrites87.8%
Taylor expanded in z around 0
Applied rewrites79.1%
Final simplification63.0%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
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 - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2024230
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))