 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
KennyT
Joined: 02 Aug 2005 Posts: 318
|
Posted: Wed Apr 10, 2013 3:24 pm Post subject: Arithmetic error trapping |
|
|
I'm passing this on for interest, because it doesn't happen in a "pure" FTN95 application...
We provided DLLs to be called from a 3rd-party application, and got an "arithmetic under/overflow error" condition when run under their app. Further investigation showed that the error occurs in the MOD function when mixed integer types are involved:
Code: | INTEGER*8 :: I8
INTEGER*4 :: I4,K4
K4 = MAX(1,K4)
I4 = I8
IF( MOD(I4,K4).EQ.0) THEN ! This works but...
IF( MOD(I8,K4).EQ.0) THEN ! This can cause an arithmetic error under 3rd party app
|
As I say, only passed on in case others hit the same issue, as it's not reproducible from an FTN95 EXE.
K |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Wed Apr 10, 2013 5:01 pm Post subject: |
|
|
Interesting observation
The Fortran Standard doesn't allow you use to different integer kinds for each argument of MOD.
I know FTN95 seems to work for some KIND combinations but I always saw this as an extension to the standard. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|