Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

write huge

Marat_S_1
Beginner
569 Views

I just have a quick question.

This simple program

[fortran]

program WriteHuge
  implicit none

  print *, huge(0.0d0)
  write(*, *) huge(0.0d0)
  write(*, '(E24.16)') huge(0.0d0)
  write(*, '(E40.20)') huge(0.0d0)

end program WriteHuge

[/fortran]

prints to the console

[fortran]

  1.797693134862316E+308
  1.797693134862316E+308
  0.1797693134862316+309
              0.17976931348623157081+309

[/fortran]

Why there is no 'E' in the last two lines? Is something wrong with the format?

Compiler version: XE 13.1

0 Kudos
1 Solution
Les_Neilson
Valued Contributor II
569 Views

For an explicit format if the value of the exponent is    99 < |exp| < 999   then the E is omitted. (see the help re: format specifications E and D editing)

"print *"  means "list directed format" (basically the compiler can choose the format)

Les

View solution in original post

0 Kudos
3 Replies
Les_Neilson
Valued Contributor II
570 Views

For an explicit format if the value of the exponent is    99 < |exp| < 999   then the E is omitted. (see the help re: format specifications E and D editing)

"print *"  means "list directed format" (basically the compiler can choose the format)

Les

0 Kudos
TimP
Honored Contributor III
569 Views

In order to see the E field when a 3-digit exponent appears, you must specify explicitly a wider exponent field.  The default was set up so that 3-digit exponents would not consume more space in formats set up for 2-digit exponent values.

0 Kudos
Marat_S_1
Beginner
569 Views

Thank you.

0 Kudos
Reply