fit expression function

Fits a value from one range to another.

All Usage Examples

See also: fit01, fit11, fit10

Usage

fit(num, oldmin, oldmax, newmin, newmax)

Return a number between newmin and newmax that is relative to num in the range between oldmin and oldmax. If the value is outside the old range, it will be clamped to the new range.

Examples

fit(3,1,4,5,20)=15