14
void Foo(float a){} //1
void Foo(double a){} //2 overloaded
Foo(1.0f); //calls function 1
Foo(1.0 /*double numeric suffix?*/); //calls function 2
如果不是,是否可以實現這一目標?我主要興趣在 某些操作過程中確保雙精度數學等:在操作過程中是否有指定雙精度的數字後綴?
ulong j;
double v;
j = /*some value*/;
if(j>0UL)
v = 1.0/j; //if 1.0 is set as a float by the compiler then
//could it be likely we lose some precision here
//if a double would allow for more precision? Is
//a cast the only means of ensuring double precision?
其他技巧上讓編譯器自動確定類型將是有益的。
準確地說,我需要的信息。謝謝。 – BuckFilledPlatypus 2009-10-07 23:05:05