Global Function

norm()

Declaration

func norm(value: Double, startValue: Double, endValue: Double) -> Double

Parameters

value The input value to be normalized.
startValue The lower bound of the input range.
endValue The upper bound of the input range.

Returns

Double

Description

Normalizes a number in another range into a value between 0 and 1.

Examples

let a = 20.0
let b = norm(value: a, startValue: 0.0, endValue: 50.0)
// The value of b is 0.4

Related

map()