作者:
newlymoon (NEWLYMOON)
2018-05-24 11:40:38開發平台(Platform): (Ex: Win10, Linux, ...)
win7 64bit
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
VC2005
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
使用math.h的sqrt(),但回傳值錯誤,ex:sqrt(25.0)=1057620607
不過如果把sqrt()再包過一層,其回傳值就會正確,ex:fsqrt(25.0)=5
餵入的資料(Input):
25
預期的正確結果(Expected Output):
5
錯誤結果(Wrong Output):
1057620607
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
double fsqrt(double x)
{
return sqrt(x);
}
補充說明(Supplement):