What the Duration of negative Infinity mean?

Stephen Winnall steve at winnall.ch
Thu Jan 31 17:39:52 PST 2013


Shouldn't one stick with standard arithmetic conventions, which are logically well-founded, consistent and correct even for those use-cases one hasn't thought of yet? In other words, negative durations are OK. I think anything else will cause undue confusion sooner or later.

Steve

On 31 Jan 2013, at 09:12, Martin Sladecek <martin.sladecek at oracle.com> wrote:

> Is there a reason why we support negative values in Duration at all? Maybe we should throw IllegalArgumentException when some negative value is set in one of the factory methods.
> 
> -Martin
> 
> On 01/31/2013 12:22 AM, Richard Bair wrote:
>> http://javafx-jira.kenai.com/browse/RT-23951
>> 
>> I recently added to ScheduledService, and it supported all the boundary conditions (isIndefinite, isUnknown) of a Duration. Right now NEGATIVE_INFINITY is not handled at all in Duration. POSITIVE_INFINITY maps to isIndefinite and NaN maps to isUnknown.
>> 
>> It seems like NEGATIVE_INFINITY should also cause isIndefinite to return true. Some code (including mine) was assuming isIndefinite was positive, but that would not now necessarily be the case.
>> 
>> Thoughts?
>> 
>> Richard
> 



More information about the openjfx-dev mailing list