Using StrToDouble to try and get a numerical value back from a string

 

I think this might be a long way round a problem.

I have iSAR(NULL,0,0.02,0.2,0) which I want to display in a comment,

so I make it a string (to get precision to 5 decimal places) I use DoubleToStr(SARba,5); (where SARba = iSAR(NULL,0,0.02,0.2,0) )

I need to use this value as a number (to five decimal places) so I try to use StrToDouble to change it back from the string that DoubleToStr produces, but I get 0 returned

I also tried using double NSAR = NormalizeDouble(SARba,5); where SARba= iSAR(NULL,0,0.02,0.2,0) but this just returns the value to four decimal places.

.

How can I change a string value (eg 1.37654) back to a double ?


thankyou

 

NormalizeDouble()

i'm strongly recommend to start here there is no shortcuts

 
qjol:

NormalizeDouble()

i'm strongly recommend to start here there is no shortcuts


Hi thanks I have that book already and I am working from it, have been for the past week or so. Im not looking for shortcuts, I am working hard on this and I have learned a lot over the past week, it is just putting it together that is difficult, the where and when. I have never programmed before.

NormalizeDouble only returns to 4 digits when I need and specify 5.

 

can u help me out & tell me what is the value of A

string A = NormalizeDouble(iSAR(NULL,0,0.02,0.2,0),8);
Alert (A);
 
qjol:

can u help me out & tell me what is the value of A

thanks for that

.

1.37796975 but as a "double" it is only 1.3779

I can have it as string fine using - string SARa = DoubleToStr(iSAR(NULL,0,0.02,0.2,0),5);

But I need iSAR(NULL,0,0.02,0.2,0) as a double to 5 digits :-)

.

so I need to convert the string to the double, or find a way of getting a double (to 5 digits) from (iSAR(NULL,0,0.02,0.2,0),5)

 

You should know that internally double uses always maximum precision. But it will print only 4 digits. So internally your calculations are reliable.

 
zzuegg:

You should know that internally double uses always maximum precision. But it will print only 4 digits. So internally your calculations are reliable.



Oh ok thankyou very much for that I will try and proceed now.