commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From luc.maison...@free.fr
Subject Re: [Math] Fraction parsing bug?
Date Thu, 01 Dec 2011 14:24:35 GMT


----- Mail original -----
> Hi.

Hello Gilles,

> 
> Should the "Fraction" type be able to represent
>   -0 / 1
> and keep a record of the sign, such that, if "c" is the above
> fraction,
>   1d / c.doubleValue()
> is equals "Double.NEGATIVE_INFITNITY"?

IMHO, no.
The fact 0 is signed for doubles is really a trick set up in the IEE754 standard only for
dealing with branch cuts (like the division you present). It is not available for other types
like int or longs where 0 is not signed and special numbers like infinity and NaN and even
subnormals do not exist. Our fractions are both closer to the mathematical Z set and to the
computer science int primitives pairs than to double. There is a conversion method doubleValue,
but it should rather be considered an extension than a core feature.

Luc

> 
> 
> Gilles
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message