-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hi!
I've encountered an issue when using this package in a Flutter app compiled for iOS. When trying to compute the standard deviation of a list of double values where all elements are the same, the result is NaN instead of the expected 0.0.
Here are a couple of example arrays that produce the issue:
[94.97, 94.97, 94.97, 94.97, 94.97, 94.97, 94.97]
[53.97, 53.97, 53.97, 53.97, 53.97, 53.97, 53.97]
Since all values are equal, the expected standard deviation should be 0.0.
Environment:
Flutter version: 3.29.2
Dart version: 3.7.2
statistics package version: 1.1.3
iOS target: 17.6.1
Minimal example
import 'package:statistics/statistics.dart';
void main() {
final data1 = [94.97, 94.97, 94.97, 94.97, 94.97, 94.97, 94.97];
final data2 = [53.97, 53.97, 53.97, 53.97, 53.97, 53.97, 53.97];
final stdDev1 = data1.standardDeviation;
final stdDev2 = data2.standardDeviation;
print('Standard Deviation of data1: $stdDev1');
print('Standard Deviation of data2: $stdDev2');
}
Expected Output
Standard Deviation of data1: 0.0
Standard Deviation of data2: 0.0
Actual Output
Standard Deviation of data1: NaN
Standard Deviation of data2: NaN
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels