Why go through the trouble of static_cast-ing a number to a double?

Ran across this in code I'm working through:

double part2 = static_cast<double>(2) * somthing1
  * ( static_cast<double>(1) + something2 )
  + ( static_cast<double>(1) / static_cast<double>(2) ) * something3
  + ( static_cast<double>(1) / static_cast<double>(2) ) * pow ( something4, 3 );

(The somethings are doubles.)

I suspect that there's a really good reason for going through the trouble of doing

static_cast(1)

and the like, but it seems like I could get by with a lot less typing.

What am I not understanding?

Thanks in advance.

6
задан John 23 March 2011 в 22:15
поделиться