Function PGAMapIntegerToReal
Defined in File evaluate.c
Function Documentation
-
static double PGAMapIntegerToReal(PGAContext *ctx, int v, int a, int b, double l, double u)
Maps the value v defined on [a,b] to r defined on [l,u].
Description
In the context of PGAPack \([a,b]\) is the discrete interval \([0,2^{nbits}-1]\) (i.e., the number of bits in a binary string) and \([l,u]\) represent the range of possible values of the real number \(r\).
Example
Map a five bit (that is, an integer with a range of [0, 31]) integer 5 to a real in the range [0, 3.14].
PGAContext *ctx; double x; ... x = PGAMapIntegerToReal (ctx, 5, 0, 31, 0.0, 3.14);
- Parameters:
ctx – context variable
v – value from original interval (usually the decoded bit string)
a – lower bound of integer interval
b – upper bound of integer interval
l – lower bound of real interval
u – upper bound of real interval
- Returns:
Scaled value of v defined on [l,u]