
(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 (* z (- x t))))
(if (<= z -2.65e+80)
t_1
(if (<= z -3.45e-305)
(* y (- t x))
(if (<= z 2.8e-14)
(fma y (- x) x)
(if (<= z 4.3e+50) (* (- y z) t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -2.65e+80) {
tmp = t_1;
} else if (z <= -3.45e-305) {
tmp = y * (t - x);
} else if (z <= 2.8e-14) {
tmp = fma(y, -x, x);
} else if (z <= 4.3e+50) {
tmp = (y - z) * t;
} 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.65e+80) tmp = t_1; elseif (z <= -3.45e-305) tmp = Float64(y * Float64(t - x)); elseif (z <= 2.8e-14) tmp = fma(y, Float64(-x), x); elseif (z <= 4.3e+50) tmp = Float64(Float64(y - z) * t); 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.65e+80], t$95$1, If[LessEqual[z, -3.45e-305], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.8e-14], N[(y * (-x) + x), $MachinePrecision], If[LessEqual[z, 4.3e+50], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -2.65 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.45 \cdot 10^{-305}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(y, -x, x\right)\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+50}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.64999999999999982e80 or 4.2999999999999997e50 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6486.0
Simplified86.0%
if -2.64999999999999982e80 < z < -3.4499999999999999e-305Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6470.4
Simplified70.4%
if -3.4499999999999999e-305 < z < 2.8000000000000001e-14Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6495.5
Simplified95.5%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6474.4
Simplified74.4%
if 2.8000000000000001e-14 < z < 4.2999999999999997e50Initial program 99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6473.0
Simplified73.0%
Final simplification77.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -3.6e+68)
t_1
(if (<= y -8.4e-42) (* (- y z) t) (if (<= y 4.6e-23) (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 <= -3.6e+68) {
tmp = t_1;
} else if (y <= -8.4e-42) {
tmp = (y - z) * t;
} else if (y <= 4.6e-23) {
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 <= -3.6e+68) tmp = t_1; elseif (y <= -8.4e-42) tmp = Float64(Float64(y - z) * t); elseif (y <= 4.6e-23) 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, -3.6e+68], t$95$1, If[LessEqual[y, -8.4e-42], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 4.6e-23], 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 -3.6 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -8.4 \cdot 10^{-42}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.5999999999999999e68 or 4.6000000000000002e-23 < y Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6482.8
Simplified82.8%
if -3.5999999999999999e68 < y < -8.40000000000000025e-42Initial program 99.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6476.0
Simplified76.0%
if -8.40000000000000025e-42 < y < 4.6000000000000002e-23Initial 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--.f6488.7
Simplified88.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6460.9
Simplified60.9%
Final simplification72.6%
(FPCore (x y z t) :precision binary64 (if (<= x -2.75e-8) (fma x z x) (if (<= x -1.85e-241) (* y t) (if (<= x 2.3e-12) (- (* z t)) (fma x z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.75e-8) {
tmp = fma(x, z, x);
} else if (x <= -1.85e-241) {
tmp = y * t;
} else if (x <= 2.3e-12) {
tmp = -(z * t);
} else {
tmp = fma(x, z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -2.75e-8) tmp = fma(x, z, x); elseif (x <= -1.85e-241) tmp = Float64(y * t); elseif (x <= 2.3e-12) tmp = Float64(-Float64(z * t)); else tmp = fma(x, z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.75e-8], N[(x * z + x), $MachinePrecision], If[LessEqual[x, -1.85e-241], N[(y * t), $MachinePrecision], If[LessEqual[x, 2.3e-12], (-N[(z * t), $MachinePrecision]), N[(x * z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.75 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-241}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-12}:\\
\;\;\;\;-z \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\end{array}
\end{array}
if x < -2.7500000000000001e-8 or 2.29999999999999989e-12 < x Initial 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--.f6459.5
Simplified59.5%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6455.0
Simplified55.0%
if -2.7500000000000001e-8 < x < -1.8499999999999999e-241Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6473.7
Simplified73.7%
Taylor expanded in y around inf
lower-*.f6455.6
Simplified55.6%
if -1.8499999999999999e-241 < x < 2.29999999999999989e-12Initial 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--.f6455.4
Simplified55.4%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6454.1
Simplified54.1%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.5e+48) (* y t) (if (<= y 3.7) (fma x z x) (if (<= y 1.25e+182) (* x (- y)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.5e+48) {
tmp = y * t;
} else if (y <= 3.7) {
tmp = fma(x, z, x);
} else if (y <= 1.25e+182) {
tmp = x * -y;
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.5e+48) tmp = Float64(y * t); elseif (y <= 3.7) tmp = fma(x, z, x); elseif (y <= 1.25e+182) tmp = Float64(x * Float64(-y)); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.5e+48], N[(y * t), $MachinePrecision], If[LessEqual[y, 3.7], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 1.25e+182], N[(x * (-y)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+48}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 3.7:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+182}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.5e48 or 1.24999999999999993e182 < y Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6463.3
Simplified63.3%
Taylor expanded in y around inf
lower-*.f6457.5
Simplified57.5%
if -1.5e48 < y < 3.7000000000000002Initial 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--.f6486.5
Simplified86.5%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6457.3
Simplified57.3%
if 3.7000000000000002 < y < 1.24999999999999993e182Initial program 99.9%
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied egg-rr100.0%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6485.8
Simplified85.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6441.6
Simplified41.6%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -2.65e+80) t_1 (if (<= z 1.05e+86) (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.65e+80) {
tmp = t_1;
} else if (z <= 1.05e+86) {
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.65e+80) tmp = t_1; elseif (z <= 1.05e+86) 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.65e+80], t$95$1, If[LessEqual[z, 1.05e+86], 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.65 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.64999999999999982e80 or 1.0499999999999999e86 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6489.1
Simplified89.1%
if -2.64999999999999982e80 < z < 1.0499999999999999e86Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6484.3
Simplified84.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (- t x)))) (if (<= y -4.8e+48) t_1 (if (<= y 3.5e+41) (* 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 <= -4.8e+48) {
tmp = t_1;
} else if (y <= 3.5e+41) {
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 <= (-4.8d+48)) then
tmp = t_1
else if (y <= 3.5d+41) 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 <= -4.8e+48) {
tmp = t_1;
} else if (y <= 3.5e+41) {
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 <= -4.8e+48: tmp = t_1 elif y <= 3.5e+41: 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 <= -4.8e+48) tmp = t_1; elseif (y <= 3.5e+41) 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 <= -4.8e+48) tmp = t_1; elseif (y <= 3.5e+41) 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, -4.8e+48], t$95$1, If[LessEqual[y, 3.5e+41], 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 -4.8 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+41}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.8000000000000002e48 or 3.4999999999999999e41 < y Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6488.2
Simplified88.2%
if -4.8000000000000002e48 < y < 3.4999999999999999e41Initial 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--.f6460.9
Simplified60.9%
(FPCore (x y z t) :precision binary64 (if (<= x -3.8e-8) (fma x z x) (if (<= x 1.15e+86) (* (- y z) t) (fma x z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e-8) {
tmp = fma(x, z, x);
} else if (x <= 1.15e+86) {
tmp = (y - z) * t;
} else {
tmp = fma(x, z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -3.8e-8) tmp = fma(x, z, x); elseif (x <= 1.15e+86) tmp = Float64(Float64(y - z) * t); else tmp = fma(x, z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e-8], N[(x * z + x), $MachinePrecision], If[LessEqual[x, 1.15e+86], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+86}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\end{array}
\end{array}
if x < -3.80000000000000028e-8 or 1.14999999999999995e86 < x Initial 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--.f6461.3
Simplified61.3%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6458.5
Simplified58.5%
if -3.80000000000000028e-8 < x < 1.14999999999999995e86Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6474.9
Simplified74.9%
Final simplification68.0%
(FPCore (x y z t) :precision binary64 (if (<= y -1.5e+48) (* y t) (if (<= y 4e+41) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.5e+48) {
tmp = y * t;
} else if (y <= 4e+41) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.5e+48) tmp = Float64(y * t); elseif (y <= 4e+41) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.5e+48], N[(y * t), $MachinePrecision], If[LessEqual[y, 4e+41], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+48}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.5e48 or 4.00000000000000002e41 < y Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6458.3
Simplified58.3%
Taylor expanded in y around inf
lower-*.f6449.7
Simplified49.7%
if -1.5e48 < y < 4.00000000000000002e41Initial 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--.f6483.4
Simplified83.4%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6454.6
Simplified54.6%
Final simplification52.4%
(FPCore (x y z t) :precision binary64 (if (<= z -2.2e+80) (* x z) (if (<= z 4.5e+50) (* y t) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.2e+80) {
tmp = x * z;
} else if (z <= 4.5e+50) {
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 <= (-2.2d+80)) then
tmp = x * z
else if (z <= 4.5d+50) 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 <= -2.2e+80) {
tmp = x * z;
} else if (z <= 4.5e+50) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.2e+80: tmp = x * z elif z <= 4.5e+50: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.2e+80) tmp = Float64(x * z); elseif (z <= 4.5e+50) 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 <= -2.2e+80) tmp = x * z; elseif (z <= 4.5e+50) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.2e+80], N[(x * z), $MachinePrecision], If[LessEqual[z, 4.5e+50], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+80}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+50}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -2.20000000000000003e80 or 4.50000000000000014e50 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6486.0
Simplified86.0%
Taylor expanded in x around inf
lower-*.f6448.6
Simplified48.6%
if -2.20000000000000003e80 < z < 4.50000000000000014e50Initial program 99.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6450.2
Simplified50.2%
Taylor expanded in y around inf
lower-*.f6437.5
Simplified37.5%
Final simplification41.7%
(FPCore (x y z t) :precision binary64 (* y t))
double code(double x, double y, double z, double t) {
return y * t;
}
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 = y * t
end function
public static double code(double x, double y, double z, double t) {
return y * t;
}
def code(x, y, z, t): return y * t
function code(x, y, z, t) return Float64(y * t) end
function tmp = code(x, y, z, t) tmp = y * t; end
code[x_, y_, z_, t_] := N[(y * t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot t
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6451.9
Simplified51.9%
Taylor expanded in y around inf
lower-*.f6430.3
Simplified30.3%
Final simplification30.3%
(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 2024208
(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))))