MCPcopy Index your code
hub / github.com/refined-github/refined-github / inverseLinearInterpolation

Function inverseLinearInterpolation

source/helpers/math.ts:10–16  ·  view source on GitHub ↗

Inverse operation of linear interpolation. Given a range and a value, returns the interpolation amount to get that value. @param min Lowest value in the range @param max Highest value in the range @param value Value in the range @returns Interpolation amount from 0.0 to 1.0 (or beyond if `x` i

(min: number, max: number, value: number)

Source from the content-addressed store, hash-verified

8 @returns Interpolation amount from 0.0 to 1.0 (or beyond if `x` is outside the range [min, max])
9 */
10function inverseLinearInterpolation(min: number, max: number, value: number): number {
11 if (min === max) {
12 return 0;
13 }
14
15 return (value - min) / (max - min);
16}
17
18/**
19 Create a function that calculates a GitHub heat index based on a list of numbers.

Callers 1

createHeatIndexFunctionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected