aboutsummaryrefslogtreecommitdiff
path: root/interval.go
blob: 5f44f5124ed06a20ac72db908cc4b263ccd1479a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package main

type Interval struct {
  Min float64
  Max float64
}

func (i Interval) Size() float64 {
  return i.Max - i.Min;
}

func (i Interval) Include(x float64) bool {
  return i.Min <= x && x <= i.Max;
}

func (i Interval) Surround(x float64) bool {
  return i.Min < x && x < i.Max;
}