Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sum on ValueEnumerable.Range gives wrong sum #388

Open
CyberBotX opened this issue Jul 2, 2023 · 0 comments
Open

Sum on ValueEnumerable.Range gives wrong sum #388

CyberBotX opened this issue Jul 2, 2023 · 0 comments

Comments

@CyberBotX
Copy link

CyberBotX commented Jul 2, 2023

(NOTE: All of this is with version 3.0.0-beta48 from NuGet.)

If I do the following:

ValueEnumerable.Range(0, 10).Sum()

I get back 50 for the result, when the value should be 45.

If I change the above to:

ValueEnumerable.Range(0, 10).Select(x => x).Sum() or ValueEnumerable.Range(0, 10).Sum(x => x)

I get back the proper result of 45. It seems that adding almost any operation before the Sum (or a selector delegate within Sum) allows it to return the proper result, but just a straight parameterless Sum does not. For instance, even:

ValueEnumerable.Range(0, 10).Where(x => true).Sum()

I get back the proper result of 45. But doing:

ValueEnumerable.Range(0, 10).Skip(0).Sum()

I get back the wrong result of 50. (Take also doesn't change the result to the correct one.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant