convert decimal to pips (and string)

 
 
fxnew:

here's the question:

s,

how can a double (i.e. Bid, Close[0] ...) be converted to pips?

Let's say:

1)

double a= 1.0324 (and the last 3 pips should be used only)

now for example in order to use (by extracting or truncating et.) just the last 3 figures (=pips) ... here 324, how can this be done

2) how can this be done if one has the fractional pips format 1.03245 ! and want the (important) digits 324 extracted only (neglecting the fifth digit)??


3) I guess after getting a pips number/value by steps 1) or 2) a conversion to string could be by typecasting as follows:

string resulttext = b; // b should be the pips-result by steps 1) or 2)


thanks in advance

 

case:

extern int MyDigits = 4;

double a = 1.03245; // target = 324:

int ai = a;

a = a - ai; //0.03245

ai = a * MathPow(10,myDigits); // 324 :)

 
Thing is you can always get round any number related mumbo jumbo, but my question is, why go around it? Work with it, make it your friend! Stop thinking in 324 pips, think in 3240 (tenths of) pips * Digits.
Reason: