Get a decimal value from a percentage or a number.
@param {String|Number} frac - the value to be converted to a decimal fraction
@return - a decimal value equivalent to the input
@example
resolveFraction('25%');   // 0.25
resolveFraction('0.25');  // 0.25
334982
function resolveFraction(frac) {
  frac = `${frac}`;
  if (Patterns.Percentage.test(frac)) {
    return parseFloat(frac) / 100;
  } else if (Patterns.Number.test(frac)) {
    return parseFloat(frac);
  } else
    throw new Error('Unknown fraction format: ', inp);
}
778798
function xToValue(x) {
    const
        rect = this.$.getBoundingClientRect(),
        percent = x / rect.width,
        range = this.max - this.min,
        value = Math.floor(percent * range + 0.5);
    return this.min + this.step * Math.floor(value / this.step);
}
1293872
def formatPercent( value, options = nil )
      if value
         percent = (value.to_f * 100)
         value = percent.to_s
         if value.include?(".")
            int,fraction = value.split('.')
            if fraction.to_i == 0
               value = int
            else
               value = "#{int}.#{fraction[0,2]}"
            end            
         end         
      else
         value = "0"
      end
      value
   end
967781
function percentToValue(percent) {
      var adjustedPercent = invert ? (1 - percent) : percent;
      return (min + adjustedPercent * (max - min));
    }
52060
def percentage(value: str) -> float:
    
    try:
        fvalue = float(value)
        assert 0 <= fvalue <= 100
    except (AssertionError, TypeError, ValueError):
        raise ArgumentTypeError(
            "{!r} is an invalid percentage value".format(value))
    return fvalue
452168
function(percentage) {
					var min = (this.options.min === 0) ? 0 : Math.log(this.options.min);
					var max = Math.log(this.options.max);
					var value = Math.exp(min + (max - min) * percentage / 100);
					value = this.options.min + Math.round((value - this.options.min) / this.options.step) * this.options.step;
					/* Rounding to the nearest step could exceed the min or
					 * max, so clip to those values. */
					if (value < this.options.min) {
						return this.options.min;
					} else if (value > this.options.max) {
						return this.options.max;
					} else {
						return value;
					}
				}
505403
def percentage(value, digits=2):
    '''
    

    '''

    value = float(value) * 100.0
    return u'' + '%s %%' % (_format(value, digits),)
46801
function(n) {
			var a = (n === Math.floor(n)) ? n : (Math.round(n*100))/100;
			return (a + "%");
		}
942004
function processValue(value) {
    if (isNaN(value)) return 0;

    value = Math.max(MIN_VALUE, Math.min(value, MAX_VALUE));

    //value is between 0 and 1, thus is interpreted as percentage
    if (value < 1) value = value * MAX_VALUE;

    value = parseInt(value, 10);

    return value;
}
65758
function bound01(n, max) {
    if (isOnePointZero(n)) { n = "100%"; }

    var processPercent = isPercentage(n);
    n = mathMin(max, mathMax(0, parseFloat(n)));

    // Automatically convert percentage into number
    if (processPercent) {
        n = parseInt(n * max, 10) / 100;
    }

    // Handle floating point rounding errors
    if ((Math.abs(n - max) < 0.000001)) {
        return 1;
    }

    // Convert into [0, 1] range if it isn't already
    return (n % max) / parseFloat(max);
}
135244
function formatPercent(value, locale, digitsInfo) {
    var format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);
    var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
    var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);
    return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
}
681695
def fraction_done(self, start=0.0, finish=1.0, stack=None):
        '''
        
        '''
        if stack is None:
            stack = self.task_stack

        if len(stack) == 0:
            return start
        elif stack[0].size == 0:
            # Avoid divide by zero
            return finish
        else:
            top_fraction = stack[0].progress * 1.0 / stack[0].size
            next_top_fraction = (stack[0].progress + 1.0) / stack[0].size
            inner_start = start + top_fraction * (finish - start)
            inner_finish = start + next_top_fraction * (finish - start)
            return self.fraction_done(inner_start, inner_finish, stack[1:])
412875
function Decimal(value) {
      var x = this;

      // Decimal called without new.
      if (!(x instanceof Decimal)) return new Decimal(value);

      // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
      // which points to Object.
      x.constructor = Decimal;

      // Duplicate.
      if (value instanceof Decimal) {
        x.s = value.s;
        x.e = value.e;
        x.d = (value = value.d) ? value.slice() : value;
        return;
      }

      if (typeof value === 'number') {

        // Reject Infinity/NaN.
        if (value * 0 !== 0) {
          throw Error(invalidArgument + value);
        }

        if (value > 0) {
          x.s = 1;
        } else if (value < 0) {
          value = -value;
          x.s = -1;
        } else {
          x.s = 0;
          x.e = 0;
          x.d = [0];
          return;
        }

        // Fast path for small integers.
        if (value === ~~value && value < 1e7) {
          x.e = 0;
          x.d = [value];
          return;
        }

        return parseDecimal(x, value.toString());
      } else if (typeof value !== 'string') {
        throw Error(invalidArgument + value);
      }

      // Minus sign?
      if (value.charCodeAt(0) === 45) {
        value = value.slice(1);
        x.s = -1;
      } else {
        x.s = 1;
      }

      if (isDecimal.test(value)) parseDecimal(x, value);
      else throw Error(invalidArgument + value);
    }
585582
function( value, axis ){
			if( !value ) return 0;
			if( typeof value === 'number' ) return value;
			// a percentage
			return parseInt(value, 10) / 100 *
				(axis === 'x' ? this.canvas.width : this.canvas.height);
		}
479299
function toFrac( frac ) {
	var sum = 0;
	var i;
	for ( i = 0; i < frac.length; i++ ) {
		if ( frac[ i ] === '1' ) {
			sum += pow( 2, -(i+1) );
		}
	}
	return sum;
}
1343371
function( val ) {
		if ( val <= this._valueMin() ) {
			return this._valueMin();
		}
		if ( val >= this._valueMax() ) {
			return this._valueMax();
		}
		var step = ( this.options.step > 0 ) ? this.options.step : 1,
			valModStep = (val - this._valueMin()) % step,
			alignValue = val - valModStep;

		if ( Math.abs(valModStep) * 2 >= step ) {
			alignValue += ( valModStep > 0 ) ? step : ( -step );
		}

		// Since JavaScript has problems with large floats, round
		// the final value to 5 digits after the decimal point (see #4124)
		return parseFloat( alignValue.toFixed(5) );
	}
1141871
function(val, fractionDigits)
    {
      return formatNumber(val == null || val === "" ? 0 : clamp(val / 100, 0, 1),
      {
        style: "percent",
        minimumFractionDigits: fractionDigits == null ? 0 : fractionDigits,
        maximumFractionDigits: fractionDigits == null ? maximumFractionDigits : fractionDigits
      })
    }