
(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 (* y (- t x))) (t_2 (* z (- x t))))
(if (<= y -5e+57)
t_1
(if (<= y -4.2e-105)
t_2
(if (<= y 1.45e-215) (fma z (- t) x) (if (<= y 1.16e+39) 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 <= -5e+57) {
tmp = t_1;
} else if (y <= -4.2e-105) {
tmp = t_2;
} else if (y <= 1.45e-215) {
tmp = fma(z, -t, x);
} else if (y <= 1.16e+39) {
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 <= -5e+57) tmp = t_1; elseif (y <= -4.2e-105) tmp = t_2; elseif (y <= 1.45e-215) tmp = fma(z, Float64(-t), x); elseif (y <= 1.16e+39) 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, -5e+57], t$95$1, If[LessEqual[y, -4.2e-105], t$95$2, If[LessEqual[y, 1.45e-215], N[(z * (-t) + x), $MachinePrecision], If[LessEqual[y, 1.16e+39], 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 -5 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{-105}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-215}:\\
\;\;\;\;\mathsf{fma}\left(z, -t, x\right)\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+39}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.99999999999999972e57 or 1.16000000000000003e39 < y Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6480.8
Simplified80.8%
if -4.99999999999999972e57 < y < -4.2e-105 or 1.45e-215 < y < 1.16000000000000003e39Initial 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--.f6474.3
Simplified74.3%
if -4.2e-105 < y < 1.45e-215Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6493.0
Simplified93.0%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6482.6
Simplified82.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -8.8e-60)
t_1
(if (<= t -2.5e-131)
(fma x z x)
(if (<= t -1.65e-298)
(* y (- t x))
(if (<= t 1.7e-32) (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 <= -8.8e-60) {
tmp = t_1;
} else if (t <= -2.5e-131) {
tmp = fma(x, z, x);
} else if (t <= -1.65e-298) {
tmp = y * (t - x);
} else if (t <= 1.7e-32) {
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 <= -8.8e-60) tmp = t_1; elseif (t <= -2.5e-131) tmp = fma(x, z, x); elseif (t <= -1.65e-298) tmp = Float64(y * Float64(t - x)); elseif (t <= 1.7e-32) 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, -8.8e-60], t$95$1, If[LessEqual[t, -2.5e-131], N[(x * z + x), $MachinePrecision], If[LessEqual[t, -1.65e-298], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.7e-32], 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 -8.8 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-131}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;t \leq -1.65 \cdot 10^{-298}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-32}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.7999999999999995e-60 or 1.69999999999999989e-32 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6479.2
Simplified79.2%
if -8.7999999999999995e-60 < t < -2.5000000000000002e-131 or -1.6500000000000001e-298 < t < 1.69999999999999989e-32Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6471.3
Simplified71.3%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6461.5
Simplified61.5%
if -2.5000000000000002e-131 < t < -1.6500000000000001e-298Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6462.2
Simplified62.2%
Final simplification72.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1050000000.0) (fma z (- x t) x) (if (<= z 3.6e+47) (fma y (- t x) x) (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1050000000.0) {
tmp = fma(z, (x - t), x);
} else if (z <= 3.6e+47) {
tmp = fma(y, (t - x), x);
} else {
tmp = z * (x - t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1050000000.0) tmp = fma(z, Float64(x - t), x); elseif (z <= 3.6e+47) tmp = fma(y, Float64(t - x), x); else tmp = Float64(z * Float64(x - t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1050000000.0], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.6e+47], N[(y * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1050000000:\\
\;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -1.05e9Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6485.4
Simplified85.4%
if -1.05e9 < z < 3.60000000000000008e47Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6487.9
Simplified87.9%
if 3.60000000000000008e47 < z Initial 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--.f6482.8
Simplified82.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -3.1e+108) t_1 (if (<= z 3.6e+47) (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 <= -3.1e+108) {
tmp = t_1;
} else if (z <= 3.6e+47) {
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 <= -3.1e+108) tmp = t_1; elseif (z <= 3.6e+47) 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, -3.1e+108], t$95$1, If[LessEqual[z, 3.6e+47], 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 -3.1 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1000000000000001e108 or 3.60000000000000008e47 < z Initial 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--.f6487.9
Simplified87.9%
if -3.1000000000000001e108 < z < 3.60000000000000008e47Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6484.4
Simplified84.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) t))) (if (<= t -440000.0) t_1 (if (<= t 2.8e-16) (fma x (- z y) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -440000.0) {
tmp = t_1;
} else if (t <= 2.8e-16) {
tmp = fma(x, (z - y), 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 <= -440000.0) tmp = t_1; elseif (t <= 2.8e-16) tmp = fma(x, Float64(z - y), 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, -440000.0], t$95$1, If[LessEqual[t, 2.8e-16], N[(x * N[(z - y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -440000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(x, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.4e5 or 2.8000000000000001e-16 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6484.1
Simplified84.1%
if -4.4e5 < t < 2.8000000000000001e-16Initial program 99.9%
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--.f6475.4
Simplified75.4%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -3.1e+108) t_1 (if (<= z 3.6e+47) (* 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 <= -3.1e+108) {
tmp = t_1;
} else if (z <= 3.6e+47) {
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 <= (-3.1d+108)) then
tmp = t_1
else if (z <= 3.6d+47) 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 <= -3.1e+108) {
tmp = t_1;
} else if (z <= 3.6e+47) {
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 <= -3.1e+108: tmp = t_1 elif z <= 3.6e+47: 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 <= -3.1e+108) tmp = t_1; elseif (z <= 3.6e+47) 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 <= -3.1e+108) tmp = t_1; elseif (z <= 3.6e+47) 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, -3.1e+108], t$95$1, If[LessEqual[z, 3.6e+47], 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 -3.1 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+47}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1000000000000001e108 or 3.60000000000000008e47 < z Initial 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--.f6487.9
Simplified87.9%
if -3.1000000000000001e108 < z < 3.60000000000000008e47Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6463.8
Simplified63.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) t))) (if (<= t -8.8e-60) t_1 (if (<= t 1.7e-32) (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 <= -8.8e-60) {
tmp = t_1;
} else if (t <= 1.7e-32) {
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 <= -8.8e-60) tmp = t_1; elseif (t <= 1.7e-32) 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, -8.8e-60], t$95$1, If[LessEqual[t, 1.7e-32], 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 -8.8 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-32}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.7999999999999995e-60 or 1.69999999999999989e-32 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6479.2
Simplified79.2%
if -8.7999999999999995e-60 < t < 1.69999999999999989e-32Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6463.1
Simplified63.1%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6454.0
Simplified54.0%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (<= t -9e-59) (* z (- t)) (if (<= t 6.2e-16) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e-59) {
tmp = z * -t;
} else if (t <= 6.2e-16) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -9e-59) tmp = Float64(z * Float64(-t)); elseif (t <= 6.2e-16) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -9e-59], N[(z * (-t)), $MachinePrecision], If[LessEqual[t, 6.2e-16], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-59}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -9.00000000000000023e-59Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6478.5
Simplified78.5%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6448.4
Simplified48.4%
if -9.00000000000000023e-59 < t < 6.2000000000000002e-16Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6463.3
Simplified63.3%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6453.0
Simplified53.0%
if 6.2000000000000002e-16 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6482.2
Simplified82.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6442.1
Simplified42.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1.12e+55) (* y t) (if (<= y 3.3e+34) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.12e+55) {
tmp = y * t;
} else if (y <= 3.3e+34) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.12e+55) tmp = Float64(y * t); elseif (y <= 3.3e+34) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.12e+55], N[(y * t), $MachinePrecision], If[LessEqual[y, 3.3e+34], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{+55}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.12000000000000006e55 or 3.29999999999999988e34 < y Initial program 99.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6457.0
Simplified57.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6446.9
Simplified46.9%
if -1.12000000000000006e55 < y < 3.29999999999999988e34Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6487.7
Simplified87.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6445.7
Simplified45.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.6e+108) (* x z) (if (<= z 2.55e+48) (* y t) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e+108) {
tmp = x * z;
} else if (z <= 2.55e+48) {
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.6d+108)) then
tmp = x * z
else if (z <= 2.55d+48) 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.6e+108) {
tmp = x * z;
} else if (z <= 2.55e+48) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.6e+108: tmp = x * z elif z <= 2.55e+48: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e+108) tmp = Float64(x * z); elseif (z <= 2.55e+48) 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.6e+108) tmp = x * z; elseif (z <= 2.55e+48) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e+108], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.55e+48], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+108}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+48}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.6e108 or 2.5499999999999999e48 < z Initial 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--.f6487.0
Simplified87.0%
Taylor expanded in x around inf
lower-*.f6441.4
Simplified41.4%
if -1.6e108 < z < 2.5499999999999999e48Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6453.4
Simplified53.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6439.8
Simplified39.8%
(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.8
Simplified48.8%
Taylor expanded in x around inf
lower-*.f6421.4
Simplified21.4%
(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 2024212
(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))))