Page 1 of 1

MagnitudeDifferenceToBeZero

Posted: Fri Nov 13, 2015 6:24 am
by macsir
Hi,

Has anyone successfully implemented this in TM1 before? It seems not working in TM1 10.2 FP4 now. I have set this parameter in the config file and reboot the server. Using a rule like C = A \ B where B is tiny number such as .0000000000000004, I still got huge C? Is it supposed to be Zero according to the document?

MagnitudeDifferenceToBeZero
Sets the order of magnitude of the numerator relative to the denominator, above which the denominator equals zero when using a safe division operator.
Parameter type: optional, static

In rules and TurboIntegrator, there is a safe division operator (the backslash). With this, if you try to divide by zero, the result is zero, not undefined. If the denominator to the division is a calculated quantity, the result can be very close to zero, but not exactly zero, for example, .0000000000000004. By setting the MagnitudeDifferenceToBeZero parameter, you can specify how close a number can be to zero, relative to the magnitude of the numerator, to be considered as zero for the safe division operator.

Consider this example:

In the file Tm1s.cfg, set MagnitudeDifferenceToBeZero=14
The operation is A \ B

Note: Backslash (\) is the safe division operator in TurboIntegrator.
A = 1000 B = 1.5e-15
B is 18 orders of magnitude less than A
18 > 14, therefore the save division operator returns B=0

Re: MagnitudeDifferenceToBeZero

Posted: Fri Nov 13, 2015 1:07 pm
by tomok
I think this sentence is key:
By setting the MagnitudeDifferenceToBeZero parameter, you can specify how close a number can be to zero, relative to the magnitude of the numerator, to be considered as zero for the safe division operator.
What this says to me is it is to keep TM1 from returning a ridiculously large number from a division calculation simply because of the inherent problems with the floating point issue. For example, the rule calculated amount may supposed to be zero, but instead is .0000000087. One divided by zero (in safe division) is zero but one divided by .0000000087 is 114,942,528.74. This is clearly not what you intended to happen thus this setting to keep it from doing so.

Re: MagnitudeDifferenceToBeZero

Posted: Fri Nov 13, 2015 8:58 pm
by TrailRunnerMark
I have not used this before but will test over the weekend. However the OP didn't say what the value of A was set to, or what the parameter was set to in the config file. The MagnitudeDifferenceToBeZero specifies the size ratio between the numerator and denominator, beyond which the safe division calculation will return zero.

As an example, if the OP divided 1 by .0000000000000004 but had the parameter set to 18 then zero would NOT be returned since those 2 numbers are less than 18 orders of magnitude apart.

Re: MagnitudeDifferenceToBeZero

Posted: Sat Nov 14, 2015 11:45 am
by macsir
Yes, please test it and let me know the result. Thanks.

Re: MagnitudeDifferenceToBeZero

Posted: Mon Nov 16, 2015 4:29 am
by macsir
Anyone has used it successfully before?