
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
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 - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
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 - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.000122) (not (<= a 4.6e+31))) (* (fma (/ (- y z) (- a z)) (- (/ t x) 1.0) 1.0) x) (fma (- (- t x)) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.000122) || !(a <= 4.6e+31)) {
tmp = fma(((y - z) / (a - z)), ((t / x) - 1.0), 1.0) * x;
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.000122) || !(a <= 4.6e+31)) tmp = Float64(fma(Float64(Float64(y - z) / Float64(a - z)), Float64(Float64(t / x) - 1.0), 1.0) * x); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.000122], N[Not[LessEqual[a, 4.6e+31]], $MachinePrecision]], N[(N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(N[(t / x), $MachinePrecision] - 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000122 \lor \neg \left(a \leq 4.6 \cdot 10^{+31}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, \frac{t}{x} - 1, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -1.21999999999999997e-4 or 4.5999999999999999e31 < a Initial program 73.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.5%
if -1.21999999999999997e-4 < a < 4.5999999999999999e31Initial program 56.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites87.2%
Final simplification86.3%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.3e+141)
(/ (* t (- y z)) a)
(if (or (<= a -2.5e+49) (not (<= a 3.1e+42)))
(* (/ (- t x) a) y)
(fma (/ x z) y t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.3e+141) {
tmp = (t * (y - z)) / a;
} else if ((a <= -2.5e+49) || !(a <= 3.1e+42)) {
tmp = ((t - x) / a) * y;
} else {
tmp = fma((x / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.3e+141) tmp = Float64(Float64(t * Float64(y - z)) / a); elseif ((a <= -2.5e+49) || !(a <= 3.1e+42)) tmp = Float64(Float64(Float64(t - x) / a) * y); else tmp = fma(Float64(x / z), y, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.3e+141], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[Or[LessEqual[a, -2.5e+49], N[Not[LessEqual[a, 3.1e+42]], $MachinePrecision]], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{+141}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a}\\
\mathbf{elif}\;a \leq -2.5 \cdot 10^{+49} \lor \neg \left(a \leq 3.1 \cdot 10^{+42}\right):\\
\;\;\;\;\frac{t - x}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -1.3e141Initial program 80.4%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.0
Applied rewrites83.0%
Taylor expanded in x around 0
Applied rewrites32.5%
if -1.3e141 < a < -2.5000000000000002e49 or 3.1000000000000002e42 < a Initial program 68.2%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in y around inf
Applied rewrites35.9%
if -2.5000000000000002e49 < a < 3.1000000000000002e42Initial program 58.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites85.1%
Taylor expanded in a around 0
Applied rewrites82.4%
Taylor expanded in x around inf
Applied rewrites71.3%
Final simplification54.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.000145) (not (<= a 3e+32))) (fma (- y z) (/ (- t x) a) x) (fma (- (- t x)) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.000145) || !(a <= 3e+32)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.000145) || !(a <= 3e+32)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.000145], N[Not[LessEqual[a, 3e+32]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000145 \lor \neg \left(a \leq 3 \cdot 10^{+32}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -1.45e-4 or 3e32 < a Initial program 73.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.2
Applied rewrites83.2%
if -1.45e-4 < a < 3e32Initial program 56.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites87.2%
Final simplification85.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.000122) (not (<= a 2.6e+32))) (fma (- y z) (/ (- t x) a) x) (fma (/ (- x t) z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.000122) || !(a <= 2.6e+32)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = fma(((x - t) / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.000122) || !(a <= 2.6e+32)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = fma(Float64(Float64(x - t) / z), y, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.000122], N[Not[LessEqual[a, 2.6e+32]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000122 \lor \neg \left(a \leq 2.6 \cdot 10^{+32}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -1.21999999999999997e-4 or 2.6000000000000002e32 < a Initial program 73.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.2
Applied rewrites83.2%
if -1.21999999999999997e-4 < a < 2.6000000000000002e32Initial program 56.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites87.2%
Taylor expanded in a around 0
Applied rewrites84.3%
Final simplification83.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.000202) (not (<= a 1.35e+35))) (fma (- y z) (/ t a) x) (fma (/ (- x t) z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.000202) || !(a <= 1.35e+35)) {
tmp = fma((y - z), (t / a), x);
} else {
tmp = fma(((x - t) / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.000202) || !(a <= 1.35e+35)) tmp = fma(Float64(y - z), Float64(t / a), x); else tmp = fma(Float64(Float64(x - t) / z), y, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.000202], N[Not[LessEqual[a, 1.35e+35]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000202 \lor \neg \left(a \leq 1.35 \cdot 10^{+35}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -2.02000000000000004e-4 or 1.35000000000000001e35 < a Initial program 73.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.2
Applied rewrites83.2%
Taylor expanded in x around 0
Applied rewrites72.8%
if -2.02000000000000004e-4 < a < 1.35000000000000001e35Initial program 56.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites87.2%
Taylor expanded in a around 0
Applied rewrites84.3%
Final simplification78.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.000202) (not (<= a 1.5e+35))) (+ x (/ (* t y) a)) (fma (/ (- x t) z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.000202) || !(a <= 1.5e+35)) {
tmp = x + ((t * y) / a);
} else {
tmp = fma(((x - t) / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.000202) || !(a <= 1.5e+35)) tmp = Float64(x + Float64(Float64(t * y) / a)); else tmp = fma(Float64(Float64(x - t) / z), y, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.000202], N[Not[LessEqual[a, 1.5e+35]], $MachinePrecision]], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000202 \lor \neg \left(a \leq 1.5 \cdot 10^{+35}\right):\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -2.02000000000000004e-4 or 1.49999999999999995e35 < a Initial program 73.5%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in x around 0
Applied rewrites58.5%
if -2.02000000000000004e-4 < a < 1.49999999999999995e35Initial program 56.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites87.2%
Taylor expanded in a around 0
Applied rewrites84.3%
Final simplification71.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -0.000202) (fma (- y z) (/ t a) x) (if (<= a 2.6e+32) (fma (/ (- x t) z) y t) (fma (/ (- t x) a) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.000202) {
tmp = fma((y - z), (t / a), x);
} else if (a <= 2.6e+32) {
tmp = fma(((x - t) / z), y, t);
} else {
tmp = fma(((t - x) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -0.000202) tmp = fma(Float64(y - z), Float64(t / a), x); elseif (a <= 2.6e+32) tmp = fma(Float64(Float64(x - t) / z), y, t); else tmp = fma(Float64(Float64(t - x) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -0.000202], N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 2.6e+32], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.000202:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\mathbf{elif}\;a \leq 2.6 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\end{array}
\end{array}
if a < -2.02000000000000004e-4Initial program 78.6%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.2
Applied rewrites83.2%
Taylor expanded in x around 0
Applied rewrites73.9%
if -2.02000000000000004e-4 < a < 2.6000000000000002e32Initial program 56.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites87.2%
Taylor expanded in a around 0
Applied rewrites84.3%
if 2.6000000000000002e32 < a Initial program 68.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6474.1
Applied rewrites74.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.00019) (not (<= a 1.5e+35))) (+ x (/ (* t y) a)) (fma (/ x z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.00019) || !(a <= 1.5e+35)) {
tmp = x + ((t * y) / a);
} else {
tmp = fma((x / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.00019) || !(a <= 1.5e+35)) tmp = Float64(x + Float64(Float64(t * y) / a)); else tmp = fma(Float64(x / z), y, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.00019], N[Not[LessEqual[a, 1.5e+35]], $MachinePrecision]], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00019 \lor \neg \left(a \leq 1.5 \cdot 10^{+35}\right):\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -1.9000000000000001e-4 or 1.49999999999999995e35 < a Initial program 73.5%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in x around 0
Applied rewrites58.5%
if -1.9000000000000001e-4 < a < 1.49999999999999995e35Initial program 56.9%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites87.2%
Taylor expanded in a around 0
Applied rewrites84.3%
Taylor expanded in x around inf
Applied rewrites73.3%
Final simplification66.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.5e+22) (not (<= z 2.5e-129))) (fma (/ x z) y t) (* (- t x) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.5e+22) || !(z <= 2.5e-129)) {
tmp = fma((x / z), y, t);
} else {
tmp = (t - x) * (y / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.5e+22) || !(z <= 2.5e-129)) tmp = fma(Float64(x / z), y, t); else tmp = Float64(Float64(t - x) * Float64(y / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.5e+22], N[Not[LessEqual[z, 2.5e-129]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+22} \lor \neg \left(z \leq 2.5 \cdot 10^{-129}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -5.50000000000000021e22 or 2.50000000000000014e-129 < z Initial program 54.0%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites67.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites68.9%
Taylor expanded in a around 0
Applied rewrites64.9%
Taylor expanded in x around inf
Applied rewrites58.1%
if -5.50000000000000021e22 < z < 2.50000000000000014e-129Initial program 86.0%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6456.3
Applied rewrites56.3%
Taylor expanded in z around 0
Applied rewrites46.8%
Final simplification54.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.5e+22) (not (<= z 2.5e-129))) (fma (/ x z) y t) (* (/ (- t x) a) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.5e+22) || !(z <= 2.5e-129)) {
tmp = fma((x / z), y, t);
} else {
tmp = ((t - x) / a) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.5e+22) || !(z <= 2.5e-129)) tmp = fma(Float64(x / z), y, t); else tmp = Float64(Float64(Float64(t - x) / a) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.5e+22], N[Not[LessEqual[z, 2.5e-129]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+22} \lor \neg \left(z \leq 2.5 \cdot 10^{-129}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t - x}{a} \cdot y\\
\end{array}
\end{array}
if z < -5.50000000000000021e22 or 2.50000000000000014e-129 < z Initial program 54.0%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites67.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites68.9%
Taylor expanded in a around 0
Applied rewrites64.9%
Taylor expanded in x around inf
Applied rewrites58.1%
if -5.50000000000000021e22 < z < 2.50000000000000014e-129Initial program 86.0%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.5
Applied rewrites77.5%
Taylor expanded in y around inf
Applied rewrites42.5%
Final simplification52.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.45e-38) (not (<= x 1.9e+45))) (* x (/ y z)) (+ x (- t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.45e-38) || !(x <= 1.9e+45)) {
tmp = x * (y / z);
} else {
tmp = x + (t - x);
}
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 ((x <= (-1.45d-38)) .or. (.not. (x <= 1.9d+45))) then
tmp = x * (y / z)
else
tmp = x + (t - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.45e-38) || !(x <= 1.9e+45)) {
tmp = x * (y / z);
} else {
tmp = x + (t - x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.45e-38) or not (x <= 1.9e+45): tmp = x * (y / z) else: tmp = x + (t - x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.45e-38) || !(x <= 1.9e+45)) tmp = Float64(x * Float64(y / z)); else tmp = Float64(x + Float64(t - x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1.45e-38) || ~((x <= 1.9e+45))) tmp = x * (y / z); else tmp = x + (t - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.45e-38], N[Not[LessEqual[x, 1.9e+45]], $MachinePrecision]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-38} \lor \neg \left(x \leq 1.9 \cdot 10^{+45}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right)\\
\end{array}
\end{array}
if x < -1.44999999999999997e-38 or 1.9000000000000001e45 < x Initial program 54.7%
Taylor expanded in z around inf
Applied rewrites34.1%
Taylor expanded in a around 0
Applied rewrites47.1%
Taylor expanded in x around inf
Applied rewrites28.9%
if -1.44999999999999997e-38 < x < 1.9000000000000001e45Initial program 75.2%
Taylor expanded in z around inf
lower--.f6436.3
Applied rewrites36.3%
Final simplification32.6%
(FPCore (x y z t a) :precision binary64 (if (<= y 1.9e+103) (fma (/ x z) y t) (* (/ (- x t) z) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.9e+103) {
tmp = fma((x / z), y, t);
} else {
tmp = ((x - t) / z) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= 1.9e+103) tmp = fma(Float64(x / z), y, t); else tmp = Float64(Float64(Float64(x - t) / z) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 1.9e+103], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{+103}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\end{array}
\end{array}
if y < 1.8999999999999998e103Initial program 64.6%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites72.3%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites55.6%
Taylor expanded in a around 0
Applied rewrites51.2%
Taylor expanded in x around inf
Applied rewrites46.6%
if 1.8999999999999998e103 < y Initial program 67.1%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites71.3%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites46.7%
Taylor expanded in y around inf
Applied rewrites44.2%
(FPCore (x y z t a) :precision binary64 (fma (/ x z) y t))
double code(double x, double y, double z, double t, double a) {
return fma((x / z), y, t);
}
function code(x, y, z, t, a) return fma(Float64(x / z), y, t) end
code[x_, y_, z_, t_, a_] := N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{x}{z}, y, t\right)
\end{array}
Initial program 65.0%
Taylor expanded in t around inf
associate--l+N/A
div-subN/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites72.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites54.0%
Taylor expanded in a around 0
Applied rewrites51.1%
Taylor expanded in x around inf
Applied rewrites44.5%
(FPCore (x y z t a) :precision binary64 (+ x (- t x)))
double code(double x, double y, double z, double t, double a) {
return x + (t - 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 = x + (t - x)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
def code(x, y, z, t, a): return x + (t - x)
function code(x, y, z, t, a) return Float64(x + Float64(t - x)) end
function tmp = code(x, y, z, t, a) tmp = x + (t - x); end
code[x_, y_, z_, t_, a_] := N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right)
\end{array}
Initial program 65.0%
Taylor expanded in z around inf
lower--.f6422.2
Applied rewrites22.2%
(FPCore (x y z t a) :precision binary64 (+ x (- x)))
double code(double x, double y, double z, double t, double a) {
return x + -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 = x + -x
end function
public static double code(double x, double y, double z, double t, double a) {
return x + -x;
}
def code(x, y, z, t, a): return x + -x
function code(x, y, z, t, a) return Float64(x + Float64(-x)) end
function tmp = code(x, y, z, t, a) tmp = x + -x; end
code[x_, y_, z_, t_, a_] := N[(x + (-x)), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-x\right)
\end{array}
Initial program 65.0%
Taylor expanded in z around inf
lower--.f6422.2
Applied rewrites22.2%
Taylor expanded in x around inf
Applied rewrites2.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ y z) (- t x)))))
(if (< z -1.2536131056095036e+188)
t_1
(if (< z 4.446702369113811e+64)
(+ x (/ (- y z) (/ (- a z) (- t x))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x))
if (z < (-1.2536131056095036d+188)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - ((y / z) * (t - x)) tmp = 0 if z < -1.2536131056095036e+188: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x + ((y - z) / ((a - z) / (t - x))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(y / z) * Float64(t - x))) tmp = 0.0 if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(a - z) / Float64(t - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - ((y / z) * (t - x)); tmp = 0.0; if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x + ((y - z) / ((a - z) / (t - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y / z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -1.2536131056095036e+188], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{y}{z} \cdot \left(t - x\right)\\
\mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024329
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< z -125361310560950360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- t (* (/ y z) (- t x))) (if (< z 44467023691138110000000000000000000000000000000000000000000000000) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x))))))
(+ x (/ (* (- y z) (- t x)) (- a z))))