Get the percentage of the knob's position relative to the size of the line. The return value will be between 0.0
and 1.0.

@return the current percent complete
767844
protected double getKnobPercent() {
		// If we have no range
		if (maxValue <= minValue) {
			return 0;
		}

		// Calculate the relative progress
		double percent = (curValue - minValue) / (maxValue - minValue);
		return Math.max(0.0, Math.min(1.0, percent));
	}
121484
public float getWidthPoint() {
		if (getImage() != null) {
			return getImage().getScaledWidth();
		}
		return font.getCalculatedBaseFont(true).getWidthPoint(getContent(),
				font.getCalculatedSize())
				* getHorizontalScaling();
	}
670080
private double getStartAngle() {
        ScaleDirection scaleDirection = gauge.getScaleDirection();
        Pos            knobPosition   = gauge.getKnobPosition();
        switch(knobPosition) {
            case BOTTOM_LEFT : return ScaleDirection.CLOCKWISE == scaleDirection ? 180 : 90;
            case TOP_LEFT    : return ScaleDirection.CLOCKWISE == scaleDirection ?  90 : 0;
            case TOP_RIGHT   : return ScaleDirection.CLOCKWISE == scaleDirection ?   0 : 270;
            case BOTTOM_RIGHT:
            default          : return ScaleDirection.CLOCKWISE == scaleDirection ? 270 : 180;
        }
    }
697384
private int getPercentageY(double value) {
		value = 1.0 - value;
		double d = top + (((bottom - top) * value) / (maxPercentage - minPercentage));
		return (int) d;
	}
1258881
public void recalcContentHeightPercent() {
        if (stopPartsPositioning) return;
        if (!isVisible()) return;
        Element contentElt = content.getElement();
        if (contentHeightPercent > 0) {
            final JQMHeader header = getHeader();
            final JQMFooter footer = getFooter();
            int headerH = header == null || isFixedToolbarsHidden() ? 0 : header.getOffsetHeight();
            int footerH = footer == null || isFixedToolbarsHidden() ? 0 : footer.getOffsetHeight();
            int windowH = Window.getClientHeight();

            int clientH = contentElt.getPropertyInt("clientHeight");
            int offsetH = contentElt.getPropertyInt("offsetHeight");
            int diff = offsetH - clientH; // border, ...
            if (diff < 0) diff = 0;

            double h = (windowH - headerH - footerH - diff) * 0.01d * contentHeightPercent;
            h = Math.floor(h);
            contentElt.getStyle().setProperty("minHeight", String.valueOf(Math.round(h)) + "px");
            contentElt.getStyle().setProperty("paddingTop", "0");
            contentElt.getStyle().setProperty("paddingBottom", "0");
        } else {
            contentElt.getStyle().clearProperty("minHeight");
            contentElt.getStyle().clearProperty("paddingTop");
            contentElt.getStyle().clearProperty("paddingBottom");
        }
    }
1175535
function (percent) {
            var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step;

            if (rounded > 100) {
                rounded = 100;
            }
            if (percent === 100) {
                rounded = 100;
            }

            return this.toFixed(rounded);
        }
1091846
public final int toPixel() {
        if (unit == FontSizeUnit.PIXEL) {
            return Math.round(size);
        }
        if (unit == FontSizeUnit.EM) {
            return Math.round(16 * size);
        }
        if (unit == FontSizeUnit.PERCENT) {
            return Math.round(size / 100 * 16);
        }
        if (unit == FontSizeUnit.POINT) {
            return Math.round(size / 3 * 4);
        }
        throw new IllegalStateException("Unknown unit: " + unit);
    }
1328744
def key_percent (self, char):
        ''''''
        self.motion = self.motion_matching
        self.delete_right = 1
        self.state = _VI_MOTION
        self.apply ()
506586
function () {
      var p = $.fn.textcomplete.getCaretCoordinates(this.el, this.el.selectionStart);
      return {
        top: p.top + this._calculateLineHeight() - this.$el.scrollTop(),
        left: p.left - this.$el.scrollLeft(),
        lineHeight: this._calculateLineHeight()
      };
    }
