---
name: "reciprocal_scale"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/reciprocal_scale"
---

# reciprocal\_scale(9)

"scale" a value into range \[0, ep\_ro)

## NAME

reciprocal\_scale - "scale" a value into range \[0, ep\_ro)

## SYNOPSIS

**u32 reciprocal\_scale(u32** *val***, u32** *ep\_ro***);**

## ARGUMENTS

*val*

value

*ep\_ro*

right open interval endpoint

## DESCRIPTION

Perform a “reciprocal multiplication” in order to “scale” a value into range \[0, ep\_ro), where the upper interval endpoint is right-open. This is useful, e.g. for accessing a index of an array containing ep\_ro elements, for example. Think of it as sort of modulus, only that the result isn't that of modulo. ;) Note that if initial input is a small value, then result will return 0.

## RETURN

a result based on val in interval \[0, ep\_ro).

## COPYRIGHT
