(args []super.Value)
| 37 | } |
| 38 | |
| 39 | func (c *Ceil) Call(args []super.Value) super.Value { |
| 40 | val := args[0] |
| 41 | switch id := val.Type().ID(); { |
| 42 | case super.IsUnsigned(id) || super.IsSigned(id): |
| 43 | return val |
| 44 | case super.IsFloat(id): |
| 45 | return super.NewFloat(val.Type(), math.Ceil(val.Float())) |
| 46 | } |
| 47 | return c.sctx.WrapError("ceil: not a number", val) |
| 48 | } |
| 49 | |
| 50 | type Floor struct { |
| 51 | sctx *super.Context |