
(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 11 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 (fma (/ a (- -1.0 (- t z))) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((a / (-1.0 - (t - z))), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(a / Float64(-1.0 - Float64(t - z))), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(a / N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{a}{-1 - \left(t - z\right)}, y - z, x\right)
\end{array}
Initial program 97.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites97.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- y) a)) (t_2 (/ (- z y) (/ (- -1.0 (- t z)) a)))) (if (<= t_2 -5e+288) t_1 (if (<= t_2 2e+285) (- x a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y * a;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -5e+288) {
tmp = t_1;
} else if (t_2 <= 2e+285) {
tmp = x - a;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -y * a
t_2 = (z - y) / (((-1.0d0) - (t - z)) / a)
if (t_2 <= (-5d+288)) then
tmp = t_1
else if (t_2 <= 2d+285) then
tmp = x - a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -y * a;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -5e+288) {
tmp = t_1;
} else if (t_2 <= 2e+285) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y * a t_2 = (z - y) / ((-1.0 - (t - z)) / a) tmp = 0 if t_2 <= -5e+288: tmp = t_1 elif t_2 <= 2e+285: tmp = x - a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) * a) t_2 = Float64(Float64(z - y) / Float64(Float64(-1.0 - Float64(t - z)) / a)) tmp = 0.0 if (t_2 <= -5e+288) tmp = t_1; elseif (t_2 <= 2e+285) tmp = Float64(x - a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -y * a; t_2 = (z - y) / ((-1.0 - (t - z)) / a); tmp = 0.0; if (t_2 <= -5e+288) tmp = t_1; elseif (t_2 <= 2e+285) tmp = x - a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - y), $MachinePrecision] / N[(N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+288], t$95$1, If[LessEqual[t$95$2, 2e+285], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot a\\
t_2 := \frac{z - y}{\frac{-1 - \left(t - z\right)}{a}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+288}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+285}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -5.0000000000000003e288 or 2e285 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 100.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6472.3
Applied rewrites72.3%
Taylor expanded in z around 0
Applied rewrites64.9%
Taylor expanded in x around 0
Applied rewrites64.9%
if -5.0000000000000003e288 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 2e285Initial program 97.0%
Taylor expanded in z around inf
lower--.f6464.3
Applied rewrites64.3%
Final simplification64.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y z) t)))
(if (<= t -8200000000.0)
(- x (* t_1 a))
(if (<= t 42000000.0)
(fma a (/ (- y z) (- z 1.0)) x)
(fma t_1 (- a) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / t;
double tmp;
if (t <= -8200000000.0) {
tmp = x - (t_1 * a);
} else if (t <= 42000000.0) {
tmp = fma(a, ((y - z) / (z - 1.0)), x);
} else {
tmp = fma(t_1, -a, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / t) tmp = 0.0 if (t <= -8200000000.0) tmp = Float64(x - Float64(t_1 * a)); elseif (t <= 42000000.0) tmp = fma(a, Float64(Float64(y - z) / Float64(z - 1.0)), x); else tmp = fma(t_1, Float64(-a), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -8200000000.0], N[(x - N[(t$95$1 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 42000000.0], N[(a * N[(N[(y - z), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(t$95$1 * (-a) + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{t}\\
\mathbf{if}\;t \leq -8200000000:\\
\;\;\;\;x - t\_1 \cdot a\\
\mathbf{elif}\;t \leq 42000000:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y - z}{z - 1}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, -a, x\right)\\
\end{array}
\end{array}
if t < -8.2e9Initial program 97.1%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.2
Applied rewrites81.2%
Applied rewrites88.8%
if -8.2e9 < t < 4.2e7Initial program 97.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites97.7%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6499.3
Applied rewrites99.3%
if 4.2e7 < t Initial program 96.9%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6491.6
Applied rewrites91.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -7000000000.0)
t_1
(if (<= z 160000000000.0) (- x (* (/ y (- t -1.0)) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / z), (y - z), x);
double tmp;
if (z <= -7000000000.0) {
tmp = t_1;
} else if (z <= 160000000000.0) {
tmp = x - ((y / (t - -1.0)) * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(a / z), Float64(y - z), x) tmp = 0.0 if (z <= -7000000000.0) tmp = t_1; elseif (z <= 160000000000.0) tmp = Float64(x - Float64(Float64(y / Float64(t - -1.0)) * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / z), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -7000000000.0], t$95$1, If[LessEqual[z, 160000000000.0], N[(x - N[(N[(y / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{z}, y - z, x\right)\\
\mathbf{if}\;z \leq -7000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 160000000000:\\
\;\;\;\;x - \frac{y}{t - -1} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7e9 or 1.6e11 < z Initial program 94.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites94.9%
Taylor expanded in z around inf
lower-/.f6486.1
Applied rewrites86.1%
if -7e9 < z < 1.6e11Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6491.8
Applied rewrites91.8%
Final simplification89.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -7000000000.0)
t_1
(if (<= z 160000000000.0) (fma (/ y (- -1.0 t)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / z), (y - z), x);
double tmp;
if (z <= -7000000000.0) {
tmp = t_1;
} else if (z <= 160000000000.0) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(a / z), Float64(y - z), x) tmp = 0.0 if (z <= -7000000000.0) tmp = t_1; elseif (z <= 160000000000.0) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / z), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -7000000000.0], t$95$1, If[LessEqual[z, 160000000000.0], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{z}, y - z, x\right)\\
\mathbf{if}\;z \leq -7000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 160000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7e9 or 1.6e11 < z Initial program 94.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites94.9%
Taylor expanded in z around inf
lower-/.f6486.1
Applied rewrites86.1%
if -7e9 < z < 1.6e11Initial program 99.2%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6491.7
Applied rewrites91.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.45e+130) (- x a) (if (<= z 320000000000.0) (fma (/ y (- -1.0 t)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45e+130) {
tmp = x - a;
} else if (z <= 320000000000.0) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45e+130) tmp = Float64(x - a); elseif (z <= 320000000000.0) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45e+130], N[(x - a), $MachinePrecision], If[LessEqual[z, 320000000000.0], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+130}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 320000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.45e130 or 3.2e11 < z Initial program 92.9%
Taylor expanded in z around inf
lower--.f6482.3
Applied rewrites82.3%
if -1.45e130 < z < 3.2e11Initial program 99.3%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6490.4
Applied rewrites90.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.021) (- x a) (if (<= z 8e+14) (fma (/ (- a) t) y x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.021) {
tmp = x - a;
} else if (z <= 8e+14) {
tmp = fma((-a / t), y, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.021) tmp = Float64(x - a); elseif (z <= 8e+14) tmp = fma(Float64(Float64(-a) / t), y, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.021], N[(x - a), $MachinePrecision], If[LessEqual[z, 8e+14], N[(N[((-a) / t), $MachinePrecision] * y + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.021:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-a}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -0.0210000000000000013 or 8e14 < z Initial program 94.1%
Taylor expanded in z around inf
lower--.f6481.2
Applied rewrites81.2%
if -0.0210000000000000013 < z < 8e14Initial program 99.2%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6476.6
Applied rewrites76.6%
Taylor expanded in y around 0
Applied rewrites58.2%
Taylor expanded in z around 0
Applied rewrites74.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.45) (- x a) (if (<= z 9500.0) (fma a (fma (- 1.0 y) z (- y)) x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45) {
tmp = x - a;
} else if (z <= 9500.0) {
tmp = fma(a, fma((1.0 - y), z, -y), x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45) tmp = Float64(x - a); elseif (z <= 9500.0) tmp = fma(a, fma(Float64(1.0 - y), z, Float64(-y)), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45], N[(x - a), $MachinePrecision], If[LessEqual[z, 9500.0], N[(a * N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 9500:\\
\;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(1 - y, z, -y\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.44999999999999996 or 9500 < z Initial program 94.3%
Taylor expanded in z around inf
lower--.f6480.9
Applied rewrites80.9%
if -1.44999999999999996 < z < 9500Initial program 99.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6468.5
Applied rewrites68.5%
Taylor expanded in z around 0
Applied rewrites68.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.00021) (- x a) (if (<= z 6800000000.0) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.00021) {
tmp = x - a;
} else if (z <= 6800000000.0) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.00021) tmp = Float64(x - a); elseif (z <= 6800000000.0) tmp = fma(Float64(-y), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.00021], N[(x - a), $MachinePrecision], If[LessEqual[z, 6800000000.0], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00021:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6800000000:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.1000000000000001e-4 or 6.8e9 < z Initial program 94.4%
Taylor expanded in z around inf
lower--.f6480.3
Applied rewrites80.3%
if -2.1000000000000001e-4 < z < 6.8e9Initial program 99.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6468.3
Applied rewrites68.3%
Taylor expanded in z around 0
Applied rewrites67.7%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - 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 - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 97.3%
Taylor expanded in z around inf
lower--.f6458.7
Applied rewrites58.7%
(FPCore (x y z t a) :precision binary64 (- a))
double code(double x, double y, double z, double t, double a) {
return -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 = -a
end function
public static double code(double x, double y, double z, double t, double a) {
return -a;
}
def code(x, y, z, t, a): return -a
function code(x, y, z, t, a) return Float64(-a) end
function tmp = code(x, y, z, t, a) tmp = -a; end
code[x_, y_, z_, t_, a_] := (-a)
\begin{array}{l}
\\
-a
\end{array}
Initial program 97.3%
Taylor expanded in z around inf
lower--.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
Applied rewrites17.2%
(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 2024332
(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))))