From 04e453d33074f820fb4187c7758a9414905e2757 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 16 Mar 2024 16:46:39 +0000 Subject: [PATCH] Auto-generated commit --- base/special/fast/abs/README.md | 85 +++++++++ .../fast/abs/benchmark/benchmark.native.js | 61 +++++++ .../fast/abs/benchmark/c/native/Makefile | 146 +++++++++++++++ .../fast/abs/benchmark/c/native/benchmark.c | 136 ++++++++++++++ base/special/fast/abs/binding.gyp | 170 ++++++++++++++++++ base/special/fast/abs/examples/c/Makefile | 146 +++++++++++++++ base/special/fast/abs/examples/c/example.c | 31 ++++ base/special/fast/abs/include.gypi | 53 ++++++ .../stdlib/math/base/special/fast/abs.h | 41 +++++ base/special/fast/abs/lib/native.js | 58 ++++++ base/special/fast/abs/manifest.json | 67 +++++++ base/special/fast/abs/src/Makefile | 70 ++++++++ base/special/fast/abs/src/addon.c | 22 +++ base/special/fast/abs/src/main.c | 36 ++++ base/special/fast/abs/test/test.native.js | 72 ++++++++ 15 files changed, 1194 insertions(+) create mode 100644 base/special/fast/abs/benchmark/benchmark.native.js create mode 100644 base/special/fast/abs/benchmark/c/native/Makefile create mode 100644 base/special/fast/abs/benchmark/c/native/benchmark.c create mode 100644 base/special/fast/abs/binding.gyp create mode 100644 base/special/fast/abs/examples/c/Makefile create mode 100644 base/special/fast/abs/examples/c/example.c create mode 100644 base/special/fast/abs/include.gypi create mode 100644 base/special/fast/abs/include/stdlib/math/base/special/fast/abs.h create mode 100644 base/special/fast/abs/lib/native.js create mode 100644 base/special/fast/abs/manifest.json create mode 100644 base/special/fast/abs/src/Makefile create mode 100644 base/special/fast/abs/src/addon.c create mode 100644 base/special/fast/abs/src/main.c create mode 100644 base/special/fast/abs/test/test.native.js diff --git a/base/special/fast/abs/README.md b/base/special/fast/abs/README.md index 8efa9b869..cd3e839a5 100644 --- a/base/special/fast/abs/README.md +++ b/base/special/fast/abs/README.md @@ -114,6 +114,91 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/fast/abs.h" +``` + +#### stdlib_base_fast_abs( x ) + +Computes the absolute value of a double-precision floating-point number. + +```c +double y = stdlib_base_fats_abs( -5.0 ); +// returns 5.0 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +double stdlib_base_fast_abs( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/fast/abs.h" +#include + +int main( void ) { + const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 }; + + double y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_fast_abs( x[ i ] ); + printf( "|%lf| = %lf\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + +