
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (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 - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (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 - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(if (<= t -6.2e-16)
(fma (/ (- x y) t) (- z a) y)
(if (<= t 2.2e+102)
(+ (/ (- y x) (/ (- a t) (- z t))) x)
(fma (- x y) (/ (- z a) t) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.2e-16) {
tmp = fma(((x - y) / t), (z - a), y);
} else if (t <= 2.2e+102) {
tmp = ((y - x) / ((a - t) / (z - t))) + x;
} else {
tmp = fma((x - y), ((z - a) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.2e-16) tmp = fma(Float64(Float64(x - y) / t), Float64(z - a), y); elseif (t <= 2.2e+102) tmp = Float64(Float64(Float64(y - x) / Float64(Float64(a - t) / Float64(z - t))) + x); else tmp = fma(Float64(x - y), Float64(Float64(z - a) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.2e-16], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 2.2e+102], N[(N[(N[(y - x), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z - a, y\right)\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+102}:\\
\;\;\;\;\frac{y - x}{\frac{a - t}{z - t}} + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\end{array}
\end{array}
if t < -6.2000000000000002e-16Initial program 35.1%
Taylor expanded in t 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.6%
if -6.2000000000000002e-16 < t < 2.20000000000000007e102Initial program 88.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6495.7
Applied rewrites95.7%
if 2.20000000000000007e102 < t Initial program 29.8%
Taylor expanded in t 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 rewrites91.9%
Applied rewrites92.7%
Final simplification92.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) z x)))
(if (<= a -7.5e+108)
t_1
(if (<= a -4.2e-50)
(fma (/ (- y x) t) a y)
(if (<= a -2.2e-185)
(* (/ (- x y) t) z)
(if (<= a 7.5e+50) (fma (- y) (/ z t) y) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (a <= -7.5e+108) {
tmp = t_1;
} else if (a <= -4.2e-50) {
tmp = fma(((y - x) / t), a, y);
} else if (a <= -2.2e-185) {
tmp = ((x - y) / t) * z;
} else if (a <= 7.5e+50) {
tmp = fma(-y, (z / t), y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (a <= -7.5e+108) tmp = t_1; elseif (a <= -4.2e-50) tmp = fma(Float64(Float64(y - x) / t), a, y); elseif (a <= -2.2e-185) tmp = Float64(Float64(Float64(x - y) / t) * z); elseif (a <= 7.5e+50) tmp = fma(Float64(-y), Float64(z / t), y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[a, -7.5e+108], t$95$1, If[LessEqual[a, -4.2e-50], N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * a + y), $MachinePrecision], If[LessEqual[a, -2.2e-185], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[a, 7.5e+50], N[((-y) * N[(z / t), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;a \leq -7.5 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -4.2 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{t}, a, y\right)\\
\mathbf{elif}\;a \leq -2.2 \cdot 10^{-185}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\mathbf{elif}\;a \leq 7.5 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{z}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -7.50000000000000039e108 or 7.4999999999999999e50 < a Initial program 71.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6478.3
Applied rewrites78.3%
Taylor expanded in x around 0
Applied rewrites72.1%
if -7.50000000000000039e108 < a < -4.2000000000000002e-50Initial program 51.0%
Taylor expanded in z 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
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.6
Applied rewrites41.6%
Taylor expanded in t around inf
Applied rewrites35.1%
Taylor expanded in a around 0
Applied rewrites56.0%
if -4.2000000000000002e-50 < a < -2.2e-185Initial program 76.1%
Taylor expanded in t 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 rewrites77.5%
Taylor expanded in z around inf
Applied rewrites67.1%
if -2.2e-185 < a < 7.4999999999999999e50Initial program 60.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
Taylor expanded in a around 0
Applied rewrites59.4%
Taylor expanded in z around 0
Applied rewrites59.4%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3e-79)
(fma (/ (- x y) t) (- z a) y)
(if (<= t 1.7e-178)
(fma (- y x) (/ z a) x)
(if (<= t 8.5e+51)
(+ (/ (* (- z t) y) (- a t)) x)
(fma (- x y) (/ (- z a) t) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3e-79) {
tmp = fma(((x - y) / t), (z - a), y);
} else if (t <= 1.7e-178) {
tmp = fma((y - x), (z / a), x);
} else if (t <= 8.5e+51) {
tmp = (((z - t) * y) / (a - t)) + x;
} else {
tmp = fma((x - y), ((z - a) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3e-79) tmp = fma(Float64(Float64(x - y) / t), Float64(z - a), y); elseif (t <= 1.7e-178) tmp = fma(Float64(y - x), Float64(z / a), x); elseif (t <= 8.5e+51) tmp = Float64(Float64(Float64(Float64(z - t) * y) / Float64(a - t)) + x); else tmp = fma(Float64(x - y), Float64(Float64(z - a) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3e-79], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 1.7e-178], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 8.5e+51], N[(N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z - a, y\right)\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-178}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+51}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\end{array}
\end{array}
if t < -3e-79Initial program 48.0%
Taylor expanded in t 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.3%
if -3e-79 < t < 1.69999999999999986e-178Initial program 88.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6479.6
Applied rewrites79.6%
Applied rewrites83.8%
if 1.69999999999999986e-178 < t < 8.4999999999999999e51Initial program 87.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.6
Applied rewrites73.6%
if 8.4999999999999999e51 < t Initial program 39.2%
Taylor expanded in t 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 rewrites89.3%
Applied rewrites89.8%
Final simplification82.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z t) (/ (- y x) (- a t)) x)))
(if (<= a -2.6e-16)
t_1
(if (<= a 1.1e-81) (fma (- x y) (/ (- z a) t) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z - t), ((y - x) / (a - t)), x);
double tmp;
if (a <= -2.6e-16) {
tmp = t_1;
} else if (a <= 1.1e-81) {
tmp = fma((x - y), ((z - a) / t), y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z - t), Float64(Float64(y - x) / Float64(a - t)), x) tmp = 0.0 if (a <= -2.6e-16) tmp = t_1; elseif (a <= 1.1e-81) tmp = fma(Float64(x - y), Float64(Float64(z - a) / t), y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.6e-16], t$95$1, If[LessEqual[a, 1.1e-81], N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z - t, \frac{y - x}{a - t}, x\right)\\
\mathbf{if}\;a \leq -2.6 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{-81}:\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.5999999999999998e-16 or 1.1e-81 < a Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6488.8
Applied rewrites88.8%
if -2.5999999999999998e-16 < a < 1.1e-81Initial program 61.3%
Taylor expanded in t 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.8%
Applied rewrites88.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) z x)))
(if (<= a -1.14e-23)
t_1
(if (<= a -2.2e-185)
(* (/ (- x y) t) z)
(if (<= a 7.5e+50) (fma (- y) (/ z t) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (a <= -1.14e-23) {
tmp = t_1;
} else if (a <= -2.2e-185) {
tmp = ((x - y) / t) * z;
} else if (a <= 7.5e+50) {
tmp = fma(-y, (z / t), y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (a <= -1.14e-23) tmp = t_1; elseif (a <= -2.2e-185) tmp = Float64(Float64(Float64(x - y) / t) * z); elseif (a <= 7.5e+50) tmp = fma(Float64(-y), Float64(z / t), y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[a, -1.14e-23], t$95$1, If[LessEqual[a, -2.2e-185], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[a, 7.5e+50], N[((-y) * N[(z / t), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;a \leq -1.14 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.2 \cdot 10^{-185}:\\
\;\;\;\;\frac{x - y}{t} \cdot z\\
\mathbf{elif}\;a \leq 7.5 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{z}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.14e-23 or 7.4999999999999999e50 < a Initial program 68.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6470.5
Applied rewrites70.5%
Taylor expanded in x around 0
Applied rewrites63.2%
if -1.14e-23 < a < -2.2e-185Initial program 69.0%
Taylor expanded in t 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 rewrites78.9%
Taylor expanded in z around inf
Applied rewrites61.2%
if -2.2e-185 < a < 7.4999999999999999e50Initial program 60.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6452.5
Applied rewrites52.5%
Taylor expanded in a around 0
Applied rewrites59.4%
Taylor expanded in z around 0
Applied rewrites59.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -3e-79) (fma (/ (- x y) t) (- z a) y) (if (<= t 1.95e+34) (fma (- y x) (/ z a) x) (fma (- x y) (/ (- z a) t) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3e-79) {
tmp = fma(((x - y) / t), (z - a), y);
} else if (t <= 1.95e+34) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = fma((x - y), ((z - a) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3e-79) tmp = fma(Float64(Float64(x - y) / t), Float64(z - a), y); elseif (t <= 1.95e+34) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = fma(Float64(x - y), Float64(Float64(z - a) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3e-79], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], If[LessEqual[t, 1.95e+34], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z - a, y\right)\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\end{array}
\end{array}
if t < -3e-79Initial program 48.0%
Taylor expanded in t 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.3%
if -3e-79 < t < 1.9500000000000001e34Initial program 87.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6472.1
Applied rewrites72.1%
Applied rewrites76.0%
if 1.9500000000000001e34 < t Initial program 41.5%
Taylor expanded in t 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 rewrites87.7%
Applied rewrites88.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- x y) (/ (- z a) t) y))) (if (<= t -1.15e-79) t_1 (if (<= t 1.95e+34) (fma (- y x) (/ z a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x - y), ((z - a) / t), y);
double tmp;
if (t <= -1.15e-79) {
tmp = t_1;
} else if (t <= 1.95e+34) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x - y), Float64(Float64(z - a) / t), y) tmp = 0.0 if (t <= -1.15e-79) tmp = t_1; elseif (t <= 1.95e+34) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -1.15e-79], t$95$1, If[LessEqual[t, 1.95e+34], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.15000000000000006e-79 or 1.9500000000000001e34 < t Initial program 45.6%
Taylor expanded in t 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 rewrites84.9%
Applied rewrites84.7%
if -1.15000000000000006e-79 < t < 1.9500000000000001e34Initial program 87.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6472.1
Applied rewrites72.1%
Applied rewrites76.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- x y) t) z y))) (if (<= t -5.6e-79) t_1 (if (<= t 1.95e+34) (fma (- y x) (/ z a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - y) / t), z, y);
double tmp;
if (t <= -5.6e-79) {
tmp = t_1;
} else if (t <= 1.95e+34) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - y) / t), z, y) tmp = 0.0 if (t <= -5.6e-79) tmp = t_1; elseif (t <= 1.95e+34) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[t, -5.6e-79], t$95$1, If[LessEqual[t, 1.95e+34], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.60000000000000023e-79 or 1.9500000000000001e34 < t Initial program 45.6%
Taylor expanded in t 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 rewrites84.9%
Taylor expanded in a around 0
Applied rewrites78.5%
if -5.60000000000000023e-79 < t < 1.9500000000000001e34Initial program 87.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6472.1
Applied rewrites72.1%
Applied rewrites76.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ y a) z x))) (if (<= a -2.1e+113) t_1 (if (<= a 1.7e+53) (fma (/ (- x y) t) z y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (a <= -2.1e+113) {
tmp = t_1;
} else if (a <= 1.7e+53) {
tmp = fma(((x - y) / t), z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (a <= -2.1e+113) tmp = t_1; elseif (a <= 1.7e+53) tmp = fma(Float64(Float64(x - y) / t), z, y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[a, -2.1e+113], t$95$1, If[LessEqual[a, 1.7e+53], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * z + y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;a \leq -2.1 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{+53}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, z, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.0999999999999999e113 or 1.69999999999999999e53 < a Initial program 72.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6479.1
Applied rewrites79.1%
Taylor expanded in x around 0
Applied rewrites72.8%
if -2.0999999999999999e113 < a < 1.69999999999999999e53Initial program 61.8%
Taylor expanded in t 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 rewrites77.4%
Taylor expanded in a around 0
Applied rewrites72.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ y a) z x))) (if (<= a -8e-12) t_1 (if (<= a 7.5e+50) (fma (- y) (/ z t) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (a <= -8e-12) {
tmp = t_1;
} else if (a <= 7.5e+50) {
tmp = fma(-y, (z / t), y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (a <= -8e-12) tmp = t_1; elseif (a <= 7.5e+50) tmp = fma(Float64(-y), Float64(z / t), y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[a, -8e-12], t$95$1, If[LessEqual[a, 7.5e+50], N[((-y) * N[(z / t), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;a \leq -8 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.5 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(-y, \frac{z}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -7.99999999999999984e-12 or 7.4999999999999999e50 < a Initial program 69.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6471.7
Applied rewrites71.7%
Taylor expanded in x around 0
Applied rewrites64.2%
if -7.99999999999999984e-12 < a < 7.4999999999999999e50Initial program 62.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6448.8
Applied rewrites48.8%
Taylor expanded in a around 0
Applied rewrites52.8%
Taylor expanded in z around 0
Applied rewrites52.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.45e+149) y (if (<= t 1.95e+34) (fma (/ y a) z x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.45e+149) {
tmp = y;
} else if (t <= 1.95e+34) {
tmp = fma((y / a), z, x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.45e+149) tmp = y; elseif (t <= 1.95e+34) tmp = fma(Float64(y / a), z, x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.45e+149], y, If[LessEqual[t, 1.95e+34], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+149}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.4500000000000001e149 or 1.9500000000000001e34 < t Initial program 32.0%
Taylor expanded in z 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
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6448.7
Applied rewrites48.7%
Taylor expanded in t around inf
Applied rewrites59.7%
if -1.4500000000000001e149 < t < 1.9500000000000001e34Initial program 82.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6460.9
Applied rewrites60.9%
Taylor expanded in x around 0
Applied rewrites50.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.2e-29) y (if (<= t 1.65e+34) (fma t (/ x a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.2e-29) {
tmp = y;
} else if (t <= 1.65e+34) {
tmp = fma(t, (x / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.2e-29) tmp = y; elseif (t <= 1.65e+34) tmp = fma(t, Float64(x / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.2e-29], y, If[LessEqual[t, 1.65e+34], N[(t * N[(x / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{-29}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -9.19999999999999965e-29 or 1.64999999999999994e34 < t Initial program 39.0%
Taylor expanded in z 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
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6443.4
Applied rewrites43.4%
Taylor expanded in t around inf
Applied rewrites48.8%
if -9.19999999999999965e-29 < t < 1.64999999999999994e34Initial program 88.0%
Taylor expanded in z 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
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.0
Applied rewrites41.0%
Taylor expanded in y around 0
Applied rewrites33.5%
Taylor expanded in t around 0
Applied rewrites34.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -6.4e-23) y (if (<= t 5.2e-79) (/ (* z y) a) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.4e-23) {
tmp = y;
} else if (t <= 5.2e-79) {
tmp = (z * y) / a;
} else {
tmp = y;
}
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 (t <= (-6.4d-23)) then
tmp = y
else if (t <= 5.2d-79) then
tmp = (z * y) / a
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.4e-23) {
tmp = y;
} else if (t <= 5.2e-79) {
tmp = (z * y) / a;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.4e-23: tmp = y elif t <= 5.2e-79: tmp = (z * y) / a else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.4e-23) tmp = y; elseif (t <= 5.2e-79) tmp = Float64(Float64(z * y) / a); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.4e-23) tmp = y; elseif (t <= 5.2e-79) tmp = (z * y) / a; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.4e-23], y, If[LessEqual[t, 5.2e-79], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.4 \cdot 10^{-23}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -6.39999999999999951e-23 or 5.19999999999999987e-79 < t Initial program 47.0%
Taylor expanded in z 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
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6445.6
Applied rewrites45.6%
Taylor expanded in t around inf
Applied rewrites42.9%
if -6.39999999999999951e-23 < t < 5.19999999999999987e-79Initial program 88.7%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6471.8
Applied rewrites71.8%
Taylor expanded in x around 0
Applied rewrites28.4%
(FPCore (x y z t a) :precision binary64 y)
double code(double x, double y, double z, double t, double a) {
return 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 = y
end function
public static double code(double x, double y, double z, double t, double a) {
return y;
}
def code(x, y, z, t, a): return y
function code(x, y, z, t, a) return y end
function tmp = code(x, y, z, t, a) tmp = y; end
code[x_, y_, z_, t_, a_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 65.4%
Taylor expanded in z 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
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.1
Applied rewrites42.1%
Taylor expanded in t around inf
Applied rewrites26.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024294
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))