commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Brampton (JIRA)" <>
Subject [jira] [Commented] (MATH-1083) Fraction - Allow zero denominator if numerator is also zero
Date Wed, 25 Dec 2013 14:32:50 GMT


Andrew Brampton commented on MATH-1083:

Sebb/Luc, thanks for pointing out the complexities in "0/0". I'll close this ticket as I now
believe the current behavior is correct (that is to throw an exception while parsing 0/0).

I am going to reach out to the other library that is generating "0/0" (FFmpeg for reference),
and ask them to just output 0. In the mean time, my temporary hack is to check the string
is "0/0" before handling it off to the Fraction constructor.

> Fraction - Allow zero denominator if numerator is also zero
> -----------------------------------------------------------
>                 Key: MATH-1083
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.1
>            Reporter: Andrew Brampton
>            Priority: Minor
>              Labels: Fraction
> The Fraction constructor rejects a denominator of zero. However, while trying to parse
some Strings generated by another program, I encountered a fraction "0/0". I would say that's
ambiguous as to if that's valid, but some people would agree the answer is zero.
> So, would it be possible to allow a zero denominator if the numerator is also zero. I'd
be happy to provide a patch.

This message was sent by Atlassian JIRA

View raw message