Function PGAGetRealFromBinary
Defined in File evaluate.c
Function Documentation
-
double PGAGetRealFromBinary(PGAContext *ctx, int p, int pop, int start, int end, double lower, double upper)
Interpret a binary string as encoding a real value and return the real value it represents.
Example
Decode a real value from the string
p
in populationPGA_NEWPOP
. The value to decode lies on the interval \([-10,20]\) and is represented using the 20 bits in bit positions 10–29.double x; ... x = PGAGetRealFromBinary (ctx, p, PGA_NEWPOP, 10, 29, -10.0, 20.0);
- Parameters:
ctx – context variable
p – string index
pop – symbolic constant of the population the string is in
start – starting bit position in the binary representation
end – ending bit position in the binary representation
lower – lower bound of the interval the real number is defined on
upper – upper bound of the interval the real number is defined on
- Returns:
The real value encoded by the binary string