forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Limitation for binary output of 64-bit integers?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
jlb



Joined: 21 Oct 2020
Posts: 5

PostPosted: Thu Oct 22, 2020 11:34 am    Post subject: Limitation for binary output of 64-bit integers? Reply with quote

Only the first 32 least significant bits of KIND=4 integers are printed out while using B64 FORMAT descriptor.
Code:
PROGRAM bin
INTEGER(KIND=4),PARAMETER :: i=-1
  WRITE(*,*) i
  WRITE(*,'(1X,B64.64)') i
  WRITE(*,*) HUGE(i)
  WRITE(*,'(1X,B64.64)') HUGE(i)
END PROGRAM bin

produces this output:
    -1
    0000000000000000000000000000000011111111111111111111111111111111
    9223372036854775807
    0000000000000000000000000000000011111111111111111111111111111111

Is there a limitation by norm?

Nota:

Same results using Win32 and x64 versions
Compiler Version 8.61
Compiler options: /LINK resp. /64 /LINK


Last edited by jlb on Thu Oct 22, 2020 2:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 378
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Thu Oct 22, 2020 12:55 pm    Post subject: Reply with quote

There does appear to be an issue. An alternative compiler returns:

Quote:
-1
1111111111111111111111111111111111111111111111111111111111111111
9223372036854775807
0111111111111111111111111111111111111111111111111111111111111111


One for Paul or Robert methinks.
Back to top
View user's profile Send private message Visit poster's website
mecej4



Joined: 31 Oct 2006
Posts: 1429

PostPosted: Thu Oct 22, 2020 2:01 pm    Post subject: Reply with quote

With bug reports of this nature, it will be helpful if the OP reports, in addition:

(i) whether a 32-bit or 64-bit executable, or both, exhibit(s) the described behaviour,

(ii) the compiler version used,

(iii) the compiler options used.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6590
Location: Salford, UK

PostPosted: Fri Oct 23, 2020 8:51 am    Post subject: Reply with quote

jib

Thank you for the feedback. I have logged this failure.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 378
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Fri Oct 23, 2020 9:49 am    Post subject: Reply with quote

Paul, I looked at this a bit more last night and this may help. Everything is ok up to and including i = 4294967295

Code:
winapp
program bin
implicit none
integer(kind=4)i
integer k
  i = 4294967290_4
 
  do k = 1, 10
    print*
    write(*,'(I12,5X,B0)') i,i
    i = i + 1
  end do
 
end program bin
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6590
Location: Salford, UK

PostPosted: Fri Oct 23, 2020 11:07 am    Post subject: Reply with quote

Thanks Ken.

I now have a fix that just needs testing.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6590
Location: Salford, UK

PostPosted: Fri Oct 23, 2020 1:05 pm    Post subject: Reply with quote

This bug has now been fixed for the next release of the DLLs.
Back to top
View user's profile Send private message AIM Address
jlb



Joined: 21 Oct 2020
Posts: 5

PostPosted: Fri Oct 23, 2020 3:44 pm    Post subject: Reply with quote

Paul
Thanks a lot for the rapid treating of this issue.

Kenneth
I am sorry for having been imprecise with "only the first 32 least significant bits are printed out". I implied herewith that the bit representation of positive integers up to 2^32 -1 is correct. Thanks for the trial on an alternative compiler.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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