51633
public static String percentFrom(final double a, final double b)
	{

		double bVal = b;

		if (bVal == 0.) {
			bVal = 1.;
		}

		StringBuilder rep = new StringBuilder();
		double d = ((long) ((a / bVal) * 10000) / 100.);
		if (d < 10.0) {
			rep.append('0');
		}

		rep.append(d);
		while (rep.length() < 5) {
			rep.append('0');
		}

		return rep + "%";
	}
599070
public String getRatio() {

        if (m_ratio == null) {
            m_ratio = "" + getScaler().getWidth() + "-" + getScaler().getHeight();
        }
        return m_ratio;
    }
260383
public double percentOverlap( Location other )
	{
		if( length() > 0 && overlaps( other ))
		{
			return 100.0 * (((double) intersection( other ).length()) / (double) length());
		}
		else
		{
			return 0;
		}
	}
187948
function() {
            var size = this.get(this.OPT.PICKER_SIZE),
                h = (size - this.hueSlider.getValue()) / size;
            h = Math.round(h*360);
            return (h === 360) ? 0 : h;
        }
318850
function (percent) {
            var min = this.options.min,
                max = this.options.max,
                min_decimals = min.toString().split(".")[1],
                max_decimals = max.toString().split(".")[1],
                min_length, max_length,
                avg_decimals = 0,
                abs = 0;

            if (percent === 0) {
                return this.options.min;
            }
            if (percent === 100) {
                return this.options.max;
            }


            if (min_decimals) {
                min_length = min_decimals.length;
                avg_decimals = min_length;
            }
            if (max_decimals) {
                max_length = max_decimals.length;
                avg_decimals = max_length;
            }
            if (min_length && max_length) {
                avg_decimals = (min_length >= max_length) ? min_length : max_length;
            }

            if (min < 0) {
                abs = Math.abs(min);
                min = +(min + abs).toFixed(avg_decimals);
                max = +(max + abs).toFixed(avg_decimals);
            }

            var number = ((max - min) / 100 * percent) + min,
                string = this.options.step.toString().split(".")[1],
                result;

            if (string) {
                number = +number.toFixed(string.length);
            } else {
                number = number / this.options.step;
                number = number * this.options.step;

                number = +number.toFixed(0);
            }

            if (abs) {
                number -= abs;
            }

            if (string) {
                result = +number.toFixed(string.length);
            } else {
                result = this.toFixed(number);
            }

            if (result < this.options.min) {
                result = this.options.min;
            } else if (result > this.options.max) {
                result = this.options.max;
            }

            return result;
        }
343374
public function dimState()
    {
        $currentState = $this->bridge->getBulbState($this->deviceId);
        $level = explode(':', $currentState[1])[0];
        $percent = round(($level*100)/255);

        return $percent;
    }
438950
public double getSkewAngle() {
        ImageDeskew.HoughLine[] hl;
        double sum = 0.0;
        int count = 0;

        // perform Hough Transformation
        calc();
        // top 20 of the detected lines in the image
        hl = getTop(20);

        if (hl.length >= 20) {
            // average angle of the lines
            for (int i = 0; i < 19; i++) {
                sum += hl[i].alpha;
                count++;
            }
            return (sum / count);
        } else {
            return 0.0d;
        }
    }
996196
private void drawKnob() {
		// Abort if not attached
		if (!isAttached()) {
			return;
		}

		// Move the knob to the correct position
		Element knobElement = knobImage.getElement();
		int lineWidth = lineElement.getOffsetWidth();
		int knobWidth = knobElement.getOffsetWidth();
		int knobLeftOffset = (int) (lineLeftOffset + (getKnobPercent() * lineWidth) - (knobWidth / 2));
		knobLeftOffset = Math.min(knobLeftOffset, lineLeftOffset + lineWidth - (knobWidth / 2) - 1);
		DOM.setStyleAttribute(knobElement, "left", knobLeftOffset + "px");
	}