- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 !
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 !
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.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.

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