Socket
Socket
Sign inDemoInstall

@stdlib/math-base-assert-is-probability

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/math-base-assert-is-probability - npm Package Compare versions

Comparing version 0.0.7 to 0.1.0

CITATION.cff

6

docs/types/index.d.ts

@@ -19,10 +19,10 @@ /*

// TypeScript Version: 2.0
// TypeScript Version: 4.1
/**
* Tests if a numeric value is a probability.
* Tests if a double-precision floating-point number is a probability.
*
* ## Notes
*
* - A probability is defined as a numeric value on the closed interval `[0,1]`.
* - A probability is defined as a number on the closed interval `[0,1]`.
*

@@ -29,0 +29,0 @@ * @param x - value to test

@@ -22,3 +22,3 @@ /**

/**
* Test if a numeric value is a probability.
* Test if a double-precision floating-point number is a probability.
*

@@ -42,3 +42,3 @@ * @module @stdlib/math-base-assert-is-probability

var isProbability = require( './is_probability.js' );
var main = require( './main.js' );

@@ -48,2 +48,2 @@

module.exports = isProbability;
module.exports = main;
{
"name": "@stdlib/math-base-assert-is-probability",
"version": "0.0.7",
"description": "Test if a numeric value is a probability.",
"version": "0.1.0",
"description": "Test if a double-precision floating-point number is a probability.",
"license": "Apache-2.0",

@@ -21,3 +21,5 @@ "author": {

"example": "./examples",
"include": "./include",
"lib": "./lib",
"src": "./src",
"test": "./test"

@@ -40,12 +42,16 @@ },

},
"dependencies": {},
"dependencies": {
"@stdlib/utils-library-manifest": "^0.1.0"
},
"devDependencies": {
"@stdlib/assert-is-boolean": "^0.0.x",
"@stdlib/bench": "^0.0.x",
"@stdlib/constants-float64-ninf": "^0.0.x",
"@stdlib/constants-float64-pinf": "^0.0.x",
"@stdlib/random-base-randu": "^0.0.x",
"@stdlib/assert-is-boolean": "^0.1.0",
"@stdlib/bench": "^0.1.0",
"@stdlib/boolean-ctor": "^0.1.0",
"@stdlib/constants-float64-ninf": "^0.0.8",
"@stdlib/constants-float64-pinf": "^0.0.8",
"@stdlib/random-base-randu": "^0.0.8",
"@stdlib/utils-try-require": "^0.1.0",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
"istanbul": "^0.4.1",
"tap-spec": "5.x.x"
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
},

@@ -95,5 +101,5 @@ "engines": {

"funding": {
"type": "patreon",
"url": "https://www.patreon.com/athan"
"type": "opencollective",
"url": "https://opencollective.com/stdlib"
}
}

@@ -5,3 +5,3 @@ <!--

Copyright (c) 2018 The Stdlib Authors.
Copyright (c) 2022 The Stdlib Authors.

@@ -22,2 +22,13 @@ Licensed under the Apache License, Version 2.0 (the "License");

<details>
<summary>
About stdlib...
</summary>
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
</details>
# isProbability

@@ -27,3 +38,3 @@

> Test if a numeric value is a probability.
> Test if a double-precision floating-point number is a probability.

@@ -50,3 +61,3 @@ <section class="installation">

Tests if a `numeric` value is a probability.
Tests if a double-precision floating-point number is a probability.

@@ -93,2 +104,93 @@ ```javascript

<!-- C interface documentation. -->
* * *
<section class="c">
## C APIs
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
<section class="intro">
</section>
<!-- /.intro -->
<!-- C usage documentation. -->
<section class="usage">
### Usage
```c
#include "stdlib/math/base/assert/is_probability.h"
```
#### stdlib_base_is_probability( x )
Tests if a double-precision floating-point number is a probability.
```c
bool out = stdlib_base_is_probability( 0.5 );
// returns true
out = stdlib_base_is_probability( 3.14 );
// returns false
```
The function accepts the following arguments:
- **x**: `[in] double` input value.
```c
bool stdlib_base_is_probability( const double x );
```
</section>
<!-- /.usage -->
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="notes">
</section>
<!-- /.notes -->
<!-- C API usage examples. -->
<section class="examples">
### Examples
```c
#include "stdlib/math/base/assert/is_probability.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int main( void ) {
double x;
bool v;
int i;
for ( i = 0; i < 100; i++ ) {
x = ( ( (double)rand() / (double)RAND_MAX ) * 2.0 ) - 1.0;
v = stdlib_base_is_probability( x );
printf( "%lf is %sa probability\n", x, ( v ) ? "" : "not " );
}
}
```
</section>
<!-- /.examples -->
</section>
<!-- /.c -->
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

@@ -128,3 +230,3 @@

Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].

@@ -142,4 +244,4 @@ </section>

[test-image]: https://github.com/stdlib-js/math-base-assert-is-probability/actions/workflows/test.yml/badge.svg
[test-url]: https://github.com/stdlib-js/math-base-assert-is-probability/actions/workflows/test.yml
[test-image]: https://github.com/stdlib-js/math-base-assert-is-probability/actions/workflows/test.yml/badge.svg?branch=v0.1.0
[test-url]: https://github.com/stdlib-js/math-base-assert-is-probability/actions/workflows/test.yml?query=branch:v0.1.0

@@ -156,2 +258,9 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-assert-is-probability/main.svg

[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
[stdlib]: https://github.com/stdlib-js/stdlib
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
[umd]: https://github.com/umdjs/umd

@@ -163,10 +272,4 @@ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

[esm-url]: https://github.com/stdlib-js/math-base-assert-is-probability/tree/esm
[branches-url]: https://github.com/stdlib-js/math-base-assert-is-probability/blob/main/branches.md
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://gitter.im/stdlib-js/stdlib/
[stdlib]: https://github.com/stdlib-js/stdlib
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/math-base-assert-is-probability/main/LICENSE

@@ -173,0 +276,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc