my code is below
I also hard typecasted float as seen below.
typically getRedValue(.5) should return Zero (0). but it returns // Result: 0.00390625 //
is there a simple fix for this ? code is wrong ? or what else Im missing ?
thank you
global proc float getRedValue(float $P)
{
float $V=(float)(255.0*$P);
float $res_=(float)((128.0-$V)/128.0);
if($res_<0.0)$res_=0.00;
return $res_;
}
getRedValue(.5)