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 

Displaying integers in binary representation.

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





PostPosted: Wed Jun 21, 2006 4:38 am    Post subject: Displaying integers in binary representation. Reply with quote

Hello again,

I just discovered some other weird thing, when trying to display integer values in binary form.
Consider first program 1:
Code:

PROGRAM MAIN
INTEGER*4:: i1=0,i2=1,i3=-1,i4=HUGE(i4),i5=-HUGE(i5),i6=31,p2
!INTEGER*8:: i1=0,i2=1,i3=-1,i4=HUGE(i4),i5=-HUGE(i5),i6=63,p2
OPEN(7,FILE='I:FTN95test.txt')
WRITE(7,900) i1,i1,i1
WRITE(7,900) i2,i2,i2
WRITE(7,900) i3,i3,i3
WRITE(7,900) i4,i4,i4
WRITE(7,900) i5,i5,i5
WRITE(7,*)
p2=1
DO i=1,i6-1
p2=2_4*p2
WRITE(7,900) p2,p2,p2
END DO
WRITE(7,*)
p2=-1
DO i=1,i6
p2=2_4*p2
WRITE(7,900) p2,p2,p2
END DO
CLOSE(7)
900 FORMAT((B32,' ',Z8 ,' ',I11))
!900 FORMAT((B64,' ',Z16,' ',I20))
END

The output of this program is:
Code:

0 0 0
1 1 1
11111111111111111111111111111111 FFFFFFFF -1
1111111111111111111111111111111 7FFFFFFF 2147483647
10000000000000000000000000000001 80000001 -2147483647

10 2 2
100 4 4
1000 8 8
10000 10 16
100000 20 32
1000000 40 64
10000000 80 128
100000000 100 256
1000000000 200 512
10000000000 400 1024
100000000000 800 2048
1000000000000 1000 4096
10000000000000 2000 8192
100000000000000 4000 16384
1000000000000000 8000 32768
10000000000000000 10000 65536
100000000000000000 20000 131072
1000000000000000000 40000 262144
10000000000000000000 80000 524288
100000000000000000000 100000 1048576
1000000000000000000000 200000 2097152
10000000000000000000000 400000 4194304
100000000000000000000000 800000 8388608
1000000000000000000000000 1000000 16777216
10000000000000000000000000 2000000 33554432
100000000000000000000000000 4000000 67108864
1000000000000000000000000000 8000000 134217728
10000000000000000000000000000 10000000 268435456
100000000000000000000000000000 20000000 536870912
1000000000000000000000000000000 40000000 1073741824

11111111111111111111111111111110 FFFFFFFE -2
11111111111111111111111111111100 FFFFFFFC -4
11111111111111111111111111111000 FFFFFFF8 -8
11111111111111111111111111110000 FFFFFFF0 -16
11111111111111111111111111100000 FFFFFFE0 -32
11111111111111111111111111000000 FFFFFFC0 -64
11111111111111111111111110000000 FFFFFF80 -128
11111111111111111111111100000000 FFFFFF00 -256
11111111111111111111111000000000 FFFFFE00 -512
11111111111111111111110000000000 FFFFFC00 -1024
11111111111111111111100000000000 FFFFF800 -2048
11111111111111111111000000000000 FFFFF000 -4096
11111111111111111110000000000000 FFFFE000 -8192
11111111111111111100000000000000 FFFFC000 -16384
11111111111111111000000000000000 FFFF8000 -32768
11111111111111110000000000000000 FFFF0000 -65536
11111111111111100000000000000000 FFFE0000 -131072
11111111111111000000000000000000 FFFC0000 -262144
11111111111110000000000000000000 FFF80000 -524288
11111111111100000000000000000000 FFF00000 -1048576
11111111111000000000000000000000 FFE00000 -2097152
11111111110000000000000000000000 FFC00000 -4194304
11111111100000000000000000000000 FF800000 -8388608
11111111000000000000000000000000 FF000000 -16777216
111111100000000000
Back to top
Anonymous
Guest





PostPosted: Wed Jun 21, 2006 4:51 am    Post subject: Displaying integers in binary representation. Reply with quote

A bit of topic, but anyway:

It's a pity that leading blanks are ignored in the postings.
In this way any indentation (for programs) and alignment (for results) gets lost, which makes some postings hard to read.
I don't know whether or not there is a way around this.
Back to top
PaulLaidler
Site Admin


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

PostPosted: Wed Jun 21, 2006 10:03 am    Post subject: Displaying integers in binary representation. Reply with quote

Lucas

As I mentioned before, the explanation is that FTN95 does not yet fully support INTEGER*8.
I will add the B64 "bug" to the list of things to do.
Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Wed Jun 21, 2006 10:18 am    Post subject: Displaying integers in binary representation. Reply with quote

Thanks very much again, Paul!

I understand that FTN95 does not yet fully support INTEGER*8 variables, but I thought it was best in the interest of everybody to mention "strange behaviour" of the compiler in this area.
Keep up the good work!

Kind regards,
Lucas.
Back to top
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