(args []super.Value)
| 135 | } |
| 136 | |
| 137 | func (r *Round) Call(args []super.Value) super.Value { |
| 138 | val := args[0] |
| 139 | switch id := val.Type().ID(); { |
| 140 | case id == super.IDNull: |
| 141 | return val |
| 142 | case super.IsUnsigned(id) || super.IsSigned(id): |
| 143 | return val |
| 144 | case super.IsFloat(id): |
| 145 | if val.IsNull() { |
| 146 | return val |
| 147 | } |
| 148 | return super.NewFloat(val.Type(), math.Round(val.Float())) |
| 149 | } |
| 150 | return r.sctx.WrapError("round: not a number", val) |
| 151 | } |
| 152 | |
| 153 | type Pow struct { |
| 154 | sctx *super.Context |