What is a short, fast way of testing whether x in [a, b]?

2016-02-07 Thread Enjoys Math via Digitalmars-d-learn
Right now I'm using a logical ||: if (!(2*PI - EPS!float <= t1-t0 || t1-t0 <= 2*PI + EPS!float)) { But I'll be doing this a lot, so was wondering if there's a D native way of doing it. Thanks.

Re: What is a short, fast way of testing whether x in [a, b]?

2016-02-07 Thread Enjoys Math via Digitalmars-d-learn
On Monday, 8 February 2016 at 02:47:24 UTC, Enjoys Math wrote: Right now I'm using a logical ||: if (!(2*PI - EPS!float <= t1-t0 || t1-t0 <= 2*PI + EPS!float)) { But I'll be doing this a lot, so was wondering if there's a D native way of doing it. Thanks. Currently I have: @property T

Re: What is a short, fast way of testing whether x in [a, b]?

2016-02-07 Thread cy via Digitalmars-d-learn
On Monday, 8 February 2016 at 03:09:53 UTC, Enjoys Math wrote: was wondering if there's a D native way of doing it. That is the D native way of doing it, but you could clean up a lot of the boilerplate with some more templates. Also, || tests for exclusion, as in whether something is NOT in