# The interpop operator

*This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP*

internaldict *real array * interpop *real*

Implements a simple `y(x)`

mapping using linear interpolation over an equally spaced table of values.

The real operand should be a real value between `0`

and `1`

; if the value is outside this range, it is clipped. This number is the `x`

value input to the function.

The array operand must be an array of numbers; each value may be an integer or a real. There is no restriction on the values of the numbers or the number of entries in the array (except for PostScript limits). The array is treated as a table of `y`

values along equally-spaced `x`

positions. The first value is for `x`

=`0`

and the last value is for `x`

=`1`

.

The returned real value is the value of `y(x)`

obtained by linearly interpolating over the appropriate segment of the table.

A simple example follows:

`userdict /interpop 1183615869 internaldict /interpop get put 0.7 {0 0.15 0.45 0.65 0.85 1} //interpop`

with the result of `0.75`

. There are six values in the table spaced by `x`

of `0.2`

; with `x`

=`0.7`

, the segment is between `x`

=`0.6`

and `x`

=`0.8`

. These have values of `y`

=`0.65`

and `y`

=`0.85`

respectively with the result of `0.75`

, which is 50% along that segment.

For other examples, see Variant 2 lookup procedures .

If you need a more flexible function with variable spacing of data points or a larger domain, use `piecewiselineargen `

from the HqnHalftoneUtilities procset - or indeed a PostScript-language function constructed in the standard ways. Invoke them with The evalfunc operator.