
(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 (fma (- 1.0 (/ (- z t) (- a t))) y x))
double code(double x, double y, double z, double t, double a) {
return fma((1.0 - ((z - t) / (a - t))), y, x);
}
function code(x, y, z, t, a) return fma(Float64(1.0 - Float64(Float64(z - t) / Float64(a - t))), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(1.0 - N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - \frac{z - t}{a - t}, y, x\right)
\end{array}
Initial program 80.1%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6490.5
Applied rewrites90.5%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (<= (- (+ x y) (/ (* (- z t) y) (- a t))) (- INFINITY)) (* y (/ z t)) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x + y) - (((z - t) * y) / (a - t))) <= -((double) INFINITY)) {
tmp = y * (z / t);
} else {
tmp = x + y;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x + y) - (((z - t) * y) / (a - t))) <= -Double.POSITIVE_INFINITY) {
tmp = y * (z / t);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((x + y) - (((z - t) * y) / (a - t))) <= -math.inf: tmp = y * (z / t) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) <= Float64(-Inf)) tmp = Float64(y * Float64(z / t)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((x + y) - (((z - t) * y) / (a - t))) <= -Inf) tmp = y * (z / t); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \leq -\infty:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 55.3%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-neg-fracN/A
fp-cancel-sub-signN/A
Applied rewrites50.3%
Taylor expanded in z around inf
Applied rewrites38.6%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 85.1%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites78.8%
Applied rewrites81.5%
Taylor expanded in a around inf
Applied rewrites67.6%
Final simplification62.8%
(FPCore (x y z t a) :precision binary64 (if (<= (- (+ x y) (/ (* (- z t) y) (- a t))) (- INFINITY)) (/ (* z y) t) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x + y) - (((z - t) * y) / (a - t))) <= -((double) INFINITY)) {
tmp = (z * y) / t;
} else {
tmp = x + y;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x + y) - (((z - t) * y) / (a - t))) <= -Double.POSITIVE_INFINITY) {
tmp = (z * y) / t;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((x + y) - (((z - t) * y) / (a - t))) <= -math.inf: tmp = (z * y) / t else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) <= Float64(-Inf)) tmp = Float64(Float64(z * y) / t); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((x + y) - (((z - t) * y) / (a - t))) <= -Inf) tmp = (z * y) / t; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \leq -\infty:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 55.3%
Taylor expanded in z around inf
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f6468.6
Applied rewrites68.6%
Taylor expanded in t around inf
Applied rewrites36.2%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 85.1%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites78.8%
Applied rewrites81.5%
Taylor expanded in a around inf
Applied rewrites67.6%
Final simplification62.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4e+150) (not (<= t 6.4e+96))) (fma (/ (- z a) t) y x) (- (+ x y) (* (/ z (- a t)) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e+150) || !(t <= 6.4e+96)) {
tmp = fma(((z - a) / t), y, x);
} else {
tmp = (x + y) - ((z / (a - t)) * y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4e+150) || !(t <= 6.4e+96)) tmp = fma(Float64(Float64(z - a) / t), y, x); else tmp = Float64(Float64(x + y) - Float64(Float64(z / Float64(a - t)) * y)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4e+150], N[Not[LessEqual[t, 6.4e+96]], $MachinePrecision]], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+150} \lor \neg \left(t \leq 6.4 \cdot 10^{+96}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - a}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{z}{a - t} \cdot y\\
\end{array}
\end{array}
if t < -3.99999999999999992e150 or 6.40000000000000013e96 < t Initial program 60.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.8
Applied rewrites82.8%
Taylor expanded in z around inf
Applied rewrites79.0%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
div-addN/A
*-lft-identityN/A
metadata-evalN/A
div-addN/A
fp-cancel-sub-sign-invN/A
distribute-lft-out--N/A
mul-1-negN/A
Applied rewrites89.1%
if -3.99999999999999992e150 < t < 6.40000000000000013e96Initial program 88.2%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6490.9
Applied rewrites90.9%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.2e+71) (not (<= a 2.5e+136))) (- (+ x y) (/ (* z y) a)) (fma (/ (- z) (- a t)) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.2e+71) || !(a <= 2.5e+136)) {
tmp = (x + y) - ((z * y) / a);
} else {
tmp = fma((-z / (a - t)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.2e+71) || !(a <= 2.5e+136)) tmp = Float64(Float64(x + y) - Float64(Float64(z * y) / a)); else tmp = fma(Float64(Float64(-z) / Float64(a - t)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.2e+71], N[Not[LessEqual[a, 2.5e+136]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[((-z) / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.2 \cdot 10^{+71} \lor \neg \left(a \leq 2.5 \cdot 10^{+136}\right):\\
\;\;\;\;\left(x + y\right) - \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{a - t}, y, x\right)\\
\end{array}
\end{array}
if a < -5.19999999999999983e71 or 2.5000000000000001e136 < a Initial program 79.5%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.6
Applied rewrites82.6%
if -5.19999999999999983e71 < a < 2.5000000000000001e136Initial program 80.3%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6489.6
Applied rewrites89.6%
Taylor expanded in z around inf
Applied rewrites86.5%
Final simplification85.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.55e+159) (not (<= a 2.8e+138))) (+ x y) (fma (/ (- z) (- a t)) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.55e+159) || !(a <= 2.8e+138)) {
tmp = x + y;
} else {
tmp = fma((-z / (a - t)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.55e+159) || !(a <= 2.8e+138)) tmp = Float64(x + y); else tmp = fma(Float64(Float64(-z) / Float64(a - t)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.55e+159], N[Not[LessEqual[a, 2.8e+138]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(N[((-z) / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+159} \lor \neg \left(a \leq 2.8 \cdot 10^{+138}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{a - t}, y, x\right)\\
\end{array}
\end{array}
if a < -1.5499999999999999e159 or 2.8000000000000001e138 < a Initial program 80.8%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites88.9%
Applied rewrites87.3%
Taylor expanded in a around inf
Applied rewrites83.6%
if -1.5499999999999999e159 < a < 2.8000000000000001e138Initial program 79.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6489.0
Applied rewrites89.0%
Taylor expanded in z around inf
Applied rewrites85.0%
Final simplification84.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.6e+77) (not (<= a 7.8e+34))) (+ x y) (- x (/ (* y (- a z)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.6e+77) || !(a <= 7.8e+34)) {
tmp = x + y;
} else {
tmp = x - ((y * (a - z)) / 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 ((a <= (-5.6d+77)) .or. (.not. (a <= 7.8d+34))) then
tmp = x + y
else
tmp = x - ((y * (a - z)) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.6e+77) || !(a <= 7.8e+34)) {
tmp = x + y;
} else {
tmp = x - ((y * (a - z)) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.6e+77) or not (a <= 7.8e+34): tmp = x + y else: tmp = x - ((y * (a - z)) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.6e+77) || !(a <= 7.8e+34)) tmp = Float64(x + y); else tmp = Float64(x - Float64(Float64(y * Float64(a - z)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.6e+77) || ~((a <= 7.8e+34))) tmp = x + y; else tmp = x - ((y * (a - z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.6e+77], N[Not[LessEqual[a, 7.8e+34]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x - N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{+77} \lor \neg \left(a \leq 7.8 \cdot 10^{+34}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot \left(a - z\right)}{t}\\
\end{array}
\end{array}
if a < -5.60000000000000001e77 or 7.80000000000000038e34 < a Initial program 75.8%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites81.9%
Applied rewrites81.9%
Taylor expanded in a around inf
Applied rewrites75.3%
if -5.60000000000000001e77 < a < 7.80000000000000038e34Initial program 82.6%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-neg-fracN/A
fp-cancel-sub-signN/A
Applied rewrites76.8%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.55e+159) (fma y (/ t (- a t)) (+ y x)) (if (<= a 2.5e+136) (fma (/ (- z) (- a t)) y x) (- (+ x y) (/ (* z y) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.55e+159) {
tmp = fma(y, (t / (a - t)), (y + x));
} else if (a <= 2.5e+136) {
tmp = fma((-z / (a - t)), y, x);
} else {
tmp = (x + y) - ((z * y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.55e+159) tmp = fma(y, Float64(t / Float64(a - t)), Float64(y + x)); elseif (a <= 2.5e+136) tmp = fma(Float64(Float64(-z) / Float64(a - t)), y, x); else tmp = Float64(Float64(x + y) - Float64(Float64(z * y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.55e+159], N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.5e+136], N[(N[((-z) / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+159}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a - t}, y + x\right)\\
\mathbf{elif}\;a \leq 2.5 \cdot 10^{+136}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{a - t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if a < -1.5499999999999999e159Initial program 74.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
if -1.5499999999999999e159 < a < 2.5000000000000001e136Initial program 79.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6489.0
Applied rewrites89.0%
Taylor expanded in z around inf
Applied rewrites85.0%
if 2.5000000000000001e136 < a Initial program 86.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6490.2
Applied rewrites90.2%
Final simplification85.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.4e+80) (not (<= a 7.8e+34))) (+ x y) (fma (/ (- z a) t) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.4e+80) || !(a <= 7.8e+34)) {
tmp = x + y;
} else {
tmp = fma(((z - a) / t), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.4e+80) || !(a <= 7.8e+34)) tmp = Float64(x + y); else tmp = fma(Float64(Float64(z - a) / t), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.4e+80], N[Not[LessEqual[a, 7.8e+34]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.4 \cdot 10^{+80} \lor \neg \left(a \leq 7.8 \cdot 10^{+34}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - a}{t}, y, x\right)\\
\end{array}
\end{array}
if a < -8.40000000000000005e80 or 7.80000000000000038e34 < a Initial program 75.8%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites81.9%
Applied rewrites81.9%
Taylor expanded in a around inf
Applied rewrites75.3%
if -8.40000000000000005e80 < a < 7.80000000000000038e34Initial program 82.6%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6490.4
Applied rewrites90.4%
Taylor expanded in z around inf
Applied rewrites88.2%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
div-addN/A
*-lft-identityN/A
metadata-evalN/A
div-addN/A
fp-cancel-sub-sign-invN/A
distribute-lft-out--N/A
mul-1-negN/A
Applied rewrites76.2%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.4e-63) (not (<= a 35000000000.0))) (+ x y) (fma (/ z t) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.4e-63) || !(a <= 35000000000.0)) {
tmp = x + y;
} else {
tmp = fma((z / t), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -4.4e-63) || !(a <= 35000000000.0)) tmp = Float64(x + y); else tmp = fma(Float64(z / t), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.4e-63], N[Not[LessEqual[a, 35000000000.0]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.4 \cdot 10^{-63} \lor \neg \left(a \leq 35000000000\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right)\\
\end{array}
\end{array}
if a < -4.3999999999999999e-63 or 3.5e10 < a Initial program 78.4%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites80.6%
Applied rewrites81.9%
Taylor expanded in a around inf
Applied rewrites67.8%
if -4.3999999999999999e-63 < a < 3.5e10Initial program 81.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6488.6
Applied rewrites88.6%
Taylor expanded in a around 0
Applied rewrites81.2%
Final simplification74.0%
(FPCore (x y z t a) :precision binary64 (if (<= t 3e+129) (+ x y) (fma 0.0 y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 3e+129) {
tmp = x + y;
} else {
tmp = fma(0.0, y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 3e+129) tmp = Float64(x + y); else tmp = fma(0.0, y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 3e+129], N[(x + y), $MachinePrecision], N[(0.0 * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3 \cdot 10^{+129}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0, y, x\right)\\
\end{array}
\end{array}
if t < 3.0000000000000003e129Initial program 84.3%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites79.9%
Applied rewrites81.1%
Taylor expanded in a around inf
Applied rewrites59.1%
if 3.0000000000000003e129 < t Initial program 54.1%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites63.1%
Taylor expanded in t around inf
Applied rewrites70.0%
Final simplification60.6%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + 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 + y
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 80.1%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites77.5%
Applied rewrites79.6%
Taylor expanded in a around inf
Applied rewrites58.3%
Final simplification58.3%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 80.1%
Taylor expanded in x around 0
associate-/l*N/A
*-commutativeN/A
fp-cancel-sub-signN/A
mul-1-negN/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites41.9%
Taylor expanded in t around inf
Applied rewrites2.6%
Taylor expanded in y around 0
Applied rewrites2.6%
Final simplification2.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 2024338
(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))))