BUG: FOR2932 Error in Round or Truncate of Extra Digits

ID: Q147758

4.00    | 4.00
WINDOWS | WINDOWS NT kbprg kbbuglist

The information in this article applies to:

SYMPTOMS

The following error message may be generated by the compiler when it initializes a REAL*4 variable with a constant near the maximum values allowed for REAL*4 numbers.

   error FOR2932: single-precision REAL literal constant out of range

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The maximal values of single precision negative numbers is in the range of -3.4028235E+38 to -1.1754944E-38 and for single-precision positive numbers is in the range of +1.1754944E-38 to +3.4028235E+38.

The following code demonstrates the problem.

Sample Code

C Compile options needed: none

      real*4 x1

      x1 = huge(1.0)
      write (*,100) x1
      x1 = 3.402823466385288787198009999e38      ! in range here.
      write (*,100) x1
      x1 = 3.4028234663852887871980100e38        ! out of range here.
      write (*,100) x1
      x1 = 3.4028234663852887871989999e38        ! to here.
      write (*,100) x1
      x1 = 3.4028234663852887871990e38           ! in range here
      write (*,100) x1
      x1 = 3.4028234663852887871990099999999e38  ! to here.
      write (*,100) x1
      x1 = 3.40282346638528878719901e38          ! then out of range here.
      write (*,100) x1
100 format (e16.9)
      end

Additional reference words: 4.00 KBCategory: kbprg kbbuglist KBSubcategory: FORTLngIss
Keywords          : kbFortranPS kbLangFortran kbbuglist
Version           : 4.00    | 4.00
Platform          : NT WINDOWS

Last Reviewed: March 3, 1996