
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= y -3.5e+132)
(* y t)
(if (<= y -3.9e+49)
(* y (- x))
(if (<= y -5.5e-7)
t_1
(if (<= y 1.32e-204)
(fma x z x)
(if (<= y 2.1e-137)
t_1
(if (<= y 1.22e-23) (fma x z x) (* y t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (y <= -3.5e+132) {
tmp = y * t;
} else if (y <= -3.9e+49) {
tmp = y * -x;
} else if (y <= -5.5e-7) {
tmp = t_1;
} else if (y <= 1.32e-204) {
tmp = fma(x, z, x);
} else if (y <= 2.1e-137) {
tmp = t_1;
} else if (y <= 1.22e-23) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -3.5e+132) tmp = Float64(y * t); elseif (y <= -3.9e+49) tmp = Float64(y * Float64(-x)); elseif (y <= -5.5e-7) tmp = t_1; elseif (y <= 1.32e-204) tmp = fma(x, z, x); elseif (y <= 2.1e-137) tmp = t_1; elseif (y <= 1.22e-23) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -3.5e+132], N[(y * t), $MachinePrecision], If[LessEqual[y, -3.9e+49], N[(y * (-x)), $MachinePrecision], If[LessEqual[y, -5.5e-7], t$95$1, If[LessEqual[y, 1.32e-204], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 2.1e-137], t$95$1, If[LessEqual[y, 1.22e-23], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{+132}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -3.9 \cdot 10^{+49}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{-204}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -3.5000000000000002e132 or 1.22000000000000007e-23 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6478.1
Applied rewrites78.1%
Taylor expanded in t around inf
Applied rewrites55.6%
if -3.5000000000000002e132 < y < -3.9000000000000001e49Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
mul-1-negN/A
sub-negN/A
lower-*.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
Applied rewrites49.2%
if -3.9000000000000001e49 < y < -5.5000000000000003e-7 or 1.32e-204 < y < 2.09999999999999992e-137Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6494.8
Applied rewrites94.8%
Taylor expanded in x around 0
Applied rewrites87.3%
if -5.5000000000000003e-7 < y < 1.32e-204 or 2.09999999999999992e-137 < y < 1.22000000000000007e-23Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6498.1
Applied rewrites98.1%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6491.7
Applied rewrites91.7%
Taylor expanded in x around inf
Applied rewrites64.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= y -4.4e+35)
(* y t)
(if (<= y -5.5e-7)
t_1
(if (<= y 1.32e-204)
(fma x z x)
(if (<= y 2.1e-137) t_1 (if (<= y 1.22e-23) (fma x z x) (* y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (y <= -4.4e+35) {
tmp = y * t;
} else if (y <= -5.5e-7) {
tmp = t_1;
} else if (y <= 1.32e-204) {
tmp = fma(x, z, x);
} else if (y <= 2.1e-137) {
tmp = t_1;
} else if (y <= 1.22e-23) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -4.4e+35) tmp = Float64(y * t); elseif (y <= -5.5e-7) tmp = t_1; elseif (y <= 1.32e-204) tmp = fma(x, z, x); elseif (y <= 2.1e-137) tmp = t_1; elseif (y <= 1.22e-23) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -4.4e+35], N[(y * t), $MachinePrecision], If[LessEqual[y, -5.5e-7], t$95$1, If[LessEqual[y, 1.32e-204], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 2.1e-137], t$95$1, If[LessEqual[y, 1.22e-23], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+35}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{-204}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -4.3999999999999997e35 or 1.22000000000000007e-23 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6476.9
Applied rewrites76.9%
Taylor expanded in t around inf
Applied rewrites50.6%
if -4.3999999999999997e35 < y < -5.5000000000000003e-7 or 1.32e-204 < y < 2.09999999999999992e-137Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites91.9%
if -5.5000000000000003e-7 < y < 1.32e-204 or 2.09999999999999992e-137 < y < 1.22000000000000007e-23Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6498.1
Applied rewrites98.1%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6491.7
Applied rewrites91.7%
Taylor expanded in x around inf
Applied rewrites64.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma x (- z y) x)))
(if (<= x -4.2e+48)
t_1
(if (<= x 2.8e-164)
(* (- y z) t)
(if (<= x 1.2e-91)
(fma z (- t) x)
(if (<= x 1.6e+107) (* z (- x t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, (z - y), x);
double tmp;
if (x <= -4.2e+48) {
tmp = t_1;
} else if (x <= 2.8e-164) {
tmp = (y - z) * t;
} else if (x <= 1.2e-91) {
tmp = fma(z, -t, x);
} else if (x <= 1.6e+107) {
tmp = z * (x - t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, Float64(z - y), x) tmp = 0.0 if (x <= -4.2e+48) tmp = t_1; elseif (x <= 2.8e-164) tmp = Float64(Float64(y - z) * t); elseif (x <= 1.2e-91) tmp = fma(z, Float64(-t), x); elseif (x <= 1.6e+107) tmp = Float64(z * Float64(x - t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z - y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -4.2e+48], t$95$1, If[LessEqual[x, 2.8e-164], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[x, 1.2e-91], N[(z * (-t) + x), $MachinePrecision], If[LessEqual[x, 1.6e+107], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, z - y, x\right)\\
\mathbf{if}\;x \leq -4.2 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-164}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-91}:\\
\;\;\;\;\mathsf{fma}\left(z, -t, x\right)\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+107}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.1999999999999997e48 or 1.60000000000000015e107 < x Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/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--.f6488.2
Applied rewrites88.2%
if -4.1999999999999997e48 < x < 2.8000000000000001e-164Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6481.6
Applied rewrites81.6%
if 2.8000000000000001e-164 < x < 1.20000000000000005e-91Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6479.6
Applied rewrites79.6%
Taylor expanded in x around 0
Applied rewrites74.4%
if 1.20000000000000005e-91 < x < 1.60000000000000015e107Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6467.3
Applied rewrites67.3%
Final simplification81.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -1.36e+35)
t_1
(if (<= y 3.1e-24)
(fma z (- t) x)
(if (<= y 1.9e+57) (* (- y z) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -1.36e+35) {
tmp = t_1;
} else if (y <= 3.1e-24) {
tmp = fma(z, -t, x);
} else if (y <= 1.9e+57) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -1.36e+35) tmp = t_1; elseif (y <= 3.1e-24) tmp = fma(z, Float64(-t), x); elseif (y <= 1.9e+57) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.36e+35], t$95$1, If[LessEqual[y, 3.1e-24], N[(z * (-t) + x), $MachinePrecision], If[LessEqual[y, 1.9e+57], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -1.36 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(z, -t, x\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+57}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.36e35 or 1.8999999999999999e57 < y Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6480.1
Applied rewrites80.1%
if -1.36e35 < y < 3.1e-24Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6498.4
Applied rewrites98.4%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6492.9
Applied rewrites92.9%
Taylor expanded in x around 0
Applied rewrites71.6%
if 3.1e-24 < y < 1.8999999999999999e57Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6479.3
Applied rewrites79.3%
Final simplification75.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.45e+49)
(fma x z x)
(if (<= x 2.3e+107)
(* (- y z) t)
(if (<= x 6.2e+157) (* y (- t x)) (fma x z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e+49) {
tmp = fma(x, z, x);
} else if (x <= 2.3e+107) {
tmp = (y - z) * t;
} else if (x <= 6.2e+157) {
tmp = y * (t - x);
} else {
tmp = fma(x, z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -1.45e+49) tmp = fma(x, z, x); elseif (x <= 2.3e+107) tmp = Float64(Float64(y - z) * t); elseif (x <= 6.2e+157) tmp = Float64(y * Float64(t - x)); else tmp = fma(x, z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.45e+49], N[(x * z + x), $MachinePrecision], If[LessEqual[x, 2.3e+107], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[x, 6.2e+157], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+107}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+157}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\end{array}
\end{array}
if x < -1.45e49 or 6.1999999999999994e157 < x Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6493.8
Applied rewrites93.8%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6473.5
Applied rewrites73.5%
Taylor expanded in x around inf
Applied rewrites69.8%
if -1.45e49 < x < 2.3e107Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6471.2
Applied rewrites71.2%
if 2.3e107 < x < 6.1999999999999994e157Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6472.9
Applied rewrites72.9%
Final simplification70.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -1.32e+20) t_1 (if (<= z 2.2e+51) (fma y (- t x) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -1.32e+20) {
tmp = t_1;
} else if (z <= 2.2e+51) {
tmp = fma(y, (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -1.32e+20) tmp = t_1; elseif (z <= 2.2e+51) tmp = fma(y, Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.32e+20], t$95$1, If[LessEqual[z, 2.2e+51], N[(y * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -1.32 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.32e20 or 2.19999999999999992e51 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6485.6
Applied rewrites85.6%
if -1.32e20 < z < 2.19999999999999992e51Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6488.8
Applied rewrites88.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -1.32e+20) t_1 (if (<= z 2.2e+51) (* y (- t x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -1.32e+20) {
tmp = t_1;
} else if (z <= 2.2e+51) {
tmp = y * (t - x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x - t)
if (z <= (-1.32d+20)) then
tmp = t_1
else if (z <= 2.2d+51) then
tmp = y * (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 t_1 = z * (x - t);
double tmp;
if (z <= -1.32e+20) {
tmp = t_1;
} else if (z <= 2.2e+51) {
tmp = y * (t - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -1.32e+20: tmp = t_1 elif z <= 2.2e+51: tmp = y * (t - x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -1.32e+20) tmp = t_1; elseif (z <= 2.2e+51) tmp = Float64(y * Float64(t - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -1.32e+20) tmp = t_1; elseif (z <= 2.2e+51) tmp = y * (t - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.32e+20], t$95$1, If[LessEqual[z, 2.2e+51], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -1.32 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+51}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.32e20 or 2.19999999999999992e51 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6485.6
Applied rewrites85.6%
if -1.32e20 < z < 2.19999999999999992e51Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6460.0
Applied rewrites60.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) t))) (if (<= t -9.5e-58) t_1 (if (<= t 1.12e-110) (fma x z x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -9.5e-58) {
tmp = t_1;
} else if (t <= 1.12e-110) {
tmp = fma(x, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -9.5e-58) tmp = t_1; elseif (t <= 1.12e-110) tmp = fma(x, z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -9.5e-58], t$95$1, If[LessEqual[t, 1.12e-110], N[(x * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -9.5 \cdot 10^{-58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-110}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.4999999999999994e-58 or 1.11999999999999998e-110 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6472.8
Applied rewrites72.8%
if -9.4999999999999994e-58 < t < 1.11999999999999998e-110Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6466.0
Applied rewrites66.0%
Taylor expanded in x around inf
Applied rewrites61.6%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (<= y -2.6e+118) (* y t) (if (<= y 1.22e-23) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.6e+118) {
tmp = y * t;
} else if (y <= 1.22e-23) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.6e+118) tmp = Float64(y * t); elseif (y <= 1.22e-23) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.6e+118], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.22e-23], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+118}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -2.60000000000000016e118 or 1.22000000000000007e-23 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6478.0
Applied rewrites78.0%
Taylor expanded in t around inf
Applied rewrites54.6%
if -2.60000000000000016e118 < y < 1.22000000000000007e-23Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6498.6
Applied rewrites98.6%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6487.2
Applied rewrites87.2%
Taylor expanded in x around inf
Applied rewrites53.3%
(FPCore (x y z t) :precision binary64 (if (<= z -750000000000.0) (* x z) (if (<= z 2.45e+51) (* y t) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -750000000000.0) {
tmp = x * z;
} else if (z <= 2.45e+51) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-750000000000.0d0)) then
tmp = x * z
else if (z <= 2.45d+51) then
tmp = y * t
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -750000000000.0) {
tmp = x * z;
} else if (z <= 2.45e+51) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -750000000000.0: tmp = x * z elif z <= 2.45e+51: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -750000000000.0) tmp = Float64(x * z); elseif (z <= 2.45e+51) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -750000000000.0) tmp = x * z; elseif (z <= 2.45e+51) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -750000000000.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.45e+51], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -750000000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+51}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -7.5e11 or 2.44999999999999992e51 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6484.3
Applied rewrites84.3%
Taylor expanded in x around inf
Applied rewrites44.9%
if -7.5e11 < z < 2.44999999999999992e51Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6488.6
Applied rewrites88.6%
Taylor expanded in t around inf
Applied rewrites42.5%
(FPCore (x y z t) :precision binary64 (* x z))
double code(double x, double y, double z, double t) {
return x * z;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * z
end function
public static double code(double x, double y, double z, double t) {
return x * z;
}
def code(x, y, z, t): return x * z
function code(x, y, z, t) return Float64(x * z) end
function tmp = code(x, y, z, t) tmp = x * z; end
code[x_, y_, z_, t_] := N[(x * z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot z
\end{array}
Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6448.1
Applied rewrites48.1%
Taylor expanded in x around inf
Applied rewrites23.7%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2024223
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))