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.

Problem using dble intrinsic

leo1
Beginner
410 Views
I realized an annoying issue using the intrinsic dble conversion.

Instead of adding zeros, it is adding random numbers to the simple precision variables:

dble(0.2000000)=0.200000082630871

instead of

dble(0.2000000)=0.200000000000000

Is there a compiler option in order to avoid that behavior ? Since I cannot avoid to import these simple precision numbers and convert them, I need to find a solution.

Thanks !
0 Kudos
1 Reply
TimP
Honored Contributor III
410 Views
The compiler gives you the double precision value which will produce
(0.2 == dble(0.2)) .eqv. .true.
as the Fortran standard requires. If you want the value 0.2d0, that is a different value.
Wholesale promotion options like -r8 may do what you want in this case.
0 Kudos
Reply