spire.math.Interval#isBounded mixed up

50 views
Skip to first unread message

Mikhail Sokolov

unread,
Nov 16, 2015, 1:32:42 AM11/16/15
to Typelevel Users & Development List
Hello!

I have found that the method isBounded in the spire.math.Interval type works weird:

def printIntervalBounded[T](i: Interval[T]) = println(s"$i.isBounded == ${i.isBounded}")


printIntervalBounded
(Interval.empty[Long])
printIntervalBounded
(Interval("(1,2)"))
printIntervalBounded
(Interval("[1,∞)"))
printIntervalBounded
(Interval("(-∞,1]"))
printIntervalBounded
(Interval.all[Long])


gives
(Ø).isBounded == false
(1, 2).isBounded == false
[1, ∞).isBounded == true
(-∞, 1].isBounded == true
(-∞, ∞).isBounded == true
Looks like it returns false for a bounded interval and true for unbounded but it should be the other way around.
 
  def isBounded: Boolean =
   
this match {
     
case Below(_, _) | Above(_, _) | All() => true
     
case _ => false
   
}

Is it a bug or I am missing something?

rosset...@gmail.com

unread,
Dec 19, 2015, 10:22:35 AM12/19/15
to Typelevel Users & Development List
Hi,

I opened an issue on Github here:

https://github.com/non/spire/issues/542

Miles Sabin

unread,
Dec 19, 2015, 12:30:59 PM12/19/15
to rosset...@gmail.com, Typelevel Users & Development List

Hi!

Most discussion around Spire happens on its Gitter channel these days,

 https://gitter.im/non/spire

Cheers,

Miles

--
You received this message because you are subscribed to the Google Groups "Typelevel Users & Development List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to typelevel+...@googlegroups.com.
To post to this group, send email to type...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/typelevel/901deb1d-4f4c-428b-8e0b-8043f70dd29f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages