From 2c3b81e30f67381e6b4db113d2f49497faa5ad2a Mon Sep 17 00:00:00 2001
From: Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com>
Date: Tue, 5 Mar 2024 20:35:54 +0000
Subject: [PATCH 1/3] feat: add C implementation for
`math/base/special/avercos`
Signed-off-by: Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com>
---
.../math/base/special/avercos/README.md | 94 +++++++++-
.../avercos/benchmark/benchmark.native.js | 60 +++++++
.../avercos/benchmark/c/native/Makefile | 146 +++++++++++++++
.../avercos/benchmark/c/native/benchmark.c | 136 ++++++++++++++
.../math/base/special/avercos/binding.gyp | 170 ++++++++++++++++++
.../base/special/avercos/examples/c/Makefile | 146 +++++++++++++++
.../base/special/avercos/examples/c/example.c | 31 ++++
.../math/base/special/avercos/include.gypi | 53 ++++++
.../stdlib/math/base/special/avercos.h | 38 ++++
.../math/base/special/avercos/lib/native.js | 58 ++++++
.../math/base/special/avercos/manifest.json | 72 ++++++++
.../math/base/special/avercos/package.json | 2 +
.../math/base/special/avercos/src/Makefile | 70 ++++++++
.../math/base/special/avercos/src/addon.c | 23 +++
.../math/base/special/avercos/src/main.c | 34 ++++
.../base/special/avercos/test/test.native.js | 126 +++++++++++++
16 files changed, 1258 insertions(+), 1 deletion(-)
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/benchmark/benchmark.native.js
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/benchmark/c/native/Makefile
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/benchmark/c/native/benchmark.c
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/binding.gyp
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/examples/c/Makefile
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/examples/c/example.c
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/include.gypi
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/include/stdlib/math/base/special/avercos.h
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/lib/native.js
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/manifest.json
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/src/Makefile
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/src/addon.c
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/src/main.c
create mode 100644 lib/node_modules/@stdlib/math/base/special/avercos/test/test.native.js
diff --git a/lib/node_modules/@stdlib/math/base/special/avercos/README.md b/lib/node_modules/@stdlib/math/base/special/avercos/README.md
index eccdd1aa5a5e..f89c7174e56d 100644
--- a/lib/node_modules/@stdlib/math/base/special/avercos/README.md
+++ b/lib/node_modules/@stdlib/math/base/special/avercos/README.md
@@ -2,7 +2,7 @@
@license Apache-2.0
-Copyright (c) 2018 The Stdlib Authors.
+Copyright (c) 2024 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -105,6 +105,98 @@ for ( i = 0; i < x.length; i++ ) {
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/math/base/special/avercos.h"
+```
+
+#### stdlib_base_avercos( x )
+
+Compute the [inverse versed cosine][inverse-versed-cosine] of a double-precision floating-point number (in radians).
+
+```c
+double out = stdlib_base_avercos( -3.141592653589793/2.0 );
+// returns ~2.1783
+```
+
+If `x < -2`, `x > 0`, or `x` is `NaN`, the function returns `NaN`.
+
+```c
+double out = stdlib_base_avercos( -3.141592653589793 );
+// returns NaN
+```
+
+The function accepts the following arguments:
+
+- **x**: `[in] double` input value.
+
+```c
+double stdlib_base_avercos( const double x );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/math/base/special/avercos.h"
+#include
+
+int main( void ) {
+ const double x[] = { -2.5, -2.0, -1.5, -1.0, -0.5, 0.5, 1.0, 1.5, 2.0, 2.5 };
+
+ double v;
+ int i;
+ for ( i = 0; i < 10; i++ ) {
+ v = stdlib_base_avercos( x[ i ] );
+ printf( "avercos(%lf) = %lf\n", x[ i ], v );
+ }
+}
+```
+
+
+
+
+
+
+
+
+