|
21 | 21 | /* tslint:disable:max-line-length */
|
22 | 22 | /* tslint:disable:max-file-line-count */
|
23 | 23 |
|
| 24 | +import add = require( '@stdlib/math/base/ops/add' ); |
| 25 | +import addf = require( '@stdlib/math/base/ops/addf' ); |
24 | 26 | import cadd = require( '@stdlib/math/base/ops/cadd' );
|
25 | 27 | import cdiv = require( '@stdlib/math/base/ops/cdiv' );
|
26 | 28 | import cmul = require( '@stdlib/math/base/ops/cmul' );
|
27 | 29 | import cneg = require( '@stdlib/math/base/ops/cneg' );
|
28 | 30 | import csub = require( '@stdlib/math/base/ops/csub' );
|
| 31 | +import imul = require( '@stdlib/math/base/ops/imul' ); |
| 32 | +import imuldw = require( '@stdlib/math/base/ops/imuldw' ); |
| 33 | +import mul = require( '@stdlib/math/base/ops/mul' ); |
| 34 | +import sub = require( '@stdlib/math/base/ops/sub' ); |
| 35 | +import subf = require( '@stdlib/math/base/ops/subf' ); |
| 36 | +import umul = require( '@stdlib/math/base/ops/umul' ); |
| 37 | +import umuldw = require( '@stdlib/math/base/ops/umuldw' ); |
29 | 38 |
|
30 | 39 | /**
|
31 | 40 | * Interface describing the `ops` namespace.
|
32 | 41 | */
|
33 | 42 | interface Namespace {
|
| 43 | + /** |
| 44 | + * Computes the sum of two double-precision floating-point numbers `x` and `y`. |
| 45 | + * |
| 46 | + * @param x - first input value |
| 47 | + * @param y - second input value |
| 48 | + * @returns sum |
| 49 | + * |
| 50 | + * @example |
| 51 | + * var v = ns.add( -1.0, 5.0 ); |
| 52 | + * // returns 4.0 |
| 53 | + * |
| 54 | + * @example |
| 55 | + * var v = ns.add( 2.0, 5.0 ); |
| 56 | + * // returns 7.0 |
| 57 | + * |
| 58 | + * @example |
| 59 | + * var v = ns.add( 0.0, 5.0 ); |
| 60 | + * // returns 5.0 |
| 61 | + * |
| 62 | + * @example |
| 63 | + * var v = ns.add( -0.0, 0.0 ); |
| 64 | + * // returns 0.0 |
| 65 | + * |
| 66 | + * @example |
| 67 | + * var v = ns.add( NaN, NaN ); |
| 68 | + * // returns NaN |
| 69 | + */ |
| 70 | + add: typeof add; |
| 71 | + |
| 72 | + /** |
| 73 | + * Computes the sum of two single-precision floating-point numbers `x` and `y`. |
| 74 | + * |
| 75 | + * @param x - first input value |
| 76 | + * @param y - second input value |
| 77 | + * @returns sum |
| 78 | + * |
| 79 | + * @example |
| 80 | + * var v = ns.addf( -1.0, 5.0 ); |
| 81 | + * // returns 4.0 |
| 82 | + * |
| 83 | + * @example |
| 84 | + * var v = ns.addf( 2.0, 5.0 ); |
| 85 | + * // returns 7.0 |
| 86 | + * |
| 87 | + * @example |
| 88 | + * var v = ns.addf( 0.0, 5.0 ); |
| 89 | + * // returns 5.0 |
| 90 | + * |
| 91 | + * @example |
| 92 | + * var v = ns.addf( -0.0, 0.0 ); |
| 93 | + * // returns 0.0 |
| 94 | + * |
| 95 | + * @example |
| 96 | + * var v = ns.addf( NaN, NaN ); |
| 97 | + * // returns NaN |
| 98 | + */ |
| 99 | + addf: typeof addf; |
| 100 | + |
34 | 101 | /**
|
35 | 102 | * Adds two complex numbers.
|
36 | 103 | *
|
@@ -111,6 +178,153 @@ interface Namespace {
|
111 | 178 | // returns [ 7.0, 2.0 ]
|
112 | 179 | */
|
113 | 180 | csub: typeof csub;
|
| 181 | + |
| 182 | + /** |
| 183 | + * Performs C-like multiplication of two signed 32-bit integers. |
| 184 | + * |
| 185 | + * @param a - signed 32-bit integer |
| 186 | + * @param b - signed 32-bit integer |
| 187 | + * @returns product |
| 188 | + * |
| 189 | + * @example |
| 190 | + * var v = ns.imul( -10|0, 4|0 ); |
| 191 | + * // returns -40 |
| 192 | + */ |
| 193 | + imul: typeof imul; |
| 194 | + |
| 195 | + /** |
| 196 | + * Performs multiplication of two signed 32-bit integers and returns an array of two signed 32-bit integers which represents the signed 64-bit integer product. |
| 197 | + * |
| 198 | + * ## Notes |
| 199 | + * |
| 200 | + * - When computing the product of 32-bit integer values in double-precision floating-point format (the default JavaScript numeric data type), computing the double word product is necessary in order to avoid exceeding the maximum safe double-precision floating-point integer value. |
| 201 | + * |
| 202 | + * @param a - integer |
| 203 | + * @param b - integer |
| 204 | + * @returns output array |
| 205 | + * |
| 206 | + * @example |
| 207 | + * var v = ns.imuldw( 0xAAAAAAAA, 0x55555555 ); |
| 208 | + * // returns [ -477218589, 1908874354 ] |
| 209 | + */ |
| 210 | + imuldw: typeof imuldw; |
| 211 | + |
| 212 | + /** |
| 213 | + * Multiplies two double-precision floating-point numbers `x` and `y`. |
| 214 | + * |
| 215 | + * @param x - first input value |
| 216 | + * @param y - second input value |
| 217 | + * @returns result |
| 218 | + * |
| 219 | + * @example |
| 220 | + * var v = ns.mul( -1.0, 5.0 ); |
| 221 | + * // returns -5.0 |
| 222 | + * |
| 223 | + * @example |
| 224 | + * var v = ns.mul( 2.0, 5.0 ); |
| 225 | + * // returns 10.0 |
| 226 | + * |
| 227 | + * @example |
| 228 | + * var v = ns.mul( 0.0, 5.0 ); |
| 229 | + * // returns 0.0 |
| 230 | + * |
| 231 | + * @example |
| 232 | + * var v = ns.mul( -0.0, 0.0 ); |
| 233 | + * // returns -0.0 |
| 234 | + * |
| 235 | + * @example |
| 236 | + * var v = ns.mul( NaN, NaN ); |
| 237 | + * // returns NaN |
| 238 | + */ |
| 239 | + mul: typeof mul; |
| 240 | + |
| 241 | + /** |
| 242 | + * Subtracts two double-precision floating-point numbers `x` and `y`. |
| 243 | + * |
| 244 | + * @param x - first input value |
| 245 | + * @param y - second input value |
| 246 | + * @returns result |
| 247 | + * |
| 248 | + * @example |
| 249 | + * var v = ns.sub( -1.0, 5.0 ); |
| 250 | + * // returns -6.0 |
| 251 | + * |
| 252 | + * @example |
| 253 | + * var v = ns.sub( 2.0, 5.0 ); |
| 254 | + * // returns -3.0 |
| 255 | + * |
| 256 | + * @example |
| 257 | + * var v = ns.sub( 0.0, 5.0 ); |
| 258 | + * // returns -5.0 |
| 259 | + * |
| 260 | + * @example |
| 261 | + * var v = ns.sub( -0.0, 0.0 ); |
| 262 | + * // returns -0.0 |
| 263 | + * |
| 264 | + * @example |
| 265 | + * var v = ns.sub( NaN, NaN ); |
| 266 | + * // returns NaN |
| 267 | + */ |
| 268 | + sub: typeof sub; |
| 269 | + |
| 270 | + /** |
| 271 | + * Subtracts two single-precision floating-point numbers `x` and `y`. |
| 272 | + * |
| 273 | + * @param x - first input value |
| 274 | + * @param y - second input value |
| 275 | + * @returns result |
| 276 | + * |
| 277 | + * @example |
| 278 | + * var v = ns.subf( -1.0, 5.0 ); |
| 279 | + * // returns -6.0 |
| 280 | + * |
| 281 | + * @example |
| 282 | + * var v = ns.subf( 2.0, 5.0 ); |
| 283 | + * // returns -3.0 |
| 284 | + * |
| 285 | + * @example |
| 286 | + * var v = ns.subf( 0.0, 5.0 ); |
| 287 | + * // returns -5.0 |
| 288 | + * |
| 289 | + * @example |
| 290 | + * var v = ns.subf( -0.0, 0.0 ); |
| 291 | + * // returns -0.0 |
| 292 | + * |
| 293 | + * @example |
| 294 | + * var v = ns.subf( NaN, NaN ); |
| 295 | + * // returns NaN |
| 296 | + */ |
| 297 | + subf: typeof subf; |
| 298 | + |
| 299 | + /** |
| 300 | + * Performs C-like multiplication of two unsigned 32-bit integers. |
| 301 | + * |
| 302 | + * @param a - unsigned 32-bit integer |
| 303 | + * @param b - Unsigned 32-bit integer |
| 304 | + * @returns product |
| 305 | + * |
| 306 | + * @example |
| 307 | + * var v = ns.umul( 10>>>0, 4>>>0 ); |
| 308 | + * // returns 40 |
| 309 | + */ |
| 310 | + umul: typeof umul; |
| 311 | + |
| 312 | + /** |
| 313 | + * Performs multiplication of two unsigned 32-bit integers and returns an array of two unsigned 32-bit integers which represents the unsigned 64-bit integer product. |
| 314 | + * |
| 315 | + * ## Notes |
| 316 | + * |
| 317 | + * - When computing the product of 32-bit integer values in double-precision floating-point format (the default JavaScript numeric data type), computing the double word product is necessary in order to avoid exceeding the maximum safe double-precision floating-point integer value. |
| 318 | + * |
| 319 | + * @param a - integer |
| 320 | + * @param b - integer |
| 321 | + * @returns double word product (in big endian order; i.e., the first element corresponds to the most significant bits and the second element to the least significant bits) |
| 322 | + * |
| 323 | + * @example |
| 324 | + * var v = ns.umuldw( 0xAAAAAAAA, 0x55555555 ); |
| 325 | + * // returns [ 954437176, 1908874354 ] |
| 326 | + */ |
| 327 | + umuldw: typeof umuldw; |
114 | 328 | }
|
115 | 329 |
|
116 | 330 | /**
|
|
0 commit comments