Oscar The Tabby (1) [Avatar] Offline
assert (0.0..1.0).containsWithinBounds(0.5) works for me
assert (0.0..1.0).contains(0.5) don't.

I'm running Groovy 1.1-rc-1 JVM: 1.6.0-b105 on Ubuntu 7.04

This is what I get from the assertion suggested by the book:

Caught: java.lang.AssertionError: Expression: (0.0..1.0).contains(0.5)
at ranges.run(ranges.groovy:20)
at ranges.main(ranges.groovy)

/Maybe I'm hallucinating - Greeters!
Oscar The Tabby
Mittie (397) [Avatar] Offline
Re: Possible error: Section 4.1.1, Listing 4.1

this is exactly as expected. The book covers Groovy 1.0 and some changes to the BigDecimal Ranges have been made since then.

thanks for posting