- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
With the following code:
program main
implicit none
integer :: ivert, nvert, nxy
integer, parameter :: nequ = 24
real(8), parameter :: pi = 4E0_8 * atan(1E0_8)
real(8) :: angz, scalexy
nvert = nequ / 2
do ivert = 0, nvert
angz = dble(ivert) / nvert * pi
scalexy = dsin(angz)
nxy = int(nequ * scalexy)
if (scalexy > 0.49 .and. scalexy < 0.51) &
print *, nxy, scalexy
end do
end program main
Ifort, run as:
$ ifort -O3 test.f90 -o ifort && ./ifort
prints:
11 0.500000000000000
11 0.500000000000000
At the same, ifx, run as:
$ ifx -O3 test.f90 -o ifx && ./ifx
prints:
11 0.500000000000000
12 0.500000000000000
With `ifort -Ofast`, I can achieve the same output as for `ifx -O3`:
$ ifort -Ofast test.f90 -o ifort && ./ifort
The output:
11 0.500000000000000
12 0.500000000000000
Used versions:
$ ifort --version -diag-disable=10448
ifort (IFORT) 2021.12.0 20240222
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.
$ ifx --version
ifx (IFX) 2024.1.0 20240308
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Different optimizer. -Ofast is only there because gcc has it. According to the docs, "It sets compiler options -O3, -no-prec-div, and -fp-model fast=2." Modifying the code to show the hex values, I get:
ifx -O3:
11 0.500000000000000 3FDFFFFFFFFFFFFF
12 0.500000000000000 3FE0000000000003
ifort -Ofast
11 0.500000000000000 3FDFFFFFFFFFFFFF
11 0.500000000000000 3FDFFFFFFFFFFFFF
I have not investigated further.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page