Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Safe-addition/E/safe-addition-1.e
Normal file
17
Task/Safe-addition/E/safe-addition-1.e
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
def makeInterval(a :float64, b :float64) {
|
||||
require(a <= b)
|
||||
def interval {
|
||||
to least() { return a }
|
||||
to greatest() { return b }
|
||||
to __printOn(out) {
|
||||
out.print("[", a, ", ", b, "]")
|
||||
}
|
||||
to add(other) {
|
||||
require(a <=> b)
|
||||
require(other.least() <=> other.greatest())
|
||||
def result := a + other.least()
|
||||
return makeInterval(result.previous(), result.next())
|
||||
}
|
||||
}
|
||||
return interval
|
||||
}
|
||||
2
Task/Safe-addition/E/safe-addition-2.e
Normal file
2
Task/Safe-addition/E/safe-addition-2.e
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
? makeInterval(1.14, 1.14) + makeInterval(2000.0, 2000.0)
|
||||
# value: [2001.1399999999999, 2001.1400000000003]
|
||||
Loading…
Add table
Add a link
Reference in a new issue