- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
I feel like I'm missing something very basic. I have created the following test program that is the following 4 lines:
Why does it give me a result of 2 and 3? Shouldn't it be 2 for both parts of the write statement?
Thanks.
Michael
I feel like I'm missing something very basic. I have created the following test program that is the following 4 lines:
program Test
integer :: i = ceiling(2.0d0)
write(6, '(2I)') ceiling(2.0d0), i
end program Test
Why does it give me a result of 2 and 3? Shouldn't it be 2 for both parts of the write statement?
Thanks.
Michael
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it should. This looks like a bug. Thanks. I'll report it. Issue ID is DPD200157393.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, thanks. For a while there, I thought I was going insane.
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue seems to be the use in an "initialization expression". This is evaluated at compile-time and it seems, in this case, incorrectly. This bug has been there a long time, it would seem...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I noticed it was just a problem during initialization. The easy workaround would be to just have the declaration and the initialization as 2 separate steps. The problem we're having with that is that we're trying to use it to initialize a parameter, so we can't break it up.
Thanks.
Michael
Thanks.
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you know that the value is positive, you can substitute this:
int(X - spacing(X)) + 1
It's a bit of a hack but I think it gives the same result. If the value can be negative, then one can be creative like this:
sign(int(abs(X) - spacing(X)) + 1,int(x))
int(X - spacing(X)) + 1
It's a bit of a hack but I think it gives the same result. If the value can be negative, then one can be creative like this:
sign(int(abs(X) - spacing(X)) + 1,int(x))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was fixed in version 12.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Steve!
Michael
Michael
![](/skins/images/71A9511A625CE5D5D45FB59952A4AA71/responsive_peak/images/icon_anonymous_message.png)
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