
(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 14 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 (- x t))) (t_2 (* y (- t x))))
(if (<= z -1.66e+44)
t_1
(if (<= z -7e-58)
t_2
(if (<= z -7.8e-227)
(fma y (- x) x)
(if (<= z 1.35e-6) (fma y t x) (if (<= z 4.7e+61) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = y * (t - x);
double tmp;
if (z <= -1.66e+44) {
tmp = t_1;
} else if (z <= -7e-58) {
tmp = t_2;
} else if (z <= -7.8e-227) {
tmp = fma(y, -x, x);
} else if (z <= 1.35e-6) {
tmp = fma(y, t, x);
} else if (z <= 4.7e+61) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(y * Float64(t - x)) tmp = 0.0 if (z <= -1.66e+44) tmp = t_1; elseif (z <= -7e-58) tmp = t_2; elseif (z <= -7.8e-227) tmp = fma(y, Float64(-x), x); elseif (z <= 1.35e-6) tmp = fma(y, t, x); elseif (z <= 4.7e+61) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.66e+44], t$95$1, If[LessEqual[z, -7e-58], t$95$2, If[LessEqual[z, -7.8e-227], N[(y * (-x) + x), $MachinePrecision], If[LessEqual[z, 1.35e-6], N[(y * t + x), $MachinePrecision], If[LessEqual[z, 4.7e+61], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := y \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1.66 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-58}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-227}:\\
\;\;\;\;\mathsf{fma}\left(y, -x, x\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+61}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.65999999999999992e44 or 4.6999999999999998e61 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6485.3
Simplified85.3%
if -1.65999999999999992e44 < z < -6.9999999999999998e-58 or 1.34999999999999999e-6 < z < 4.6999999999999998e61Initial program 99.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6470.6
Simplified70.6%
if -6.9999999999999998e-58 < z < -7.7999999999999999e-227Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6490.6
Simplified90.6%
Taylor expanded in t around 0
mul-1-negN/A
neg-lowering-neg.f6479.0
Simplified79.0%
if -7.7999999999999999e-227 < z < 1.34999999999999999e-6Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6493.0
Simplified93.0%
Taylor expanded in t around inf
Simplified73.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -1.0)
t_1
(if (<= y -1.6e-56) (fma y t x) (if (<= y 1e+15) (fma x z x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -1.0) {
tmp = t_1;
} else if (y <= -1.6e-56) {
tmp = fma(y, t, x);
} else if (y <= 1e+15) {
tmp = fma(x, z, x);
} 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.0) tmp = t_1; elseif (y <= -1.6e-56) tmp = fma(y, t, x); elseif (y <= 1e+15) tmp = fma(x, z, x); 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.0], t$95$1, If[LessEqual[y, -1.6e-56], N[(y * t + x), $MachinePrecision], If[LessEqual[y, 1e+15], N[(x * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-56}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{elif}\;y \leq 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1 or 1e15 < y Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6484.6
Simplified84.6%
if -1 < y < -1.59999999999999993e-56Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6479.1
Simplified79.1%
Taylor expanded in t around inf
Simplified73.8%
if -1.59999999999999993e-56 < y < 1e15Initial program 100.0%
+-commutativeN/A
*-commutativeN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f64100.0
Applied egg-rr100.0%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f6472.3
Simplified72.3%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6463.2
Simplified63.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- z y))))
(if (<= x -5.4e+54)
t_1
(if (<= x 1e-160) (* (- y z) t) (if (<= x 7e-33) (fma y t x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z - y);
double tmp;
if (x <= -5.4e+54) {
tmp = t_1;
} else if (x <= 1e-160) {
tmp = (y - z) * t;
} else if (x <= 7e-33) {
tmp = fma(y, t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(z - y)) tmp = 0.0 if (x <= -5.4e+54) tmp = t_1; elseif (x <= 1e-160) tmp = Float64(Float64(y - z) * t); elseif (x <= 7e-33) tmp = fma(y, t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.4e+54], t$95$1, If[LessEqual[x, 1e-160], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[x, 7e-33], N[(y * t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z - y\right)\\
\mathbf{if}\;x \leq -5.4 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 10^{-160}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.40000000000000022e54 or 6.9999999999999997e-33 < x Initial program 100.0%
+-commutativeN/A
*-commutativeN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f6498.3
Applied egg-rr98.3%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f6492.5
Simplified92.5%
Taylor expanded in z around inf
*-lowering-*.f6470.7
Simplified70.7%
Taylor expanded in t around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-lft-inN/A
+-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6468.1
Simplified68.1%
if -5.40000000000000022e54 < x < 9.9999999999999999e-161Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6474.9
Simplified74.9%
if 9.9999999999999999e-161 < x < 6.9999999999999997e-33Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6480.2
Simplified80.2%
Taylor expanded in t around inf
Simplified65.4%
Final simplification70.6%
(FPCore (x y z t) :precision binary64 (if (<= z -3.8e-6) (fma x z x) (if (<= z 9e+93) (fma y t x) (if (<= z 4.8e+161) (* x z) (* z (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e-6) {
tmp = fma(x, z, x);
} else if (z <= 9e+93) {
tmp = fma(y, t, x);
} else if (z <= 4.8e+161) {
tmp = x * z;
} else {
tmp = z * -t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -3.8e-6) tmp = fma(x, z, x); elseif (z <= 9e+93) tmp = fma(y, t, x); elseif (z <= 4.8e+161) tmp = Float64(x * z); else tmp = Float64(z * Float64(-t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.8e-6], N[(x * z + x), $MachinePrecision], If[LessEqual[z, 9e+93], N[(y * t + x), $MachinePrecision], If[LessEqual[z, 4.8e+161], N[(x * z), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+161}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -3.8e-6Initial program 100.0%
+-commutativeN/A
*-commutativeN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f6496.3
Applied egg-rr96.3%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f6477.5
Simplified77.5%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6456.7
Simplified56.7%
if -3.8e-6 < z < 8.99999999999999981e93Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6488.4
Simplified88.4%
Taylor expanded in t around inf
Simplified62.3%
if 8.99999999999999981e93 < z < 4.7999999999999998e161Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6484.3
Simplified84.3%
Taylor expanded in x around inf
Simplified67.6%
if 4.7999999999999998e161 < z Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6468.8
Simplified68.8%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6462.2
Simplified62.2%
Final simplification61.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- y))))
(if (<= y -1.15e+232)
t_1
(if (<= y -3.5e-56) (fma y t x) (if (<= y 1.8e+23) (fma x z x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double tmp;
if (y <= -1.15e+232) {
tmp = t_1;
} else if (y <= -3.5e-56) {
tmp = fma(y, t, x);
} else if (y <= 1.8e+23) {
tmp = fma(x, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(-y)) tmp = 0.0 if (y <= -1.15e+232) tmp = t_1; elseif (y <= -3.5e-56) tmp = fma(y, t, x); elseif (y <= 1.8e+23) tmp = fma(x, z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, If[LessEqual[y, -1.15e+232], t$95$1, If[LessEqual[y, -3.5e-56], N[(y * t + x), $MachinePrecision], If[LessEqual[y, 1.8e+23], N[(x * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{+232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-56}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.15000000000000003e232 or 1.7999999999999999e23 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6485.4
Simplified85.4%
Taylor expanded in t around 0
mul-1-negN/A
neg-lowering-neg.f6457.4
Simplified57.4%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6457.4
Simplified57.4%
if -1.15000000000000003e232 < y < -3.4999999999999998e-56Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6482.5
Simplified82.5%
Taylor expanded in t around inf
Simplified62.1%
if -3.4999999999999998e-56 < y < 1.7999999999999999e23Initial program 100.0%
+-commutativeN/A
*-commutativeN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f64100.0
Applied egg-rr100.0%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f6472.5
Simplified72.5%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6462.7
Simplified62.7%
Final simplification61.1%
(FPCore (x y z t) :precision binary64 (if (<= z -55.0) (* x z) (if (<= z -1.55e-198) x (if (<= z 9e+93) (* y t) (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -55.0) {
tmp = x * z;
} else if (z <= -1.55e-198) {
tmp = x;
} else if (z <= 9e+93) {
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 <= (-55.0d0)) then
tmp = x * z
else if (z <= (-1.55d-198)) then
tmp = x
else if (z <= 9d+93) 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 <= -55.0) {
tmp = x * z;
} else if (z <= -1.55e-198) {
tmp = x;
} else if (z <= 9e+93) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -55.0: tmp = x * z elif z <= -1.55e-198: tmp = x elif z <= 9e+93: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -55.0) tmp = Float64(x * z); elseif (z <= -1.55e-198) tmp = x; elseif (z <= 9e+93) 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 <= -55.0) tmp = x * z; elseif (z <= -1.55e-198) tmp = x; elseif (z <= 9e+93) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -55.0], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.55e-198], x, If[LessEqual[z, 9e+93], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -55:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-198}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+93}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -55 or 8.99999999999999981e93 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6483.7
Simplified83.7%
Taylor expanded in x around inf
Simplified50.5%
if -55 < z < -1.5499999999999999e-198Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6486.2
Simplified86.2%
Taylor expanded in y around 0
Simplified37.4%
if -1.5499999999999999e-198 < z < 8.99999999999999981e93Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6450.2
Simplified50.2%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6441.6
Simplified41.6%
Final simplification44.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -2.6e+44) t_1 (if (<= z 7.6e+61) (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 <= -2.6e+44) {
tmp = t_1;
} else if (z <= 7.6e+61) {
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 <= -2.6e+44) tmp = t_1; elseif (z <= 7.6e+61) 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, -2.6e+44], t$95$1, If[LessEqual[z, 7.6e+61], 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 -2.6 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.5999999999999999e44 or 7.5999999999999999e61 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6485.3
Simplified85.3%
if -2.5999999999999999e44 < z < 7.5999999999999999e61Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6488.7
Simplified88.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma x (- z y) x))) (if (<= x -3.4e+52) t_1 (if (<= x 5.6e-183) (* (- y z) 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 <= -3.4e+52) {
tmp = t_1;
} else if (x <= 5.6e-183) {
tmp = (y - z) * 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 <= -3.4e+52) tmp = t_1; elseif (x <= 5.6e-183) tmp = Float64(Float64(y - z) * 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, -3.4e+52], t$95$1, If[LessEqual[x, 5.6e-183], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, z - y, x\right)\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-183}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.4e52 or 5.5999999999999997e-183 < x Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6480.2
Simplified80.2%
if -3.4e52 < x < 5.5999999999999997e-183Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6478.9
Simplified78.9%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2e+55) (fma x z x) (if (<= x 4.15e-35) (* (- y z) t) (fma x z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2e+55) {
tmp = fma(x, z, x);
} else if (x <= 4.15e-35) {
tmp = (y - z) * t;
} else {
tmp = fma(x, z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -2e+55) tmp = fma(x, z, x); elseif (x <= 4.15e-35) tmp = Float64(Float64(y - z) * t); else tmp = fma(x, z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -2e+55], N[(x * z + x), $MachinePrecision], If[LessEqual[x, 4.15e-35], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+55}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;x \leq 4.15 \cdot 10^{-35}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\end{array}
\end{array}
if x < -2.00000000000000002e55 or 4.1499999999999998e-35 < x Initial program 100.0%
+-commutativeN/A
*-commutativeN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f6498.3
Applied egg-rr98.3%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f6492.6
Simplified92.6%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6456.6
Simplified56.6%
if -2.00000000000000002e55 < x < 4.1499999999999998e-35Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6469.8
Simplified69.8%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1e-8) (fma x z x) (if (<= z 1.36e+94) (fma y t x) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e-8) {
tmp = fma(x, z, x);
} else if (z <= 1.36e+94) {
tmp = fma(y, t, x);
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1e-8) tmp = fma(x, z, x); elseif (z <= 1.36e+94) tmp = fma(y, t, x); else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1e-8], N[(x * z + x), $MachinePrecision], If[LessEqual[z, 1.36e+94], N[(y * t + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{+94}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1e-8Initial program 100.0%
+-commutativeN/A
*-commutativeN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f6496.3
Applied egg-rr96.3%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f6477.5
Simplified77.5%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6456.7
Simplified56.7%
if -1e-8 < z < 1.36e94Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6488.4
Simplified88.4%
Taylor expanded in t around inf
Simplified62.3%
if 1.36e94 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6487.2
Simplified87.2%
Taylor expanded in x around inf
Simplified43.3%
Final simplification57.7%
(FPCore (x y z t) :precision binary64 (if (<= y -1.6e-7) (* y t) (if (<= y 5.2e+53) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.6e-7) {
tmp = y * t;
} else if (y <= 5.2e+53) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.6e-7) tmp = Float64(y * t); elseif (y <= 5.2e+53) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.6e-7], N[(y * t), $MachinePrecision], If[LessEqual[y, 5.2e+53], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-7}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+53}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.6e-7 or 5.19999999999999996e53 < y Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6454.1
Simplified54.1%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6446.4
Simplified46.4%
if -1.6e-7 < y < 5.19999999999999996e53Initial program 100.0%
+-commutativeN/A
*-commutativeN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f64100.0
Applied egg-rr100.0%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f6473.7
Simplified73.7%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6458.6
Simplified58.6%
(FPCore (x y z t) :precision binary64 (if (<= y -7e-8) (* y t) (if (<= y 1.2e-27) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e-8) {
tmp = y * t;
} else if (y <= 1.2e-27) {
tmp = x;
} else {
tmp = y * t;
}
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 (y <= (-7d-8)) then
tmp = y * t
else if (y <= 1.2d-27) then
tmp = x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e-8) {
tmp = y * t;
} else if (y <= 1.2e-27) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7e-8: tmp = y * t elif y <= 1.2e-27: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7e-8) tmp = Float64(y * t); elseif (y <= 1.2e-27) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7e-8) tmp = y * t; elseif (y <= 1.2e-27) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7e-8], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.2e-27], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-8}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -7.00000000000000048e-8 or 1.20000000000000001e-27 < y Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6451.5
Simplified51.5%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6442.8
Simplified42.8%
if -7.00000000000000048e-8 < y < 1.20000000000000001e-27Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6444.2
Simplified44.2%
Taylor expanded in y around 0
Simplified35.7%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return 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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6464.2
Simplified64.2%
Taylor expanded in y around 0
Simplified18.5%
(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 2024205
(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))))