
(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 11 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 (* (- t x) y)))
(if (<= y -2.15e+15)
t_1
(if (<= y -9.5e-121)
(* (- x t) z)
(if (<= y 5e+26) (fma (- t) z x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * y;
double tmp;
if (y <= -2.15e+15) {
tmp = t_1;
} else if (y <= -9.5e-121) {
tmp = (x - t) * z;
} else if (y <= 5e+26) {
tmp = fma(-t, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * y) tmp = 0.0 if (y <= -2.15e+15) tmp = t_1; elseif (y <= -9.5e-121) tmp = Float64(Float64(x - t) * z); elseif (y <= 5e+26) tmp = fma(Float64(-t), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.15e+15], t$95$1, If[LessEqual[y, -9.5e-121], N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, 5e+26], N[((-t) * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -2.15 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{-121}:\\
\;\;\;\;\left(x - t\right) \cdot z\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(-t, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.15e15 or 5.0000000000000001e26 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6479.5
Applied rewrites79.5%
if -2.15e15 < y < -9.4999999999999994e-121Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6479.2
Applied rewrites79.2%
Taylor expanded in z around inf
Applied rewrites70.3%
if -9.4999999999999994e-121 < y < 5.0000000000000001e26Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6494.9
Applied rewrites94.9%
Taylor expanded in x around 0
Applied rewrites77.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x t) z)))
(if (<= z -8.8e-29)
t_1
(if (<= z -4.3e-253)
(fma (- x) y x)
(if (<= z 1.3e-24) (* (- t x) y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -8.8e-29) {
tmp = t_1;
} else if (z <= -4.3e-253) {
tmp = fma(-x, y, x);
} else if (z <= 1.3e-24) {
tmp = (t - x) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) tmp = 0.0 if (z <= -8.8e-29) tmp = t_1; elseif (z <= -4.3e-253) tmp = fma(Float64(-x), y, x); elseif (z <= 1.3e-24) tmp = Float64(Float64(t - x) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -8.8e-29], t$95$1, If[LessEqual[z, -4.3e-253], N[((-x) * y + x), $MachinePrecision], If[LessEqual[z, 1.3e-24], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -8.8 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.3 \cdot 10^{-253}:\\
\;\;\;\;\mathsf{fma}\left(-x, y, x\right)\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-24}:\\
\;\;\;\;\left(t - x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.79999999999999961e-29 or 1.3e-24 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6483.1
Applied rewrites83.1%
Taylor expanded in z around inf
Applied rewrites81.4%
if -8.79999999999999961e-29 < z < -4.3000000000000002e-253Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6490.2
Applied rewrites90.2%
Taylor expanded in x around inf
Applied rewrites67.6%
if -4.3000000000000002e-253 < z < 1.3e-24Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6463.9
Applied rewrites63.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x t) z)))
(if (<= z -1.08e-29)
t_1
(if (<= z -4.3e-253) (fma x z x) (if (<= z 7e-32) (* t y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x - t) * z;
double tmp;
if (z <= -1.08e-29) {
tmp = t_1;
} else if (z <= -4.3e-253) {
tmp = fma(x, z, x);
} else if (z <= 7e-32) {
tmp = t * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x - t) * z) tmp = 0.0 if (z <= -1.08e-29) tmp = t_1; elseif (z <= -4.3e-253) tmp = fma(x, z, x); elseif (z <= 7e-32) tmp = Float64(t * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.08e-29], t$95$1, If[LessEqual[z, -4.3e-253], N[(x * z + x), $MachinePrecision], If[LessEqual[z, 7e-32], N[(t * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - t\right) \cdot z\\
\mathbf{if}\;z \leq -1.08 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.3 \cdot 10^{-253}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-32}:\\
\;\;\;\;t \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.07999999999999995e-29 or 6.9999999999999997e-32 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6482.7
Applied rewrites82.7%
Taylor expanded in z around inf
Applied rewrites80.4%
if -1.07999999999999995e-29 < z < -4.3000000000000002e-253Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6451.0
Applied rewrites51.0%
Taylor expanded in x around inf
Applied rewrites43.7%
if -4.3000000000000002e-253 < z < 6.9999999999999997e-32Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6464.3
Applied rewrites64.3%
Taylor expanded in x around 0
Applied rewrites47.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- x) y)))
(if (<= y -2.15e+15)
t_1
(if (<= y 3.1e+27) (fma x z x) (if (<= y 4.6e+72) t_1 (* t y))))))
double code(double x, double y, double z, double t) {
double t_1 = -x * y;
double tmp;
if (y <= -2.15e+15) {
tmp = t_1;
} else if (y <= 3.1e+27) {
tmp = fma(x, z, x);
} else if (y <= 4.6e+72) {
tmp = t_1;
} else {
tmp = t * y;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(-x) * y) tmp = 0.0 if (y <= -2.15e+15) tmp = t_1; elseif (y <= 3.1e+27) tmp = fma(x, z, x); elseif (y <= 4.6e+72) tmp = t_1; else tmp = Float64(t * y); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) * y), $MachinePrecision]}, If[LessEqual[y, -2.15e+15], t$95$1, If[LessEqual[y, 3.1e+27], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 4.6e+72], t$95$1, N[(t * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-x\right) \cdot y\\
\mathbf{if}\;y \leq -2.15 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+72}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot y\\
\end{array}
\end{array}
if y < -2.15e15 or 3.09999999999999996e27 < y < 4.6e72Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.2
Applied rewrites77.2%
Taylor expanded in x around inf
Applied rewrites46.4%
if -2.15e15 < y < 3.09999999999999996e27Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6492.4
Applied rewrites92.4%
Taylor expanded in x around inf
Applied rewrites58.8%
if 4.6e72 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.7
Applied rewrites82.7%
Taylor expanded in x around 0
Applied rewrites57.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-29) (not (<= z 1.3e-24))) (fma (- x t) z x) (fma (- t x) y x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-29) || !(z <= 1.3e-24)) {
tmp = fma((x - t), z, x);
} else {
tmp = fma((t - x), y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-29) || !(z <= 1.3e-24)) tmp = fma(Float64(x - t), z, x); else tmp = fma(Float64(t - x), y, x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e-29], N[Not[LessEqual[z, 1.3e-24]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-29} \lor \neg \left(z \leq 1.3 \cdot 10^{-24}\right):\\
\;\;\;\;\mathsf{fma}\left(x - t, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\end{array}
\end{array}
if z < -1.14999999999999996e-29 or 1.3e-24 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6483.1
Applied rewrites83.1%
if -1.14999999999999996e-29 < z < 1.3e-24Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6494.3
Applied rewrites94.3%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.8e-29) (not (<= z 9.8e-21))) (* (- x t) z) (fma (- t x) y x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e-29) || !(z <= 9.8e-21)) {
tmp = (x - t) * z;
} else {
tmp = fma((t - x), y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.8e-29) || !(z <= 9.8e-21)) tmp = Float64(Float64(x - t) * z); else tmp = fma(Float64(t - x), y, x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.8e-29], N[Not[LessEqual[z, 9.8e-21]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-29} \lor \neg \left(z \leq 9.8 \cdot 10^{-21}\right):\\
\;\;\;\;\left(x - t\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\end{array}
\end{array}
if z < -8.79999999999999961e-29 or 9.8000000000000003e-21 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6483.5
Applied rewrites83.5%
Taylor expanded in z around inf
Applied rewrites82.4%
if -8.79999999999999961e-29 < z < 9.8000000000000003e-21Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6493.6
Applied rewrites93.6%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-29) (not (<= z 1.3e-24))) (* (- x t) z) (* (- t x) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-29) || !(z <= 1.3e-24)) {
tmp = (x - t) * z;
} else {
tmp = (t - x) * y;
}
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 <= (-1.15d-29)) .or. (.not. (z <= 1.3d-24))) then
tmp = (x - t) * z
else
tmp = (t - x) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-29) || !(z <= 1.3e-24)) {
tmp = (x - t) * z;
} else {
tmp = (t - x) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e-29) or not (z <= 1.3e-24): tmp = (x - t) * z else: tmp = (t - x) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-29) || !(z <= 1.3e-24)) tmp = Float64(Float64(x - t) * z); else tmp = Float64(Float64(t - x) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e-29) || ~((z <= 1.3e-24))) tmp = (x - t) * z; else tmp = (t - x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e-29], N[Not[LessEqual[z, 1.3e-24]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-29} \lor \neg \left(z \leq 1.3 \cdot 10^{-24}\right):\\
\;\;\;\;\left(x - t\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot y\\
\end{array}
\end{array}
if z < -1.14999999999999996e-29 or 1.3e-24 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6483.1
Applied rewrites83.1%
Taylor expanded in z around inf
Applied rewrites81.4%
if -1.14999999999999996e-29 < z < 1.3e-24Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6458.0
Applied rewrites58.0%
Final simplification70.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.55e+44) (not (<= y 5.1e+20))) (* t y) (fma x z x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.55e+44) || !(y <= 5.1e+20)) {
tmp = t * y;
} else {
tmp = fma(x, z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.55e+44) || !(y <= 5.1e+20)) tmp = Float64(t * y); else tmp = fma(x, z, x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.55e+44], N[Not[LessEqual[y, 5.1e+20]], $MachinePrecision]], N[(t * y), $MachinePrecision], N[(x * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+44} \lor \neg \left(y \leq 5.1 \cdot 10^{+20}\right):\\
\;\;\;\;t \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\end{array}
\end{array}
if y < -1.54999999999999998e44 or 5.1e20 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6478.6
Applied rewrites78.6%
Taylor expanded in x around 0
Applied rewrites46.5%
if -1.54999999999999998e44 < y < 5.1e20Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6490.2
Applied rewrites90.2%
Taylor expanded in x around inf
Applied rewrites58.4%
Final simplification53.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.2e+19) (not (<= z 2.8e-30))) (* z x) (* t y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.2e+19) || !(z <= 2.8e-30)) {
tmp = z * x;
} else {
tmp = t * y;
}
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 <= (-8.2d+19)) .or. (.not. (z <= 2.8d-30))) then
tmp = z * x
else
tmp = t * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.2e+19) || !(z <= 2.8e-30)) {
tmp = z * x;
} else {
tmp = t * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.2e+19) or not (z <= 2.8e-30): tmp = z * x else: tmp = t * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.2e+19) || !(z <= 2.8e-30)) tmp = Float64(z * x); else tmp = Float64(t * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.2e+19) || ~((z <= 2.8e-30))) tmp = z * x; else tmp = t * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.2e+19], N[Not[LessEqual[z, 2.8e-30]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(t * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+19} \lor \neg \left(z \leq 2.8 \cdot 10^{-30}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t \cdot y\\
\end{array}
\end{array}
if z < -8.2e19 or 2.79999999999999988e-30 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
*-lft-identityN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-out--N/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-out--N/A
*-lft-identityN/A
*-lft-identityN/A
lower--.f6483.7
Applied rewrites83.7%
Taylor expanded in z around inf
Applied rewrites82.3%
Taylor expanded in x around inf
Applied rewrites42.7%
if -8.2e19 < z < 2.79999999999999988e-30Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6456.5
Applied rewrites56.5%
Taylor expanded in x around 0
Applied rewrites37.8%
Final simplification40.2%
(FPCore (x y z t) :precision binary64 (* t y))
double code(double x, double y, double z, double t) {
return t * y;
}
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 = t * y
end function
public static double code(double x, double y, double z, double t) {
return t * y;
}
def code(x, y, z, t): return t * y
function code(x, y, z, t) return Float64(t * y) end
function tmp = code(x, y, z, t) tmp = t * y; end
code[x_, y_, z_, t_] := N[(t * y), $MachinePrecision]
\begin{array}{l}
\\
t \cdot y
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6440.7
Applied rewrites40.7%
Taylor expanded in x around 0
Applied rewrites24.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 2024320
(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))))