@stdlib/number-float64-base-sub3
v0.1.1
Published
Compute the difference of three double-precision floating-point numbers.
Downloads
20
Readme
sub3
Compute the difference of three double-precision floating-point numbers.
Installation
npm install @stdlib/number-float64-base-sub3Usage
var sub3 = require( '@stdlib/number-float64-base-sub3' );sub3( x, y, z )
Computes the difference of three double-precision floating-point numbers.
var v = sub3( 1.0, 5.0, 2.0 );
// returns -6.0
v = sub3( 2.0, 5.0, 2.0 );
// returns -5.0
v = sub3( 0.0, 5.0, 2.0 );
// returns -7.0
v = sub3( -0.0, 0.0, -0.0 );
// returns 0.0
v = sub3( NaN, NaN, NaN );
// returns NaNExamples
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var sub3 = require( '@stdlib/number-float64-base-sub3' );
var x = discreteUniform( 100, -50, 50 );
var y = discreteUniform( 100, -50, 50 );
var z = discreteUniform( 100, -50, 50 );
logEachMap( 'x: %d, y: %d, z: %d => %d', x, y, z, sub3 );C APIs
Usage
#include "stdlib/number/float64/base/sub3.h"stdlib_base_float64_sub3( x, y, z )
Computes the difference of three double-precision floating-point numbers.
double out = stdlib_base_float64_sub3( -5.0, 2.0, 4.0 );
// returns -11.0The function accepts the following arguments:
- x:
[in] doublefirst input value. - y:
[in] doublesecond input value. - z:
[in] doublethird input value.
double stdlib_base_float64_sub3( const double x, const double y, const double z );Examples
#include "stdlib/number/float64/base/sub3.h"
#include <stdio.h>
int main( void ) {
const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 };
const double y[] = { 3.14, -3.14, -0.0, 0.0/0.0 };
const double z[] = { 2.0, -3.0, -0.0, 0.0/0.0 };
double out;
int i;
for ( i = 0; i < 4; i++ ) {
out = stdlib_base_float64_sub3( x[ i ], y[ i ], z[ i ] );
printf( "%lf - %lf - %lf = %lf\n", x[ i ], y[ i ], z[ i ], out );
}
}Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
