
(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 13 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 (* y (- t x))) (t_2 (* z (- x t))))
(if (<= y -260000000.0)
t_1
(if (<= y -1.9e-146)
t_2
(if (<= y 2.4e-153) (fma z (- t) x) (if (<= y 1.4e+19) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * (x - t);
double tmp;
if (y <= -260000000.0) {
tmp = t_1;
} else if (y <= -1.9e-146) {
tmp = t_2;
} else if (y <= 2.4e-153) {
tmp = fma(z, -t, x);
} else if (y <= 1.4e+19) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(z * Float64(x - t)) tmp = 0.0 if (y <= -260000000.0) tmp = t_1; elseif (y <= -1.9e-146) tmp = t_2; elseif (y <= 2.4e-153) tmp = fma(z, Float64(-t), x); elseif (y <= 1.4e+19) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -260000000.0], t$95$1, If[LessEqual[y, -1.9e-146], t$95$2, If[LessEqual[y, 2.4e-153], N[(z * (-t) + x), $MachinePrecision], If[LessEqual[y, 1.4e+19], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := z \cdot \left(x - t\right)\\
\mathbf{if}\;y \leq -260000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-146}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-153}:\\
\;\;\;\;\mathsf{fma}\left(z, -t, x\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+19}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.6e8 or 1.4e19 < y Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6485.8
Simplified85.8%
if -2.6e8 < y < -1.89999999999999997e-146 or 2.4000000000000002e-153 < y < 1.4e19Initial program 99.9%
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--.f6471.5
Simplified71.5%
if -1.89999999999999997e-146 < y < 2.4000000000000002e-153Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/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--.f6497.1
Simplified97.1%
Taylor expanded in x around 0
mul-1-negN/A
neg-lowering-neg.f6479.7
Simplified79.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (* (- y z) t)))
(if (<= y -7.2e+47)
t_1
(if (<= y -4.6e-258)
t_2
(if (<= y 1.95e-28) (fma z x x) (if (<= y 1.6e+19) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = (y - z) * t;
double tmp;
if (y <= -7.2e+47) {
tmp = t_1;
} else if (y <= -4.6e-258) {
tmp = t_2;
} else if (y <= 1.95e-28) {
tmp = fma(z, x, x);
} else if (y <= 1.6e+19) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(Float64(y - z) * t) tmp = 0.0 if (y <= -7.2e+47) tmp = t_1; elseif (y <= -4.6e-258) tmp = t_2; elseif (y <= 1.95e-28) tmp = fma(z, x, x); elseif (y <= 1.6e+19) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -7.2e+47], t$95$1, If[LessEqual[y, -4.6e-258], t$95$2, If[LessEqual[y, 1.95e-28], N[(z * x + x), $MachinePrecision], If[LessEqual[y, 1.6e+19], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := \left(y - z\right) \cdot t\\
\mathbf{if}\;y \leq -7.2 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.6 \cdot 10^{-258}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+19}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.20000000000000015e47 or 1.6e19 < y Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6487.3
Simplified87.3%
if -7.20000000000000015e47 < y < -4.59999999999999986e-258 or 1.94999999999999999e-28 < y < 1.6e19Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6464.2
Simplified64.2%
if -4.59999999999999986e-258 < y < 1.94999999999999999e-28Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/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--.f6493.7
Simplified93.7%
Taylor expanded in x around inf
Simplified64.4%
Final simplification75.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -6.5e-21)
t_1
(if (<= t -2.5e-267) (* x (- y)) (if (<= t 5.5e-62) (fma z x x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -6.5e-21) {
tmp = t_1;
} else if (t <= -2.5e-267) {
tmp = x * -y;
} else if (t <= 5.5e-62) {
tmp = fma(z, x, 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 <= -6.5e-21) tmp = t_1; elseif (t <= -2.5e-267) tmp = Float64(x * Float64(-y)); elseif (t <= 5.5e-62) tmp = fma(z, x, 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, -6.5e-21], t$95$1, If[LessEqual[t, -2.5e-267], N[(x * (-y)), $MachinePrecision], If[LessEqual[t, 5.5e-62], N[(z * x + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-267}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-62}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.49999999999999987e-21 or 5.50000000000000022e-62 < t Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6478.1
Simplified78.1%
if -6.49999999999999987e-21 < t < -2.5e-267Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6459.6
Simplified59.6%
Taylor expanded in t around 0
mul-1-negN/A
neg-lowering-neg.f6448.7
Simplified48.7%
if -2.5e-267 < t < 5.50000000000000022e-62Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/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--.f6461.8
Simplified61.8%
Taylor expanded in x around inf
Simplified55.9%
Final simplification67.9%
(FPCore (x y z t) :precision binary64 (if (<= y -7.4e-12) (fma y (- t x) x) (if (<= y 2.2e+19) (fma z (- x t) x) (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.4e-12) {
tmp = fma(y, (t - x), x);
} else if (y <= 2.2e+19) {
tmp = fma(z, (x - t), x);
} else {
tmp = y * (t - x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -7.4e-12) tmp = fma(y, Float64(t - x), x); elseif (y <= 2.2e+19) tmp = fma(z, Float64(x - t), x); else tmp = Float64(y * Float64(t - x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.4e-12], N[(y * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 2.2e+19], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < -7.39999999999999997e-12Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6484.1
Simplified84.1%
if -7.39999999999999997e-12 < y < 2.2e19Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/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--.f6490.6
Simplified90.6%
if 2.2e19 < y Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6486.7
Simplified86.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -7800000000000.0) t_1 (if (<= z 9.5e+29) (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 <= -7800000000000.0) {
tmp = t_1;
} else if (z <= 9.5e+29) {
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 <= -7800000000000.0) tmp = t_1; elseif (z <= 9.5e+29) 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, -7800000000000.0], t$95$1, If[LessEqual[z, 9.5e+29], 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 -7800000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.8e12 or 9.5000000000000003e29 < 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--.f6479.6
Simplified79.6%
if -7.8e12 < z < 9.5000000000000003e29Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6489.3
Simplified89.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (- t x)))) (if (<= y -5200000000.0) t_1 (if (<= y 8.8e+19) (* z (- x t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -5200000000.0) {
tmp = t_1;
} else if (y <= 8.8e+19) {
tmp = z * (x - t);
} 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 = y * (t - x)
if (y <= (-5200000000.0d0)) then
tmp = t_1
else if (y <= 8.8d+19) then
tmp = z * (x - t)
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 = y * (t - x);
double tmp;
if (y <= -5200000000.0) {
tmp = t_1;
} else if (y <= 8.8e+19) {
tmp = z * (x - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -5200000000.0: tmp = t_1 elif y <= 8.8e+19: tmp = z * (x - 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 <= -5200000000.0) tmp = t_1; elseif (y <= 8.8e+19) tmp = Float64(z * Float64(x - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -5200000000.0) tmp = t_1; elseif (y <= 8.8e+19) tmp = z * (x - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5200000000.0], t$95$1, If[LessEqual[y, 8.8e+19], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -5200000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+19}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.2e9 or 8.8e19 < y Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6485.8
Simplified85.8%
if -5.2e9 < y < 8.8e19Initial 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--.f6467.0
Simplified67.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- t)))) (if (<= z -165000000000.0) t_1 (if (<= z 1e+30) (fma y t x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -165000000000.0) {
tmp = t_1;
} else if (z <= 1e+30) {
tmp = fma(y, t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -165000000000.0) tmp = t_1; elseif (z <= 1e+30) tmp = fma(y, t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -165000000000.0], t$95$1, If[LessEqual[z, 1e+30], N[(y * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -165000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.65e11 or 1e30 < z Initial program 100.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
--lowering--.f6459.2
Simplified59.2%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6447.0
Simplified47.0%
if -1.65e11 < z < 1e30Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6489.3
Simplified89.3%
Taylor expanded in t around inf
Simplified60.2%
(FPCore (x y z t) :precision binary64 (if (<= y -2.85e+45) (* x (- y)) (if (<= y 1.6e+47) (fma z x x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.85e+45) {
tmp = x * -y;
} else if (y <= 1.6e+47) {
tmp = fma(z, x, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.85e+45) tmp = Float64(x * Float64(-y)); elseif (y <= 1.6e+47) tmp = fma(z, x, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.85e+45], N[(x * (-y)), $MachinePrecision], If[LessEqual[y, 1.6e+47], N[(z * x + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+45}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -2.85000000000000013e45Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6488.3
Simplified88.3%
Taylor expanded in t around 0
mul-1-negN/A
neg-lowering-neg.f6454.8
Simplified54.8%
if -2.85000000000000013e45 < y < 1.6e47Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/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--.f6485.9
Simplified85.9%
Taylor expanded in x around inf
Simplified48.3%
if 1.6e47 < y Initial program 99.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6488.5
Simplified88.5%
Taylor expanded in t around inf
Simplified54.1%
Final simplification51.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.9e+57) (* x z) (if (<= z 1.1e+135) (fma y t x) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e+57) {
tmp = x * z;
} else if (z <= 1.1e+135) {
tmp = fma(y, t, x);
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.9e+57) tmp = Float64(x * z); elseif (z <= 1.1e+135) tmp = fma(y, t, x); else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.9e+57], N[(x * z), $MachinePrecision], If[LessEqual[z, 1.1e+135], N[(y * t + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+57}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.8999999999999999e57 or 1.1e135 < 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%
Taylor expanded in x around inf
Simplified46.7%
if -1.8999999999999999e57 < z < 1.1e135Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6479.4
Simplified79.4%
Taylor expanded in t around inf
Simplified53.1%
Final simplification50.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.95e+59) (* x z) (if (<= z 8.5e+134) (* y t) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.95e+59) {
tmp = x * z;
} else if (z <= 8.5e+134) {
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 <= (-1.95d+59)) then
tmp = x * z
else if (z <= 8.5d+134) 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 <= -1.95e+59) {
tmp = x * z;
} else if (z <= 8.5e+134) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.95e+59: tmp = x * z elif z <= 8.5e+134: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.95e+59) tmp = Float64(x * z); elseif (z <= 8.5e+134) 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 <= -1.95e+59) tmp = x * z; elseif (z <= 8.5e+134) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.95e+59], N[(x * z), $MachinePrecision], If[LessEqual[z, 8.5e+134], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+59}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+134}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.95000000000000011e59 or 8.50000000000000024e134 < 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%
Taylor expanded in x around inf
Simplified46.7%
if -1.95000000000000011e59 < z < 8.50000000000000024e134Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6461.3
Simplified61.3%
Taylor expanded in t around inf
Simplified35.1%
Final simplification39.2%
(FPCore (x y z t) :precision binary64 (if (<= y -5.8e-42) (* y t) (if (<= y 2.45e-6) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.8e-42) {
tmp = y * t;
} else if (y <= 2.45e-6) {
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 <= (-5.8d-42)) then
tmp = y * t
else if (y <= 2.45d-6) 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 <= -5.8e-42) {
tmp = y * t;
} else if (y <= 2.45e-6) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.8e-42: tmp = y * t elif y <= 2.45e-6: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.8e-42) tmp = Float64(y * t); elseif (y <= 2.45e-6) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.8e-42) tmp = y * t; elseif (y <= 2.45e-6) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.8e-42], N[(y * t), $MachinePrecision], If[LessEqual[y, 2.45e-6], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-42}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -5.8000000000000006e-42 or 2.44999999999999984e-6 < y Initial program 100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6479.7
Simplified79.7%
Taylor expanded in t around inf
Simplified44.2%
if -5.8000000000000006e-42 < y < 2.44999999999999984e-6Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6434.0
Simplified34.0%
Taylor expanded in y around 0
Simplified27.1%
(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--.f6460.1
Simplified60.1%
Taylor expanded in y around 0
Simplified13.8%
(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 2024198
(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))))