Hello Friends,

I need to ROUND UP or DOWN some values based on TickSize. Sometimes I need to 
round UP and sometimes round Down. Based upon some postings of the Group, I 
wrote following functions for the purpose. MOST of the time the results are on 
expected line. However on some RARE occasions RoundUp_TickSize is returning 
lower value. Sometimes RoundUp_TickSize as well as RoundDn_TickSize are 
modifying already round values. 

It will be nice if you can please guide me my errors.

With Regards

Sanjiv Bansal

===================

TickSize = 0.05;

function Round2TickSize( aValue )
{
TickInv = 1 / TickSize;
return ( round( aValue * TickInv ) / TickInv );
}

function RoundUp_TickSize( aValue )
{
TickInv = 1 / TickSize;
return( (ceil( Prec(aValue,2) * TickInv )) / TickInv);
}

function RoundDn_TickSize( aValue )
{
TickInv = 1 / TickSize;
return( (floor( Prec(aValue,2) * TickInv )) / TickInv);
}


Reply via email to