@@ -87,10 +87,43 @@ The namespace contains the following functions:
87
87
<!-- eslint no-undef: "error" -->
88
88
89
89
``` javascript
90
- var objectKeys = require ( ' @stdlib/utils/keys ' );
90
+ var Complex128 = require ( ' @stdlib/complex/float64 ' );
91
91
var ns = require ( ' @stdlib/math/base/ops' );
92
92
93
- console .log ( objectKeys ( ns ) );
93
+ // Operations for double-precision floating point numbers:
94
+ console .log ( ns .add ( 1.25 , 0.45 ) );
95
+ // => 1.7
96
+
97
+ console .log ( ns .sub ( 1.25 , 0.45 ) );
98
+ // => 0.8
99
+
100
+ // Operations for single-precision floating point numbers:
101
+ console .log ( ns .mulf ( 1.3 , 1.2 ) );
102
+ // => ~1.56
103
+
104
+ console .log ( ns .divf ( 1.2 , 0.4 ) );
105
+ // => 3.0
106
+
107
+ // Operations for complex numbers:
108
+ var z1 = new Complex128 ( 5.0 , 3.0 );
109
+ var z2 = new Complex128 ( - 2.0 , 1.0 );
110
+ console .log ( ns .cmul ( z1, z2 ) ); // { 're': -13.0, 'im': -1.0 }
111
+ // => <Complex128>
112
+
113
+ // Operations for signed 32-bit integers:
114
+ // 2^30 * -5 = -5368709120 => 32-bit integer overflow
115
+ console .log ( ns .imul ( 1073741824 | 0 , - 5 | 0 ) );
116
+ // => -1073741824
117
+
118
+ // Operations for unsigned 32-bit integers:
119
+ // 2^31 * 5 = 10737418240 => 32-bit integer overflow
120
+ console .log ( ns .umul ( 2147483648 >>> 0 , 5 >>> 0 ) );
121
+ // => 2147483648
122
+
123
+ // Operations for double word product:
124
+ // -(2^31) * 2^30 = -2305843009213694000 => 32-bit integer overflow
125
+ console .log ( ns .imuldw ( 0x80000000 | 0 , 0x40000000 | 0 ) );
126
+ // => [ -536870912, 0 ]
94
127
```
95
128
96
129
</section >
0 commit comments