Skip to content

Example exhibits integer overflow/incorrect result silently #480

Closed
@sfaleron

Description

@sfaleron

In https://github.com/scala/scala.github.com/blob/master/overviews/parallel-collections/overview.md, under "Some Examples", the fold/sum example overflows.

One might choose a smaller range, or point out the gotcha for the unwary.

scala> (1 to 1e6.toInt).map(_.toLong).sum
res42: Long = 500000500000

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