nl_tokens: / * This method rounds a given value to the closest integer defined according to the rounding . Examples : rounding : 10 v : 12 . 3 -- > 10 rounding : 1 v : 12 . 3 -- > 12 rounding : 10 v : 12 . 6 -- > 13
pl_tokens: function ( v ) { var $this = this ; var rounding = _methods . get_rounding_for_value . <mask> ( $this , v ) ; if ( rounding > 0 ) { // We bring ourselves in a space of unitary roundings. You can // imagine now that sliders range between a certain minimum and  // maximum, and we always increase/decrease of one. var increment = v / rounding ; // This is the proposed value. var increment_int = parseInt ( increment , 10 ) ; // delta is a positive number between 0 and 1 that tells us how // close is the slider to integer + 1 (i.e., the next rounding). // 0 means the grip is exactly on integer // 1 means the grip is on integer + 1. var delta = increment - increment_int ; // now use delta to modify or not the current value. if ( delta > 0.5 ) { increment_int ++ ; } // we now move the  var rounded = increment_int * rounding ; return rounded ; } else { $ . error ( 'rounding must be > 0, got ' + rounding + ' instead' ) ; } return v ; }