【PercentileArray】
[code]inputs:PctRank( numericsimple ),
PriceValueArray[MaxSize]( numericarrayref ),
Size( numericsimple ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ) ;
Condition1 = PctRank >= 0 and PctRank <= 1 ;
condition1 = Condition1 and Size > 1 ;
if condition1 then
begin
Value1 = SortArray( PriceValueArray, Size, -1 ) ;
var0 = 1 / ( Size - 1 ) ;
var1 = IntPortion( PctRank / var0 ) + 1 ;
var2 = var1 + 1 ;
var3 = ( PctRank - ( ( var1 - 1 ) * var0 ) ) / var0 ;
PercentileArray = ( PriceValueArray[var1] ) + ( var3 *
( PriceValueArray[var2] - PriceValueArray[var1] ) ) ;
end
else
begin
condition1 = Condition1 and Size = 1 ;
if condition1 then
PercentileArray = PriceValueArray[1]
else
PercentileArray = -1 ;
end;
[/code]
页:
[1]