- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to input the machine precision information for numerical routines I'm compiling using Win32. I'm running an i7-2600K which I assume follows the standards set forward
in the document on
http://download.intel.com/design/processor/manuals/253665.pdf pages 4-5
through page 4-9.
If someone could ensure I've input correct values, it would help greatly.
From an initial reoutine
C Words:
C I1MACH( 5) = the number of bits per integer storage unit.
DATA IMACH( 5) / 32 /
C I1MACH( 6) = the number of characters per integer storage unit.
DATA IMACH( 6) / 4 /
C Integers:
C I1MACH( 7) = A, the base.
DATA IMACH( 7) / 2 /
C I1MACH( 8) = S, the number of base-A bits.
DATA IMACH( 8) / 15 /
C I1MACH( 9) = A**S - 1, the largest magnitude.
DATA IMACH( 9) / 32767 /
C Floating Point:
C I1MACH(10) = B, the base.
DATA IMACH(10) / 2 /
C Single-Precision Floating Point:
C I1MACH(11) = T, the number of base-B bits.
DATA IMACH(11) / 31 /
C I1MACH(12) = EMIN, the smallest exponent E.
DATA IMACH(12) / -126 /
C I1MACH(13) = EMAX, the largest exponent E.
DATA IMACH(13) / 127 /
C Double-Precision Floating Point:
C I1MACH(14) = T, the number of base-B bits.
DATA IMACH(14) / 63 /
C I1MACH(15) = EMIN, the smallest exponent E.
DATA IMACH(15) / -1022 /
C I1MACH(16) = EMAX, the largest exponent E.
DATA IMACH(16) / 1023 /
C
No problem with the compilation of this rountine
From a routine associated with single-precision floating point operations
C R1MACH(1) = B**(EMIN-1), the smallest positive magnitude.
C EQUIVALENCE (RMACH(1),SMALL(1))
C INTEGER SMALL(2)
DATA SMALL(1) / 1.18E-38 /
C R1MACH(2) = B**EMAX*(1 - B**(-T)), the largest magnitude.
C EQUIVALENCE (RMACH(2),LARGE(1))
C INTEGER LARGE(2)
DATA LARGE(1) / 1.70E+38 /
C
This rountine has the following error durint compilation:
"r1mach.f(121): error #6906: The value of the integer is either too great or too small, and overflow/underflow occurred. [1.70E+38]"
so it isn't happy with value of "large(1)" I given to it.
Thanks for any help you can provide.
If someone could ensure I've input correct values, it would help greatly.
From an initial reoutine
C Words:
C I1MACH( 5) = the number of bits per integer storage unit.
DATA IMACH( 5) / 32 /
C I1MACH( 6) = the number of characters per integer storage unit.
DATA IMACH( 6) / 4 /
C Integers:
C I1MACH( 7) = A, the base.
DATA IMACH( 7) / 2 /
C I1MACH( 8) = S, the number of base-A bits.
DATA IMACH( 8) / 15 /
C I1MACH( 9) = A**S - 1, the largest magnitude.
DATA IMACH( 9) / 32767 /
C Floating Point:
C I1MACH(10) = B, the base.
DATA IMACH(10) / 2 /
C Single-Precision Floating Point:
C I1MACH(11) = T, the number of base-B bits.
DATA IMACH(11) / 31 /
C I1MACH(12) = EMIN, the smallest exponent E.
DATA IMACH(12) / -126 /
C I1MACH(13) = EMAX, the largest exponent E.
DATA IMACH(13) / 127 /
C Double-Precision Floating Point:
C I1MACH(14) = T, the number of base-B bits.
DATA IMACH(14) / 63 /
C I1MACH(15) = EMIN, the smallest exponent E.
DATA IMACH(15) / -1022 /
C I1MACH(16) = EMAX, the largest exponent E.
DATA IMACH(16) / 1023 /
C
No problem with the compilation of this rountine
From a routine associated with single-precision floating point operations
C R1MACH(1) = B**(EMIN-1), the smallest positive magnitude.
C EQUIVALENCE (RMACH(1),SMALL(1))
C INTEGER SMALL(2)
DATA SMALL(1) / 1.18E-38 /
C R1MACH(2) = B**EMAX*(1 - B**(-T)), the largest magnitude.
C EQUIVALENCE (RMACH(2),LARGE(1))
C INTEGER LARGE(2)
DATA LARGE(1) / 1.70E+38 /
C
This rountine has the following error durint compilation:
"r1mach.f(121): error #6906: The value of the integer is either too great or too small, and overflow/underflow occurred. [1.70E+38]"
so it isn't happy with value of "large(1)" I given to it.
Thanks for any help you can provide.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I recall that someone may have written these widely used subroutines in Fortran 90.
How about
SMALL(1) = TINY(1.)
LARGE(1)=HUGE(1.)
I suppose these intrinsics should work in DATA statements since f2003.
The values EMIN, EMAX need to be increased by 1 for IEEE floating point format IIRC. Take a look at www.ee.ucla.edu/~vandenbe/103/lectures/flpt.pdf
How about
SMALL(1) = TINY(1.)
LARGE(1)=HUGE(1.)
I suppose these intrinsics should work in DATA statements since f2003.
The values EMIN, EMAX need to be increased by 1 for IEEE floating point format IIRC. Take a look at www.ee.ucla.edu/~vandenbe/103/lectures/flpt.pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem with these routines that try to determine precision is that they can fall afoul of compiler optimizations, precision extensions and more. Fortran 90 defines a large number of intrinsic functions for these values which are properly hard-coded in the compiler. Please use these intead of the routines.

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