exponential formula in a subroutine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

exponential formula in a subroutine

Post by vivek »

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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"Scientific notation" in DataStage requires an upper-case E. Thus 2.345e-006 would be regarded as a string, but 2.345E-006 would be interpreted as a number. You can use the Num() function to verify.

The maximum supported exponent in DataStage is +38, the minimum supported exponent is -38, and the overall number must be able to be stored in IEEE floating point format (51 bit mantissa, 11 bit exponent with a constant offset of 1023).

I would advise tuning the MAXNUMERIC tunable to its highest possible value (from memory 57) if you are doing this style of calculation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply