チケット #39763

different approximation of float in Wind and in Linux

登録: 2019-11-15 07:43 最終更新: 2019-11-15 23:28

報告者:
担当者:
(未割り当て)
チケットの種類:
状況:
完了
コンポーネント:
マイルストーン:
(未割り当て)
優先度:
5 - 中
重要度:
5 - 中
解決法:
不正
ファイル:
なし
投票
点数: 0
No votes
0.0% (0/0)
0.0% (0/0)

詳細

Dear developers, when I run the following code:

int x=5; printf ("%d\n" , (int)pow(x,2)); printf ("%d\n" , (int)pow(5,2));

I get different results if working on: - Windows 7 and 10, gcc version: gcc (tdm-1) 5.1.0 from last MinGW was the same some years ago with previous versions: the results are 24 and 25; - Linux, many distro, many gcc versions: the results are 25 and 25. To me, the Windows answer should be the same as the first argument is int 5 in both cases. Could you please give a clarification. I wasn't able to find any justification for my univ. students. Thank you in advance

Claus

チケットの履歴 (2 件中 2 件表示)

2019-11-15 07:43 更新者: claus
  • 新しいチケット "different approximation of float in Wind and in Linux" が作成されました
2019-11-15 23:28 更新者: keith
  • 状況オープン から 完了 に更新されました
  • 解決法なし から 不正 に更新されました
コメント

Hello Claus,

I have three comments:

  • Firstly, this is neither a bug report, nor a feature request; it is a support request, (for which use of this ticket system is not appropriate); as such it should have been directed to the mailing list, where it would attain better exposure, and have a greater chance of attracting a fruitful discussion, (which it will not achieve here).
  • Secondly, the compiler you are using is badged as a TDM release, which is not a genuine MinGW.org product. Indeed, the TDM distributor is not authorized to use the MinGW trademark, so describing the TDM product as "MinGW" is, technically, a trademark infringement.
  • Finally, I've compiled your code fragment, (with addition of appropriate header files, and wrapping it within a main function), using my genuine (albeit experimental) MinGW build of GCC-9.2, (built as a Linux hosted cross-compiler), with mingwrt-5.2.2 and w32api-5.2.2, and running under Wine-4.18, I cannot reproduce your issue ... I see results of 25 in both cases.

添付ファイルリスト

添付ファイルはありません

編集

このチケットにコメントを追加するには、ログインが必要です » ログインする