-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathceiling.coffee
More file actions
61 lines (44 loc) · 753 Bytes
/
Copy pathceiling.coffee
File metadata and controls
61 lines (44 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
### ceiling =====================================================================
Tags
----
scripting, JS, internal, treenode, general concept
Parameters
----------
x
General description
-------------------
Returns the smallest integer not less than x.
###
Eval_ceiling = ->
push(cadr(p1))
Eval()
ceiling()
ceiling = ->
save()
yyceiling()
restore()
yyceiling = ->
d = 0.0
p1 = pop()
if (!isNumericAtom(p1))
push_symbol(CEILING)
push(p1)
list(2)
return
if (isdouble(p1))
d = Math.ceil(p1.d)
push_double(d)
return
if (isinteger(p1))
push(p1)
return
p3 = new U()
p3.k = NUM
p3.q.a = mdiv(p1.q.a, p1.q.b)
p3.q.b = mint(1)
push(p3)
if (isnegativenumber(p1))
doNothing = 1
else
push_integer(1)
add()