Skip to content

Return Option instead of NaN #29

Open

Description

@Shatur

When the number of samples is less then required, methods from this crate usually returns NaN.
It's correct, but requires user to check the result or verify the number of samples.

Maybe return Option instead? This will be consistent with other methods on Iterator.

Activity

  1. vks commented on May 13, 2024

    @vks
    Owner

    We could add a try_* API returning an Option or Result, but I'm not sure it's possible to guarantee no NaN is returned due to other reasons.

  2. Shatur commented on May 20, 2024

    @Shatur
    Author

    but I'm not sure it's possible to guarantee no NaN is returned due to other reasons

    Sure, but at least it won't return NaN for an empty iterator. I would make this default behavior, without additional try_* method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions