Skip to content

math/big: (*Rat).SetString("1/0") should not be ok #8920

@gopherbot

Description

@gopherbot

by casey.marshall:

Issue in 1.3 & tip.

Calling big.Rat.SetString with a rational string value that has a zero denominator will
produce an incorrect and unexpected result.

big.Rat.SetString simply assumes the denominator is 1 when it is actually 0.

big.Rat.SetString with a zero denominator should return nil, false.

http://play.golang.org/p/kTfKTZd8JI

-Casey

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions