Overloaded function not returning expected value

 

Hello,

I have the following overloaded function:

double normalize(const double price,const bool normalized)
  {
   return normalize(price,normalized,0);
  }

double normalize(const double price,const bool normalized,const int digits_delta)
  {
   double value=0.0;

   if(normalized)
     {
      const int digits=(int)_Digits+digits_delta;
      value=NormalizeDouble(price,digits);
     }

   return value;
  }

But when I call it using the following command:

   PrintFormat("normalize=%f",normalize(123.456,false));

I get 0.0000000 returned and I can't see why.

Could someone hightlight my error. 

Thanks in advance.

 
imamushroom:

Hello,

I have the following overloaded function:

But when I call it using the following command:

I get 0.0000000 returned and I can't see why.

Could someone hightlight my error. 

Thanks in advance.

What do you expect to recieve? "0.0"?
 
Sergey Genikhov:
What do you expect to recieve? "0.0"?

No, I expect to get 123.456.

 
imamushroom:

Hello,

I have the following overloaded function:

But when I call it using the following command:

I get 0.0000000 returned and I can't see why.

Could someone hightlight my error. 

Thanks in advance.

if(normalized)
     {
     }

it will return value different from 0 only if you use true for normalized parameter

 
Mladen Rakic:

it will return value different from 0 only if you use true for normalized parameter

Thank you.

I should have put 

   double value=price;

in the first place. Silly little error!

Thanks again.

Reason: