@@ -126,6 +126,48 @@ var Builtins = []*ast.Function{
126126 return anyType , fmt .Errorf ("invalid argument for abs (type %s)" , args [0 ])
127127 },
128128 },
129+ {
130+ Name : "ceil" ,
131+ Fast : Ceil ,
132+ Validate : func (args []reflect.Type ) (reflect.Type , error ) {
133+ if len (args ) != 1 {
134+ return anyType , fmt .Errorf ("invalid number of arguments (expected 1, got %d)" , len (args ))
135+ }
136+ switch kind (args [0 ]) {
137+ case reflect .Float32 , reflect .Float64 , reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 , reflect .Uint , reflect .Uint8 , reflect .Uint16 , reflect .Uint32 , reflect .Uint64 , reflect .Interface :
138+ return floatType , nil
139+ }
140+ return anyType , fmt .Errorf ("invalid argument for ceil (type %s)" , args [0 ])
141+ },
142+ },
143+ {
144+ Name : "floor" ,
145+ Fast : Floor ,
146+ Validate : func (args []reflect.Type ) (reflect.Type , error ) {
147+ if len (args ) != 1 {
148+ return anyType , fmt .Errorf ("invalid number of arguments (expected 1, got %d)" , len (args ))
149+ }
150+ switch kind (args [0 ]) {
151+ case reflect .Float32 , reflect .Float64 , reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 , reflect .Uint , reflect .Uint8 , reflect .Uint16 , reflect .Uint32 , reflect .Uint64 , reflect .Interface :
152+ return floatType , nil
153+ }
154+ return anyType , fmt .Errorf ("invalid argument for floor (type %s)" , args [0 ])
155+ },
156+ },
157+ {
158+ Name : "round" ,
159+ Fast : Round ,
160+ Validate : func (args []reflect.Type ) (reflect.Type , error ) {
161+ if len (args ) != 1 {
162+ return anyType , fmt .Errorf ("invalid number of arguments (expected 1, got %d)" , len (args ))
163+ }
164+ switch kind (args [0 ]) {
165+ case reflect .Float32 , reflect .Float64 , reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 , reflect .Uint , reflect .Uint8 , reflect .Uint16 , reflect .Uint32 , reflect .Uint64 , reflect .Interface :
166+ return floatType , nil
167+ }
168+ return anyType , fmt .Errorf ("invalid argument for floor (type %s)" , args [0 ])
169+ },
170+ },
129171 {
130172 Name : "int" ,
131173 Fast : Int ,
0 commit comments