Skip to content

Commit ac9b85b

Browse files
committed
feat: add c benchmark
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 4c03a74 commit ac9b85b

File tree

4 files changed

+11
-296
lines changed

4 files changed

+11
-296
lines changed

lib/node_modules/@stdlib/math/base/special/log1pmxf/benchmark/c/Makefile

Lines changed: 0 additions & 127 deletions
This file was deleted.

lib/node_modules/@stdlib/math/base/special/log1pmxf/benchmark/c/benchmark.c

Lines changed: 0 additions & 158 deletions
This file was deleted.

lib/node_modules/@stdlib/math/base/special/log1pmxf/benchmark/c/native/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#/
22
# @license Apache-2.0
33
#
4-
# Copyright (c) 2025 The Stdlib Authors.
4+
# Copyright (c) 2026 The Stdlib Authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/math/base/special/log1pmxf/benchmark/c/native/benchmark.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2025 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -16,14 +16,14 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include "stdlib/math/base/special/log1pmx.h"
19+
#include "stdlib/math/base/special/log1pmxf.h"
2020
#include <stdlib.h>
2121
#include <stdio.h>
2222
#include <math.h>
2323
#include <time.h>
2424
#include <sys/time.h>
2525

26-
#define NAME "log1pmx"
26+
#define NAME "log1pmxf"
2727
#define ITERATIONS 1000000
2828
#define REPEATS 3
2929

@@ -79,9 +79,9 @@ static double tic( void ) {
7979
*
8080
* @return random number
8181
*/
82-
static double rand_double( void ) {
83-
int r = rand();
84-
return (double)r / ( (double)RAND_MAX + 1.0 );
82+
static float random_uniform( const float min, const float max ) {
83+
float v = (float)rand() / ( (float)RAND_MAX + 1.0f );
84+
return min + ( v*(max-min) );
8585
}
8686

8787
/**
@@ -91,18 +91,18 @@ static double rand_double( void ) {
9191
*/
9292
static double benchmark( void ) {
9393
double elapsed;
94-
double x[ 100 ];
95-
double y;
94+
float x[ 100 ];
95+
float y;
9696
double t;
9797
int i;
9898

9999
for ( i = 0; i < 100; i++ ) {
100-
x[ i ] = 1000.0*rand_double();
100+
x[ i ] = random_uniform( 0.0f, 100.0f );
101101
}
102102

103103
t = tic();
104104
for ( i = 0; i < ITERATIONS; i++ ) {
105-
y = stdlib_base_log1pmx( x[ i%100 ] );
105+
y = stdlib_base_log1pmxf( x[ i%100 ] );
106106
if ( y != y ) {
107107
printf( "should not return NaN\n" );
108108
break;

0 commit comments

Comments
 (0)