DATA Step, Macro, Functions and more

Binary format. What happens at W=61.

Reply
Respected Advisor
Posts: 3,777

Binary format. What happens at W=61.

I don't have math or computer science training and I don't understand what happens at W=61.  Or do I just have it all wrong?

27         data _null_;
28            length x $64;
29            a=1;
30            do w=1 to 64;
31               x=putn(a,'binary',w);
32               put w 2. +1 x $char64.-r;
33               end;
34            run;

1                                                                1
2                                                               01
3                                                              001
4                                                             0001
5                                                            00001
6                                                           000001
7                                                          0000001
8                                                         00000001
9                                                        000000001
10                                                       0000000001
11                                                      00000000001
12                                                     000000000001
13                                                    0000000000001
14                                                   00000000000001
15                                                  000000000000001
16                                                 0000000000000001
17                                                00000000000000001
18                                               000000000000000001
19                                              0000000000000000001
20                                             00000000000000000001
21                                            000000000000000000001
22                                           0000000000000000000001
23                                          00000000000000000000001
24                                         000000000000000000000001
25                                        0000000000000000000000001
26                                       00000000000000000000000001
27                                      000000000000000000000000001
28                                     0000000000000000000000000001
29                                    00000000000000000000000000001
30                                   000000000000000000000000000001
31                                  0000000000000000000000000000001
32                                 00000000000000000000000000000001
33                                000000000000000000000000000000001
34                               0000000000000000000000000000000001
35                              00000000000000000000000000000000001
36                             000000000000000000000000000000000001
37                            0000000000000000000000000000000000001
38                           00000000000000000000000000000000000001
39                          000000000000000000000000000000000000001
40                         0000000000000000000000000000000000000001
41                        00000000000000000000000000000000000000001
42                       000000000000000000000000000000000000000001
43                      0000000000000000000000000000000000000000001
44                     00000000000000000000000000000000000000000001
45                    000000000000000000000000000000000000000000001
46                   0000000000000000000000000000000000000000000001
47                  00000000000000000000000000000000000000000000001
48                 000000000000000000000000000000000000000000000001
49                0000000000000000000000000000000000000000000000001
50               00000000000000000000000000000000000000000000000001
51              000000000000000000000000000000000000000000000000001
52             0000000000000000000000000000000000000000000000000001
53            00000000000000000000000000000000000000000000000000001
54           000000000000000000000000000000000000000000000000000001
55          0000000000000000000000000000000000000000000000000000001
56         00000000000000000000000000000000000000000000000000000001
57        000000000000000000000000000000000000000000000000000000001
58       0000000000000000000000000000000000000000000000000000000001
59      00000000000000000000000000000000000000000000000000000000001
60     000000000000000000000000000000000000000000000000000000000001
61    1111111110000000000000000000000000000000000000000000000000000
62   11111111110000000000000000000000000000000000000000000000000000
63  011111111110000000000000000000000000000000000000000000000000000
64 0011111111110000000000000000000000000000000000000000000000000000
Super User
Super User
Posts: 6,502

Re: Binary format. What happens at W=61.

You start displaying the exponent in addition to the mantissa of the floating point value.

Compare the result of

PUT A HEX16. ;

With the last row of your report.

3FF0000000000000

Super User
Posts: 6,948

Re: Binary format. What happens at W=61.

But why does it start to display the mantissa at row 61 instead of row 53?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 2 replies
  • 200 views
  • 0 likes
  • 3 in conversation