#39763: different approximation of float in Wind and in Linux Open Date: 2019-11-15 07:43 Last Update: 2019-11-15 07:43 URL for this Ticket: https://osdn.net//projects/mingw/ticket/39763 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39763 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2019-11-15 07:43 Updated by: claus * New Ticket "different approximation of float in Wind and in Linux" created --------------------------------------------------------------------- Ticket Status: Reporter: claus Owner: (None) Type: Issues Status: Open Priority: 5 - Medium MileStone: (None) Component: GCC Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: 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 -- Ticket information of MinGW - Minimalist GNU for Windows project MinGW - Minimalist GNU for Windows Project is hosted on OSDN Project URL: https://osdn.net/projects/mingw/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/mingw/ticket/39763 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39763