File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed
lib/node_modules/@stdlib/math/base/assert/is-probabilityf Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -59,19 +59,13 @@ bool = isProbabilityf( NaN );
59
59
var uniform = require ( ' @stdlib/random/array/uniform' );
60
60
var isProbabilityf = require ( ' @stdlib/math/base/assert/is-probabilityf' );
61
61
62
- var bool;
63
- var opts;
64
- var x;
65
- var i;
66
-
67
- opts = {
62
+ var x = uniform ( 100 , - 1.0 , 1.0 , {
68
63
' dtype' : ' float32'
69
- };
70
- x = uniform ( 100 , - 1.0 , 1.0 , opts );
64
+ });
71
65
66
+ var i;
72
67
for ( i = 0 ; i < 100 ; i++ ) {
73
- bool = isProbabilityf ( x[ i ] );
74
- console .log ( ' %d is %s' , x[ i ], ( bool ) ? ' a probability' : ' not a probability' );
68
+ console .log ( ' %d is %s' , x[ i ], ( isProbabilityf ( x[ i ] ) ) ? ' a probability' : ' not a probability' );
75
69
}
76
70
```
77
71
@@ -110,6 +104,8 @@ for ( i = 0; i < 100; i++ ) {
110
104
Tests if a single-precision floating-point number is a probability.
111
105
112
106
``` c
107
+ #include < stdbool.h>
108
+
113
109
bool out = stdlib_base_is_probabilityf( 0 .5f );
114
110
// returns true
115
111
Original file line number Diff line number Diff line change 21
21
var uniform = require ( '@stdlib/random/array/uniform' ) ;
22
22
var isProbabilityf = require ( './../lib' ) ;
23
23
24
- var bool ;
25
- var opts ;
26
- var x ;
27
- var i ;
28
-
29
- opts = {
24
+ var x = uniform ( 100 , - 1.0 , 1.0 , {
30
25
'dtype' : 'float32'
31
- } ;
32
- x = uniform ( 100 , - 1.0 , 1.0 , opts ) ;
26
+ } ) ;
33
27
28
+ var i ;
34
29
for ( i = 0 ; i < 100 ; i ++ ) {
35
- bool = isProbabilityf ( x [ i ] ) ;
36
- console . log ( '%d is %s' , x [ i ] , ( bool ) ? 'a probability' : 'not a probability' ) ;
30
+ console . log ( '%d is %s' , x [ i ] , ( isProbabilityf ( x [ i ] ) ) ? 'a probability' : 'not a probability' ) ;
37
31
}
You can’t perform that action at this time.
0 commit comments