
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(if (<= t -8e+128)
(- x (* (* (- a z) (/ y t)) (- (/ a t) -1.0)))
(if (<= t 3.1e+77)
(- (+ y x) (/ (- z t) (/ (- a t) y)))
(fma (- y) (/ (- a z) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e+128) {
tmp = x - (((a - z) * (y / t)) * ((a / t) - -1.0));
} else if (t <= 3.1e+77) {
tmp = (y + x) - ((z - t) / ((a - t) / y));
} else {
tmp = fma(-y, ((a - z) / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e+128) tmp = Float64(x - Float64(Float64(Float64(a - z) * Float64(y / t)) * Float64(Float64(a / t) - -1.0))); elseif (t <= 3.1e+77) tmp = Float64(Float64(y + x) - Float64(Float64(z - t) / Float64(Float64(a - t) / y))); else tmp = fma(Float64(-y), Float64(Float64(a - z) / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e+128], N[(x - N[(N[(N[(a - z), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision] * N[(N[(a / t), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e+77], N[(N[(y + x), $MachinePrecision] - N[(N[(z - t), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-y) * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+128}:\\
\;\;\;\;x - \left(\left(a - z\right) \cdot \frac{y}{t}\right) \cdot \left(\frac{a}{t} - -1\right)\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+77}:\\
\;\;\;\;\left(y + x\right) - \frac{z - t}{\frac{a - t}{y}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a - z}{t}, x\right)\\
\end{array}
\end{array}
if t < -8.0000000000000006e128Initial program 59.2%
Taylor expanded in t around inf
Applied rewrites99.8%
if -8.0000000000000006e128 < t < 3.09999999999999999e77Initial program 91.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6493.7
Applied rewrites93.7%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lower-/.f6493.8
Applied rewrites93.8%
if 3.09999999999999999e77 < t Initial program 44.3%
Taylor expanded in t around inf
Applied rewrites92.4%
Taylor expanded in t around inf
Applied rewrites97.1%
Final simplification95.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -8e+128)
(fma (/ y t) (- z a) x)
(if (<= t 3.1e+77)
(- (+ y x) (/ (- z t) (/ (- a t) y)))
(fma (- y) (/ (- a z) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e+128) {
tmp = fma((y / t), (z - a), x);
} else if (t <= 3.1e+77) {
tmp = (y + x) - ((z - t) / ((a - t) / y));
} else {
tmp = fma(-y, ((a - z) / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e+128) tmp = fma(Float64(y / t), Float64(z - a), x); elseif (t <= 3.1e+77) tmp = Float64(Float64(y + x) - Float64(Float64(z - t) / Float64(Float64(a - t) / y))); else tmp = fma(Float64(-y), Float64(Float64(a - z) / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e+128], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 3.1e+77], N[(N[(y + x), $MachinePrecision] - N[(N[(z - t), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-y) * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+77}:\\
\;\;\;\;\left(y + x\right) - \frac{z - t}{\frac{a - t}{y}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a - z}{t}, x\right)\\
\end{array}
\end{array}
if t < -8.0000000000000006e128Initial program 59.2%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6499.3
Applied rewrites99.3%
if -8.0000000000000006e128 < t < 3.09999999999999999e77Initial program 91.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6493.7
Applied rewrites93.7%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lower-/.f6493.8
Applied rewrites93.8%
if 3.09999999999999999e77 < t Initial program 44.3%
Taylor expanded in t around inf
Applied rewrites92.4%
Taylor expanded in t around inf
Applied rewrites97.1%
Final simplification95.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.9e+113)
(fma (/ y t) (- z a) x)
(if (<= t 7.8e+76)
(- (+ y x) (/ (* (- t z) y) (- t a)))
(fma (- y) (/ (- a z) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.9e+113) {
tmp = fma((y / t), (z - a), x);
} else if (t <= 7.8e+76) {
tmp = (y + x) - (((t - z) * y) / (t - a));
} else {
tmp = fma(-y, ((a - z) / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.9e+113) tmp = fma(Float64(y / t), Float64(z - a), x); elseif (t <= 7.8e+76) tmp = Float64(Float64(y + x) - Float64(Float64(Float64(t - z) * y) / Float64(t - a))); else tmp = fma(Float64(-y), Float64(Float64(a - z) / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.9e+113], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 7.8e+76], N[(N[(y + x), $MachinePrecision] - N[(N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-y) * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.9 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+76}:\\
\;\;\;\;\left(y + x\right) - \frac{\left(t - z\right) \cdot y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a - z}{t}, x\right)\\
\end{array}
\end{array}
if t < -4.90000000000000021e113Initial program 59.0%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6499.3
Applied rewrites99.3%
if -4.90000000000000021e113 < t < 7.79999999999999979e76Initial program 92.2%
if 7.79999999999999979e76 < t Initial program 44.3%
Taylor expanded in t around inf
Applied rewrites92.4%
Taylor expanded in t around inf
Applied rewrites97.1%
Final simplification94.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -8e+128)
(fma (/ y t) (- z a) x)
(if (<= t 7.8e+76)
(- (+ y x) (* (/ z (- a t)) y))
(fma (- y) (/ (- a z) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e+128) {
tmp = fma((y / t), (z - a), x);
} else if (t <= 7.8e+76) {
tmp = (y + x) - ((z / (a - t)) * y);
} else {
tmp = fma(-y, ((a - z) / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e+128) tmp = fma(Float64(y / t), Float64(z - a), x); elseif (t <= 7.8e+76) tmp = Float64(Float64(y + x) - Float64(Float64(z / Float64(a - t)) * y)); else tmp = fma(Float64(-y), Float64(Float64(a - z) / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e+128], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 7.8e+76], N[(N[(y + x), $MachinePrecision] - N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[((-y) * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+76}:\\
\;\;\;\;\left(y + x\right) - \frac{z}{a - t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a - z}{t}, x\right)\\
\end{array}
\end{array}
if t < -8.0000000000000006e128Initial program 59.2%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6499.3
Applied rewrites99.3%
if -8.0000000000000006e128 < t < 7.79999999999999979e76Initial program 91.7%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6491.1
Applied rewrites91.1%
if 7.79999999999999979e76 < t Initial program 44.3%
Taylor expanded in t around inf
Applied rewrites92.4%
Taylor expanded in t around inf
Applied rewrites97.1%
Final simplification93.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.15e-76) (fma (/ y t) (- z a) x) (if (<= t 7.4e+74) (- (+ y x) (* (/ y a) z)) (fma (- y) (/ (- a z) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.15e-76) {
tmp = fma((y / t), (z - a), x);
} else if (t <= 7.4e+74) {
tmp = (y + x) - ((y / a) * z);
} else {
tmp = fma(-y, ((a - z) / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.15e-76) tmp = fma(Float64(y / t), Float64(z - a), x); elseif (t <= 7.4e+74) tmp = Float64(Float64(y + x) - Float64(Float64(y / a) * z)); else tmp = fma(Float64(-y), Float64(Float64(a - z) / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.15e-76], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 7.4e+74], N[(N[(y + x), $MachinePrecision] - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[((-y) * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-76}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{elif}\;t \leq 7.4 \cdot 10^{+74}:\\
\;\;\;\;\left(y + x\right) - \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a - z}{t}, x\right)\\
\end{array}
\end{array}
if t < -1.15000000000000003e-76Initial program 74.9%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6485.6
Applied rewrites85.6%
if -1.15000000000000003e-76 < t < 7.4000000000000002e74Initial program 92.6%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.2
Applied rewrites81.2%
Applied rewrites82.6%
if 7.4000000000000002e74 < t Initial program 44.3%
Taylor expanded in t around inf
Applied rewrites92.4%
Taylor expanded in t around inf
Applied rewrites97.1%
Final simplification86.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.25e-76) (fma (/ y t) (- z a) x) (if (<= t 3.7e+73) (fma y (- 1.0 (/ z a)) x) (fma (- y) (/ (- a z) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.25e-76) {
tmp = fma((y / t), (z - a), x);
} else if (t <= 3.7e+73) {
tmp = fma(y, (1.0 - (z / a)), x);
} else {
tmp = fma(-y, ((a - z) / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.25e-76) tmp = fma(Float64(y / t), Float64(z - a), x); elseif (t <= 3.7e+73) tmp = fma(y, Float64(1.0 - Float64(z / a)), x); else tmp = fma(Float64(-y), Float64(Float64(a - z) / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.25e-76], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 3.7e+73], N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[((-y) * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{-76}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{a - z}{t}, x\right)\\
\end{array}
\end{array}
if t < -1.2499999999999999e-76Initial program 74.9%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6485.6
Applied rewrites85.6%
if -1.2499999999999999e-76 < t < 3.69999999999999973e73Initial program 92.6%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6482.4
Applied rewrites82.4%
if 3.69999999999999973e73 < t Initial program 44.3%
Taylor expanded in t around inf
Applied rewrites92.4%
Taylor expanded in t around inf
Applied rewrites97.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y t) (- z a) x)))
(if (<= t -1.25e-76)
t_1
(if (<= t 1.9e+79) (fma y (- 1.0 (/ z a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / t), (z - a), x);
double tmp;
if (t <= -1.25e-76) {
tmp = t_1;
} else if (t <= 1.9e+79) {
tmp = fma(y, (1.0 - (z / a)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / t), Float64(z - a), x) tmp = 0.0 if (t <= -1.25e-76) tmp = t_1; elseif (t <= 1.9e+79) tmp = fma(y, Float64(1.0 - Float64(z / a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.25e-76], t$95$1, If[LessEqual[t, 1.9e+79], N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{-76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+79}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.2499999999999999e-76 or 1.9000000000000001e79 < t Initial program 63.8%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6489.2
Applied rewrites89.2%
if -1.2499999999999999e-76 < t < 1.9000000000000001e79Initial program 92.7%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6481.8
Applied rewrites81.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ z a)) x))) (if (<= a -4.7e-67) t_1 (if (<= a 1.95e-72) (fma (/ z t) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (1.0 - (z / a)), x);
double tmp;
if (a <= -4.7e-67) {
tmp = t_1;
} else if (a <= 1.95e-72) {
tmp = fma((z / t), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(1.0 - Float64(z / a)), x) tmp = 0.0 if (a <= -4.7e-67) tmp = t_1; elseif (a <= 1.95e-72) tmp = fma(Float64(z / t), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -4.7e-67], t$95$1, If[LessEqual[a, 1.95e-72], N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 1 - \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -4.7 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{-72}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.70000000000000004e-67 or 1.95e-72 < a Initial program 78.3%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6481.6
Applied rewrites81.6%
if -4.70000000000000004e-67 < a < 1.95e-72Initial program 77.8%
Taylor expanded in a around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt1-inN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6479.3
Applied rewrites79.3%
Taylor expanded in z around 0
Applied rewrites88.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.26e+113) (+ y x) (if (<= a 2.1e-69) (fma (/ z t) y x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.26e+113) {
tmp = y + x;
} else if (a <= 2.1e-69) {
tmp = fma((z / t), y, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.26e+113) tmp = Float64(y + x); elseif (a <= 2.1e-69) tmp = fma(Float64(z / t), y, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.26e+113], N[(y + x), $MachinePrecision], If[LessEqual[a, 2.1e-69], N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.26 \cdot 10^{+113}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-69}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.2599999999999999e113 or 2.1e-69 < a Initial program 80.6%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
Taylor expanded in z around 0
Applied rewrites78.4%
Taylor expanded in z around 0
Applied rewrites78.4%
if -1.2599999999999999e113 < a < 2.1e-69Initial program 76.3%
Taylor expanded in a around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt1-inN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6471.3
Applied rewrites71.3%
Taylor expanded in z around 0
Applied rewrites79.6%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.26e+113) (+ y x) (if (<= a 8.2e-13) (fma (/ y t) z x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.26e+113) {
tmp = y + x;
} else if (a <= 8.2e-13) {
tmp = fma((y / t), z, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.26e+113) tmp = Float64(y + x); elseif (a <= 8.2e-13) tmp = fma(Float64(y / t), z, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.26e+113], N[(y + x), $MachinePrecision], If[LessEqual[a, 8.2e-13], N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.26 \cdot 10^{+113}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 8.2 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.2599999999999999e113 or 8.2000000000000004e-13 < a Initial program 79.6%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
Taylor expanded in z around 0
Applied rewrites82.0%
Taylor expanded in z around 0
Applied rewrites82.0%
if -1.2599999999999999e113 < a < 8.2000000000000004e-13Initial program 77.2%
Taylor expanded in t around inf
Applied rewrites77.6%
Taylor expanded in a around 0
Applied rewrites77.0%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (<= z 8.5e+200) (+ y x) (/ (* z y) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 8.5e+200) {
tmp = y + x;
} else {
tmp = (z * y) / t;
}
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 <= 8.5d+200) then
tmp = y + x
else
tmp = (z * y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 8.5e+200) {
tmp = y + x;
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= 8.5e+200: tmp = y + x else: tmp = (z * y) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= 8.5e+200) tmp = Float64(y + x); else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= 8.5e+200) tmp = y + x; else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 8.5e+200], N[(y + x), $MachinePrecision], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.5 \cdot 10^{+200}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < 8.5e200Initial program 77.5%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6465.6
Applied rewrites65.6%
Taylor expanded in z around 0
Applied rewrites67.1%
Taylor expanded in z around 0
Applied rewrites67.1%
if 8.5e200 < z Initial program 83.4%
Taylor expanded in a around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt1-inN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6473.3
Applied rewrites73.3%
Taylor expanded in x around 0
Applied rewrites57.3%
Final simplification66.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* -1.0 (- x)))) (if (<= t -9.6e+119) t_1 (if (<= t 3.4e+77) (+ y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * -x;
double tmp;
if (t <= -9.6e+119) {
tmp = t_1;
} else if (t <= 3.4e+77) {
tmp = y + x;
} 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) :: tmp
t_1 = (-1.0d0) * -x
if (t <= (-9.6d+119)) then
tmp = t_1
else if (t <= 3.4d+77) then
tmp = y + x
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 = -1.0 * -x;
double tmp;
if (t <= -9.6e+119) {
tmp = t_1;
} else if (t <= 3.4e+77) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * -x tmp = 0 if t <= -9.6e+119: tmp = t_1 elif t <= 3.4e+77: tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(-x)) tmp = 0.0 if (t <= -9.6e+119) tmp = t_1; elseif (t <= 3.4e+77) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * -x; tmp = 0.0; if (t <= -9.6e+119) tmp = t_1; elseif (t <= 3.4e+77) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * (-x)), $MachinePrecision]}, If[LessEqual[t, -9.6e+119], t$95$1, If[LessEqual[t, 3.4e+77], N[(y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \left(-x\right)\\
\mathbf{if}\;t \leq -9.6 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+77}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.6e119 or 3.39999999999999997e77 < t Initial program 51.3%
Taylor expanded in a around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt1-inN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6477.5
Applied rewrites77.5%
Taylor expanded in x around -inf
Applied rewrites73.7%
Taylor expanded in x around inf
Applied rewrites65.7%
if -9.6e119 < t < 3.39999999999999997e77Initial program 92.2%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6474.7
Applied rewrites74.7%
Taylor expanded in z around 0
Applied rewrites67.1%
Taylor expanded in z around 0
Applied rewrites67.1%
Final simplification66.7%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + x;
}
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 + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 78.1%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6463.0
Applied rewrites63.0%
Taylor expanded in z around 0
Applied rewrites61.6%
Taylor expanded in z around 0
Applied rewrites61.6%
Final simplification61.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} 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 + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (a - t)
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 + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024294
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -13664970889390727/100000000000000000000000) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 14754293444577233/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)))))
(- (+ x y) (/ (* (- z t) y) (- a t))))