Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Quad precision SPACING intrinsic

Chris_S_
Beginner
879 Views
I believe I have found a bug in the SPACING intrinsic when very small quad precision numbers are used. I am using version 10.1 of the linux 64 compiler, so if bug has already been fixed, please disregard this post.

It appears that when the true spacing between quad precision numbers falls below TINY, SPACING returns a nonsensical very large value. For example, SPACING(1Q-4898) = 3.362Q-4932 (equal to TINY), while SPACING(1Q-4899) = 1.487Q+4931 (notice the positive exponent). I even find SPACING(0Q0) = 4.583Q+4898.

A test program and output are attached.
0 Kudos
3 Replies
Steven_L_Intel1
Employee
879 Views
Your test program behaves correctly with the 12.0.3 compiler.
0 Kudos
mecej4
Honored Contributor III
879 Views
> For example, SPACING(1Q-4898) = 3.362Q-4932 (equal to TINY)

This is correct, since SPACING(x) = TINY for | x | < TINY. In other words, SPACING gives only normalized numbers.
0 Kudos
Chris_S_
Beginner
879 Views
Quoting mecej4
> For example, SPACING(1Q-4898) = 3.362Q-4932 (equal to TINY)

This is correct, since SPACING(x) = TINY for | x | < TINY. In other words, SPACING gives only normalized numbers.

mecej4: I understand that is what it should give, but SPACING(x) was not giving TINY for |x| < 2^110*TINY, it was instead giving something closer to HUGE. In any case, according to Steve Lionel's post, this issue appears to have been fixed in more recent releases (thanks, Steve!).
0 Kudos
Reply