Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#12,247 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
c, javascript, julia
Lĩnh vực
documentation, testing

Hướng nghiên cứu

Xem xét các trình tạo và ví dụ trong stats/base/dists/normal/mgf/benchmark/benchmark.js, benchmark/benchmark.native.js, examples/index.js, examples/c/example.c, test/fixtures/julia/runner.jl và README.md; so sánh chúng với C benchmark hiện có. Cập nhật các đầu vào được liệt kê để các giá trị t âm hợp lệ được bao phủ nhất quán, sau đó chạy các bài kiểm tra normal/mgf và kiểm tra các ví dụ cũng như benchmark.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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 );
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
567

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của stdlib-js/stdlib

Tất cả issue của stdlib-js/stdlib

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.