exponential formula in a subroutine
Posted: Thu Aug 31, 2006 11:04 am
Hi ,
I have a requirement to calculate a score ,based on an incoming value using some iterations(using a formula) which involves 'exponential' components in the formula.
for example, in this formula i have some multiplications to be done with exponential components such as 0.5543e-008, 2.345e-006, 3.45009e008,4.00898e-008 and so on...
my question is , while we do the calculation can I type in these components as they are or should i convert them before i use them for any calculation?
Since this formula is pretty big(about 55 lines) which involves at least 20 exponential components in the formula, i am confused to format it as well as compare it with the manually calculated result.
i am giving part of the sample subroutine i have written, can i body please suggest me if i am using the correct format.
if transrisklock>=150 and transrisklock<257.14286
then transriskprob=0.84415864-(1.0488722e-005*(transrisklock-150)^2)+(3.2397817e-008*(transrisklock-150)^3)
else if transrisklock>=257.14286 and transrisklock<364.28571
then transriskprob=0.7636003-(0.001131842*(transrisklock-257.14286))-(2.078843e-005*(transrisklock-257.14286)^2)+(9.3295162e-008*(transrisklock-257.14286)^3)
else if transrisklock>=364.28571 and transrisklock<471.42857
If i am not supposed to use the 'e' as it is please suggest me what format should i use.
thanks in advance.
I have a requirement to calculate a score ,based on an incoming value using some iterations(using a formula) which involves 'exponential' components in the formula.
for example, in this formula i have some multiplications to be done with exponential components such as 0.5543e-008, 2.345e-006, 3.45009e008,4.00898e-008 and so on...
my question is , while we do the calculation can I type in these components as they are or should i convert them before i use them for any calculation?
Since this formula is pretty big(about 55 lines) which involves at least 20 exponential components in the formula, i am confused to format it as well as compare it with the manually calculated result.
i am giving part of the sample subroutine i have written, can i body please suggest me if i am using the correct format.
if transrisklock>=150 and transrisklock<257.14286
then transriskprob=0.84415864-(1.0488722e-005*(transrisklock-150)^2)+(3.2397817e-008*(transrisklock-150)^3)
else if transrisklock>=257.14286 and transrisklock<364.28571
then transriskprob=0.7636003-(0.001131842*(transrisklock-257.14286))-(2.078843e-005*(transrisklock-257.14286)^2)+(9.3295162e-008*(transrisklock-257.14286)^3)
else if transrisklock>=364.28571 and transrisklock<471.42857
If i am not supposed to use the 'e' as it is please suggest me what format should i use.
thanks in advance.