Compare the following two:
[1] Insert Custom 1 Line with 123456*123456 as the input parameter
=> shows -1,938,485,248 (Wrong! )
[2] Insert another indicator with the following code:
Plot1(123456*123456);
=> shows 15,241,383,936 (Correct )
HR
123456*123456 = 15,241,383,936 or -1,938,485,248 ?
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
"Floating point number too big"
Hi Bruce,
Can you help me understand what is 'Floating point" ?
I put this into a strategy and it returns the captioned error message.
Value1 = 6.9273023605346680 - (ARN + expValue(((expValue(((-9.2743015289306641) - SK2N)) * (6.9273023605346680 + ARN)) - (((-7.3906569480895996) * C9N) / ARN))));
How can I get around this ? Thanks !
LMC
Can you help me understand what is 'Floating point" ?
I put this into a strategy and it returns the captioned error message.
Value1 = 6.9273023605346680 - (ARN + expValue(((expValue(((-9.2743015289306641) - SK2N)) * (6.9273023605346680 + ARN)) - (((-7.3906569480895996) * C9N) / ARN))));
How can I get around this ? Thanks !
LMC
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: 123456*123456 = 15,241,383,936 or -1,938,485,248 ?
Dear LMC,
Probably, it is division by zero error. Please try one of the following:
1. Add the condition:
if ARN = 0 then ARN = 1;
2. Do not calculate value1 when ARN = 0:
if ARN = 0 then value1 = 0 else
Value1 = 6.9273023605346680 - (ARN + expValue(((expValue(((-9.2743015289306641) - SK2N)) * (6.9273023605346680 + ARN)) - (((-7.3906569480895996) * C9N) / ARN))));
Probably, it is division by zero error. Please try one of the following:
1. Add the condition:
if ARN = 0 then ARN = 1;
2. Do not calculate value1 when ARN = 0:
if ARN = 0 then value1 = 0 else
Value1 = 6.9273023605346680 - (ARN + expValue(((expValue(((-9.2743015289306641) - SK2N)) * (6.9273023605346680 + ARN)) - (((-7.3906569480895996) * C9N) / ARN))));
Re: 123456*123456 = 15,241,383,936 or -1,938,485,248 ?
Hi Dave,
I set a condition to not calculate if any one of the variables are zero, but the same error message returned. Any other possibilities ? Thanks.
LMC
I set a condition to not calculate if any one of the variables are zero, but the same error message returned. Any other possibilities ? Thanks.
LMC
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: 123456*123456 = 15,241,383,936 or -1,938,485,248 ?
Dear LMC,
Then exception occurs when going beyond type double. You have a complex statement, exp is calculated twice. You can use the following script to track the exception:
once cleardebug;
once for value1 = 0 to 10 begin
value2 = expvalue(expvalue(value1));
print("n = ", value1, "; exp(exp) = ", value2);
end;
You need to apply this to your chart and look at the output.
Then exception occurs when going beyond type double. You have a complex statement, exp is calculated twice. You can use the following script to track the exception:
once cleardebug;
once for value1 = 0 to 10 begin
value2 = expvalue(expvalue(value1));
print("n = ", value1, "; exp(exp) = ", value2);
end;
You need to apply this to your chart and look at the output.
Re: 123456*123456 = 15,241,383,936 or -1,938,485,248 ?
Thanks Dave.
Some of the calculated values are indeed huge. I'm figuring out ways to get it around.
Some of the calculated values are indeed huge. I'm figuring out ways to get it around.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times