From fb1c15a828612909b9b1a609270fa324229bc807 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 12 Mar 2024 01:12:50 +0000 Subject: [PATCH] Auto-generated commit --- LICENSE | 71 +++--- base/special/log2/README.md | 86 +++++++ .../log2/benchmark/benchmark.native.js | 60 +++++ base/special/log2/benchmark/c/native/Makefile | 146 +++++++++++ .../log2/benchmark/c/native/benchmark.c | 136 ++++++++++ base/special/log2/binding.gyp | 170 +++++++++++++ base/special/log2/examples/c/Makefile | 146 +++++++++++ base/special/log2/examples/c/example.c | 33 +++ base/special/log2/include.gypi | 53 ++++ .../include/stdlib/math/base/special/log2.h | 38 +++ base/special/log2/lib/native.js | 58 +++++ base/special/log2/manifest.json | 96 +++++++ base/special/log2/scripts/evalpoly.js | 52 ++++ base/special/log2/src/Makefile | 70 ++++++ base/special/log2/src/addon.c | 23 ++ base/special/log2/src/main.c | 190 ++++++++++++++ base/special/log2/test/test.native.js | 235 ++++++++++++++++++ 17 files changed, 1626 insertions(+), 37 deletions(-) create mode 100644 base/special/log2/benchmark/benchmark.native.js create mode 100644 base/special/log2/benchmark/c/native/Makefile create mode 100644 base/special/log2/benchmark/c/native/benchmark.c create mode 100644 base/special/log2/binding.gyp create mode 100644 base/special/log2/examples/c/Makefile create mode 100644 base/special/log2/examples/c/example.c create mode 100644 base/special/log2/include.gypi create mode 100644 base/special/log2/include/stdlib/math/base/special/log2.h create mode 100644 base/special/log2/lib/native.js create mode 100644 base/special/log2/manifest.json create mode 100644 base/special/log2/src/Makefile create mode 100644 base/special/log2/src/addon.c create mode 100644 base/special/log2/src/main.c create mode 100644 base/special/log2/test/test.native.js diff --git a/LICENSE b/LICENSE index d1534e6cb..5965a0b2c 100644 --- a/LICENSE +++ b/LICENSE @@ -207,28 +207,6 @@ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* Cephes - -Copyright (c) 1984-2000 Stephen L. Moshier - -Some software in this archive may be from the book _Methods and Programs for -Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) -or from the Cephes Mathematical Library, a commercial product. In either event, -it is copyrighted by the author. What you see here may be used freely but it -comes with no support or guarantee. - -Stephen L. Moshier -moshier@na-net.ornl.gov - -* FreeBSD - -Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. - -Developed at SunPro, a Sun Microsystems, Inc. business. -Permission to use, copy, modify, and distribute this -software is freely granted, provided that this notice -is preserved. - * Go Copyright (c) 2009 The Go Authors. All rights reserved. @@ -259,6 +237,28 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* Cephes + +Copyright (c) 1984-2000 Stephen L. Moshier + +Some software in this archive may be from the book _Methods and Programs for +Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) +or from the Cephes Mathematical Library, a commercial product. In either event, +it is copyrighted by the author. What you see here may be used freely but it +comes with no support or guarantee. + +Stephen L. Moshier +moshier@na-net.ornl.gov + +* FreeBSD + +Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + * Faddeeva Copyright (c) 2012 Massachusetts Institute of Technology @@ -282,13 +282,18 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. +* SLATEC Common Mathematical Library + +Public domain. + +* FDLIBM + +Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -320,11 +325,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* SLATEC Common Mathematical Library - -Public domain. - -* FDLIBM - -Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. - diff --git a/base/special/log2/README.md b/base/special/log2/README.md index b0e081fc9..ba286ceb1 100644 --- a/base/special/log2/README.md +++ b/base/special/log2/README.md @@ -104,6 +104,92 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/log2.h" +``` + +#### stdlib_base_log2( x ) + +Evaluates the binary logarithm. + +```c +double out = stdlib_base_log2( 4.0 ); +// returns 2.0 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +double stdlib_base_log2( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/log2.h" +#include +#include + +int main( void ) { + double x; + double v; + int i; + for ( i = 0; i < 100; i++ ) { + x = ( ( (double)rand() / (double)RAND_MAX ) * 100.0 ); + v = stdlib_base_log( x ); + printf( "log2(%lf) = %lf\n", x, v ); + } +} +``` + +
+ + + +
+ + +