Function to calculate Profit or loss
function profitLoss ( N , M ) { if ( N == M ) document . write ( " " ) ; else { var result = 0.0 ; result = ( Math . abs ( N - M ) ) / M ; if ( N - M < 0 ) document . write ( " " + result . toFixed ( 6 ) * 100 + " " ) ; else document . write ( " " + result . toFixed ( 6 ) * 100 + " " ) ; } }