
(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 14 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 (<= z -1e+46) (not (<= z 2e+121))) (fma (/ (- (- t x)) z) (- y a) t) (+ x (/ (* (- y z) (- t x)) (- a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+46) || !(z <= 2e+121)) {
tmp = fma((-(t - x) / z), (y - a), t);
} else {
tmp = x + (((y - z) * (t - x)) / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e+46) || !(z <= 2e+121)) tmp = fma(Float64(Float64(-Float64(t - x)) / z), Float64(y - a), t); else tmp = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e+46], N[Not[LessEqual[z, 2e+121]], $MachinePrecision]], N[(N[((-N[(t - x), $MachinePrecision]) / z), $MachinePrecision] * N[(y - a), $MachinePrecision] + t), $MachinePrecision], N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+46} \lor \neg \left(z \leq 2 \cdot 10^{+121}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-\left(t - x\right)}{z}, y - a, t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\end{array}
\end{array}
if z < -9.9999999999999999e45 or 2.00000000000000007e121 < z Initial program 37.3%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites81.1%
if -9.9999999999999999e45 < z < 2.00000000000000007e121Initial program 90.3%
Final simplification87.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t x) z) a t)))
(if (<= z -9.6e+85)
t_1
(if (<= z 2000000.0)
(fma (/ t a) y x)
(if (<= z 5e+118) (fma (/ (- t) a) z x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / z), a, t);
double tmp;
if (z <= -9.6e+85) {
tmp = t_1;
} else if (z <= 2000000.0) {
tmp = fma((t / a), y, x);
} else if (z <= 5e+118) {
tmp = fma((-t / a), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / z), a, t) tmp = 0.0 if (z <= -9.6e+85) tmp = t_1; elseif (z <= 2000000.0) tmp = fma(Float64(t / a), y, x); elseif (z <= 5e+118) tmp = fma(Float64(Float64(-t) / a), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * a + t), $MachinePrecision]}, If[LessEqual[z, -9.6e+85], t$95$1, If[LessEqual[z, 2000000.0], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 5e+118], N[(N[((-t) / a), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{z}, a, t\right)\\
\mathbf{if}\;z \leq -9.6 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.59999999999999986e85 or 4.99999999999999972e118 < z Initial program 35.6%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites81.8%
Taylor expanded in y around 0
Applied rewrites65.5%
if -9.59999999999999986e85 < z < 2e6Initial program 90.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6469.1
Applied rewrites69.1%
Taylor expanded in x around 0
Applied rewrites58.5%
if 2e6 < z < 4.99999999999999972e118Initial program 80.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6456.3
Applied rewrites56.3%
Taylor expanded in z around 0
Applied rewrites54.3%
Taylor expanded in x around 0
Applied rewrites58.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.6e-29)
(fma (/ t a) y x)
(if (<= a -5.3e-299)
(* (/ (- x t) z) y)
(if (<= a 9.2e-32) t (fma (/ (- x t) a) z x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.6e-29) {
tmp = fma((t / a), y, x);
} else if (a <= -5.3e-299) {
tmp = ((x - t) / z) * y;
} else if (a <= 9.2e-32) {
tmp = t;
} else {
tmp = fma(((x - t) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.6e-29) tmp = fma(Float64(t / a), y, x); elseif (a <= -5.3e-299) tmp = Float64(Float64(Float64(x - t) / z) * y); elseif (a <= 9.2e-32) tmp = t; else tmp = fma(Float64(Float64(x - t) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.6e-29], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[a, -5.3e-299], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[a, 9.2e-32], t, N[(N[(N[(x - t), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;a \leq -5.3 \cdot 10^{-299}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{-32}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{a}, z, x\right)\\
\end{array}
\end{array}
if a < -2.6000000000000002e-29Initial program 78.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6473.4
Applied rewrites73.4%
Taylor expanded in x around 0
Applied rewrites65.1%
if -2.6000000000000002e-29 < a < -5.3000000000000004e-299Initial program 78.0%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites83.8%
Taylor expanded in y around inf
Applied rewrites58.9%
if -5.3000000000000004e-299 < a < 9.2000000000000002e-32Initial program 58.2%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6437.6
Applied rewrites37.6%
Taylor expanded in z around inf
Applied rewrites54.0%
Applied rewrites54.0%
if 9.2000000000000002e-32 < a Initial program 69.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
Taylor expanded in z around 0
Applied rewrites60.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.7e+29) (not (<= a 3.1e-38))) (fma (- y z) (/ (- t x) a) x) (fma (/ (- (- t x)) z) (- y a) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.7e+29) || !(a <= 3.1e-38)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = fma((-(t - x) / z), (y - a), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.7e+29) || !(a <= 3.1e-38)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = fma(Float64(Float64(-Float64(t - x)) / z), Float64(y - a), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.7e+29], N[Not[LessEqual[a, 3.1e-38]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[((-N[(t - x), $MachinePrecision]) / z), $MachinePrecision] * N[(y - a), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.7 \cdot 10^{+29} \lor \neg \left(a \leq 3.1 \cdot 10^{-38}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-\left(t - x\right)}{z}, y - a, t\right)\\
\end{array}
\end{array}
if a < -5.6999999999999999e29 or 3.09999999999999983e-38 < a Initial program 73.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--.f6481.6
Applied rewrites81.6%
if -5.6999999999999999e29 < a < 3.09999999999999983e-38Initial program 70.0%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites83.9%
Final simplification82.8%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.6e-29)
(fma (/ t a) y x)
(if (<= a -5.3e-299)
(* (/ (- x t) z) y)
(if (<= a 9.2e-32) t (fma (/ (- t) a) z x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.6e-29) {
tmp = fma((t / a), y, x);
} else if (a <= -5.3e-299) {
tmp = ((x - t) / z) * y;
} else if (a <= 9.2e-32) {
tmp = t;
} else {
tmp = fma((-t / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.6e-29) tmp = fma(Float64(t / a), y, x); elseif (a <= -5.3e-299) tmp = Float64(Float64(Float64(x - t) / z) * y); elseif (a <= 9.2e-32) tmp = t; else tmp = fma(Float64(Float64(-t) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.6e-29], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[a, -5.3e-299], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[a, 9.2e-32], t, N[(N[((-t) / a), $MachinePrecision] * z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;a \leq -5.3 \cdot 10^{-299}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{-32}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{a}, z, x\right)\\
\end{array}
\end{array}
if a < -2.6000000000000002e-29Initial program 78.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6473.4
Applied rewrites73.4%
Taylor expanded in x around 0
Applied rewrites65.1%
if -2.6000000000000002e-29 < a < -5.3000000000000004e-299Initial program 78.0%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites83.8%
Taylor expanded in y around inf
Applied rewrites58.9%
if -5.3000000000000004e-299 < a < 9.2000000000000002e-32Initial program 58.2%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6437.6
Applied rewrites37.6%
Taylor expanded in z around inf
Applied rewrites54.0%
Applied rewrites54.0%
if 9.2000000000000002e-32 < a Initial program 69.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
Taylor expanded in z around 0
Applied rewrites60.8%
Taylor expanded in x around 0
Applied rewrites60.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.6e+87)
t
(if (<= z 2000000.0)
(fma (/ t a) y x)
(if (<= z 5e+205) (fma (/ (- t) a) z x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e+87) {
tmp = t;
} else if (z <= 2000000.0) {
tmp = fma((t / a), y, x);
} else if (z <= 5e+205) {
tmp = fma((-t / a), z, x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e+87) tmp = t; elseif (z <= 2000000.0) tmp = fma(Float64(t / a), y, x); elseif (z <= 5e+205) tmp = fma(Float64(Float64(-t) / a), z, x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e+87], t, If[LessEqual[z, 2000000.0], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 5e+205], N[(N[((-t) / a), $MachinePrecision] * z + x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+87}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 2000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+205}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.59999999999999994e87 or 5.0000000000000002e205 < z Initial program 37.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6454.0
Applied rewrites54.0%
Taylor expanded in z around inf
Applied rewrites65.2%
Applied rewrites65.2%
if -3.59999999999999994e87 < z < 2e6Initial program 90.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6469.1
Applied rewrites69.1%
Taylor expanded in x around 0
Applied rewrites58.5%
if 2e6 < z < 5.0000000000000002e205Initial program 55.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6455.1
Applied rewrites55.1%
Taylor expanded in z around 0
Applied rewrites45.5%
Taylor expanded in x around 0
Applied rewrites47.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.7e-29) (not (<= a 7.5e-44))) (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 <= -2.7e-29) || !(a <= 7.5e-44)) {
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 <= -2.7e-29) || !(a <= 7.5e-44)) 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, -2.7e-29], N[Not[LessEqual[a, 7.5e-44]], $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 -2.7 \cdot 10^{-29} \lor \neg \left(a \leq 7.5 \cdot 10^{-44}\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 < -2.70000000000000023e-29 or 7.50000000000000008e-44 < a Initial program 74.1%
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--.f6479.5
Applied rewrites79.5%
if -2.70000000000000023e-29 < a < 7.50000000000000008e-44Initial program 68.8%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites86.5%
Taylor expanded in a around 0
Applied rewrites82.5%
Final simplification80.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.7e-29) (not (<= a 3.2e-30))) (fma (/ (- t x) a) y x) (fma (/ (- x t) z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.7e-29) || !(a <= 3.2e-30)) {
tmp = fma(((t - x) / a), y, x);
} else {
tmp = fma(((x - t) / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.7e-29) || !(a <= 3.2e-30)) tmp = fma(Float64(Float64(t - x) / a), y, 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, -2.7e-29], N[Not[LessEqual[a, 3.2e-30]], $MachinePrecision]], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{-29} \lor \neg \left(a \leq 3.2 \cdot 10^{-30}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -2.70000000000000023e-29 or 3.2e-30 < a Initial program 74.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6471.4
Applied rewrites71.4%
if -2.70000000000000023e-29 < a < 3.2e-30Initial program 68.5%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites85.9%
Taylor expanded in a around 0
Applied rewrites82.0%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.7e-29) (fma (/ t a) y x) (if (<= a 3.2e-30) (fma (/ (- x t) z) y t) (fma (/ (- x t) a) z x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.7e-29) {
tmp = fma((t / a), y, x);
} else if (a <= 3.2e-30) {
tmp = fma(((x - t) / z), y, t);
} else {
tmp = fma(((x - t) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.7e-29) tmp = fma(Float64(t / a), y, x); elseif (a <= 3.2e-30) tmp = fma(Float64(Float64(x - t) / z), y, t); else tmp = fma(Float64(Float64(x - t) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.7e-29], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[a, 3.2e-30], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{a}, z, x\right)\\
\end{array}
\end{array}
if a < -2.70000000000000023e-29Initial program 78.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6473.4
Applied rewrites73.4%
Taylor expanded in x around 0
Applied rewrites65.1%
if -2.70000000000000023e-29 < a < 3.2e-30Initial program 68.5%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites85.9%
Taylor expanded in a around 0
Applied rewrites82.0%
if 3.2e-30 < a Initial program 69.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
Taylor expanded in z around 0
Applied rewrites60.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.6e+87) (not (<= z 2.55e+126))) t (fma (/ t a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.6e+87) || !(z <= 2.55e+126)) {
tmp = t;
} else {
tmp = fma((t / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.6e+87) || !(z <= 2.55e+126)) tmp = t; else tmp = fma(Float64(t / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.6e+87], N[Not[LessEqual[z, 2.55e+126]], $MachinePrecision]], t, N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+87} \lor \neg \left(z \leq 2.55 \cdot 10^{+126}\right):\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -3.59999999999999994e87 or 2.5500000000000001e126 < z Initial program 36.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6454.6
Applied rewrites54.6%
Taylor expanded in z around inf
Applied rewrites56.9%
Applied rewrites56.9%
if -3.59999999999999994e87 < z < 2.5500000000000001e126Initial program 88.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.3
Applied rewrites66.3%
Taylor expanded in x around 0
Applied rewrites55.1%
Final simplification55.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.5e+30) (not (<= z 1.1e+133))) t (fma (/ x a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.5e+30) || !(z <= 1.1e+133)) {
tmp = t;
} else {
tmp = fma((x / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.5e+30) || !(z <= 1.1e+133)) tmp = t; else tmp = fma(Float64(x / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.5e+30], N[Not[LessEqual[z, 1.1e+133]], $MachinePrecision]], t, N[(N[(x / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+30} \lor \neg \left(z \leq 1.1 \cdot 10^{+133}\right):\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{a}, z, x\right)\\
\end{array}
\end{array}
if z < -3.50000000000000021e30 or 1.1e133 < z Initial program 39.5%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.1
Applied rewrites52.1%
Taylor expanded in z around inf
Applied rewrites54.1%
Applied rewrites54.1%
if -3.50000000000000021e30 < z < 1.1e133Initial program 89.1%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6449.2
Applied rewrites49.2%
Taylor expanded in z around 0
Applied rewrites49.8%
Taylor expanded in x around inf
Applied rewrites42.3%
Final simplification46.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.8e+67) (* 1.0 x) (if (<= a 9.2e-32) t (fma (/ z a) x x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.8e+67) {
tmp = 1.0 * x;
} else if (a <= 9.2e-32) {
tmp = t;
} else {
tmp = fma((z / a), x, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.8e+67) tmp = Float64(1.0 * x); elseif (a <= 9.2e-32) tmp = t; else tmp = fma(Float64(z / a), x, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.8e+67], N[(1.0 * x), $MachinePrecision], If[LessEqual[a, 9.2e-32], t, N[(N[(z / a), $MachinePrecision] * x + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{+67}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{-32}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, x, x\right)\\
\end{array}
\end{array}
if a < -4.80000000000000004e67Initial program 81.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6479.8
Applied rewrites79.8%
Taylor expanded in x around inf
Applied rewrites69.6%
Taylor expanded in y around 0
Applied rewrites58.8%
if -4.80000000000000004e67 < a < 9.2000000000000002e-32Initial program 68.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6433.6
Applied rewrites33.6%
Taylor expanded in z around inf
Applied rewrites38.4%
Applied rewrites38.4%
if 9.2000000000000002e-32 < a Initial program 69.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
Taylor expanded in z around 0
Applied rewrites60.8%
Taylor expanded in x around inf
Applied rewrites48.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.8e+67) (not (<= a 3.2e-30))) (* 1.0 x) t))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.8e+67) || !(a <= 3.2e-30)) {
tmp = 1.0 * x;
} else {
tmp = 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 <= (-4.8d+67)) .or. (.not. (a <= 3.2d-30))) then
tmp = 1.0d0 * x
else
tmp = 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 <= -4.8e+67) || !(a <= 3.2e-30)) {
tmp = 1.0 * x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -4.8e+67) or not (a <= 3.2e-30): tmp = 1.0 * x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -4.8e+67) || !(a <= 3.2e-30)) tmp = Float64(1.0 * x); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -4.8e+67) || ~((a <= 3.2e-30))) tmp = 1.0 * x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.8e+67], N[Not[LessEqual[a, 3.2e-30]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{+67} \lor \neg \left(a \leq 3.2 \cdot 10^{-30}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if a < -4.80000000000000004e67 or 3.2e-30 < a Initial program 74.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6473.9
Applied rewrites73.9%
Taylor expanded in x around inf
Applied rewrites62.8%
Taylor expanded in y around 0
Applied rewrites53.0%
if -4.80000000000000004e67 < a < 3.2e-30Initial program 68.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6433.6
Applied rewrites33.6%
Taylor expanded in z around inf
Applied rewrites38.4%
Applied rewrites38.4%
Final simplification45.1%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return 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 = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 71.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6450.2
Applied rewrites50.2%
Taylor expanded in z around inf
Applied rewrites25.7%
Applied rewrites25.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 2024339
(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))))