Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Incorrect domain of `t` used in `stats/base/dists/normal/mgf` across benchmark, test and examples

Abierto
#12,247 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@Shanwis ya está trabajando en esto.

Desde el 23/5/2026.

  • #12253 de @Shanwis — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
c, javascript, julia

Línea de trabajo

Revisa los generadores y ejemplos de stats/base/dists/normal/mgf/benchmark/benchmark.js, benchmark/benchmark.native.js, examples/index.js, examples/c/example.c, test/fixtures/julia/runner.jl y README.md; compáralos con el benchmark de C existente. Actualiza las entradas indicadas para que los valores negativos válidos de t estén cubiertos de forma coherente y, después, ejecuta las pruebas de normal/mgf e inspecciona los ejemplos y benchmarks.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

For the mgf function in normal distribution mgf( t, mu, sigma) t is allowed to take any value within (-inf, +inf) but in the test, benchmarks and examples the domain used is [0, +inf) except the C benchmark file.

  • For C benchmark in stats/base/dists/normal/mgf/benchmark/c/benchmark.c at line 105 the domain of t is correct.
	for ( i = 0; i < 100; i++ ) {
		t[ i ] = random_uniform( -100.0, 100.0 );
  • For JS benchmarks in stats/base/dists/normal/mgf/benchmark/benchmark.js at line 76, line 45 and stats/base/dists/normal/mgf/benchmark/benchmark.native.js at line 54 the domain of t is [0,1)
	t = uniform( 100, 0.0, 1.0, {
		'dtype': 'float64'
	});
  • For both C and JS examples in stats/base/dists/normal/mgf/examples/index.js at line 30 the domain is [0,10) and in stats/base/dists/normal/mgf/examples/c/example.c at line 37 the domain is [0,1)

JS file

var t = uniform( 10, 0.0, 10.0, opts );

C file

t = random_uniform( 0.0, 1.0 );
  • For the Julia test fixture runner in stats/base/dists/normal/mgf/test/fixtures/julia/runner.jl at line 74, line 80 and line 86 the value x (which corresponds to t) is generated only from [0, +inf), missing coverage of negative values which are valid inputs.
x = rand( 1000 ) .* 20.0;
...
x = rand( 1000 ) .* 20.0;
...
x = rand( 1000 ) .* 10.0;
  • For the README.md examples in stats/base/dists/normal/mgf/README.md at line 142 the JS example uses [0,10) and at line 233 the C example uses [0,1) for the domain of t.

JS example

var t = uniform( 10, 0.0, 10.0, opts );

C example

t = random_uniform( 0.0, 1.0 );
Lenguaje dominante
JavaScript
Estrellas
6k
Forks
1.3k
Merge medio
1 d 10 h
PR fusionados (30 d)
481

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stdlib-js/stdlib

Todos los issues de stdlib-js/stdlib

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.