string/round

text decimal-digits


Summary

Round the floating point representation in TEXT to have at most DECIMAL-DIGITS after the period

Bytecode

Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.

(    0 ($get/val 'last-index-of))
(    2 ($get/val 'text))
(    4 ($push/val .))
(    6 ($apply 2))
(    8 ($det/val 'pos))
(   10 ($drop))
(   11 ($get/val 'pos))
(   13 ($push/int/byte 0))
(   15 ($>=))
(   16 ($jf* 22))
(   19 ($get/val 'string/cut))
(   21 ($get/val 'text))
(   23 ($push/int/byte 0))
(   25 ($get/val 'pos))
(   27 ($push/int/byte 1))
(   29 ($add))
(   30 ($get/val 'decimal-digits))
(   32 ($add))
(   33 ($apply 3))
(   35 ($jmp* 5))
(   38 ($get/val 'text))
(   40 ($ret))