1 | |
---|
2 | |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
4 | <head> |
---|
5 | <title>binary.pro (SAXO Documentation Assistant)</title> |
---|
6 | </head> |
---|
7 | |
---|
8 | <body text="#000000" bgcolor="#FFFFFF"> |
---|
9 | |
---|
10 | |
---|
11 | <!-- Navbar template takes a structure with the following fields: |
---|
12 | overview_href : |
---|
13 | overview_selected : |
---|
14 | dir_overview_href : |
---|
15 | dir_overview_selected : |
---|
16 | categories_href : |
---|
17 | categories_selected : |
---|
18 | index_href : |
---|
19 | index_selected : |
---|
20 | search_href : |
---|
21 | search_selected : |
---|
22 | file_selected : |
---|
23 | source_href : |
---|
24 | source_selected : |
---|
25 | help_href : |
---|
26 | help_selected : |
---|
27 | etc_selected : |
---|
28 | |
---|
29 | prev_file_href : |
---|
30 | next_file_href : |
---|
31 | |
---|
32 | view_single_page_href : |
---|
33 | view_frames_href : |
---|
34 | |
---|
35 | summary_fields_href : |
---|
36 | summary_routine_href : |
---|
37 | details_routine_href : |
---|
38 | |
---|
39 | title : |
---|
40 | subtitle : |
---|
41 | user : |
---|
42 | --> |
---|
43 | |
---|
44 | |
---|
45 | <table border="0" cellpadding="0" cellspacing="0" width="98%" bgcolor="#F0F0FF" valign="bottom"> |
---|
46 | <tr> |
---|
47 | <td width="10%"> |
---|
48 | <a href=""><img src="./../../prev.gif" border="0" alt="Previous"></a></td> |
---|
49 | <td width="80%" align="center" valign="center"> |
---|
50 | <font size=-1><i>SAXO Documentation Assistant</i>: <a href="./../../home.html">Overview</a></font></td> |
---|
51 | <td width="10%" align="right"> |
---|
52 | <a href="changeread.html"><img src="./../../next.gif" border="0" alt="Next"></a></td> |
---|
53 | </tr> |
---|
54 | </table> |
---|
55 | |
---|
56 | |
---|
57 | <h1><font size="-2">ToBeReviewed/LECTURE/</font></h1> |
---|
58 | <h2>binary.pro</h2> |
---|
59 | |
---|
60 | <dl> |
---|
61 | </dl> |
---|
62 | |
---|
63 | |
---|
64 | Returns the binary representation of a number of any numerical type. |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | |
---|
70 | <a name="#_binary"></a> |
---|
71 | |
---|
72 | <h2>binary </h2> |
---|
73 | |
---|
74 | <p><font face="Courier"><i>result = </i>binary(<i><a href="#_binary_keyword_number">number</a></i>)</font></p> |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | <h3>Return value</h3> |
---|
80 | Byte array with binary representation of numbers. |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | <h3>Parameters</h3> |
---|
85 | |
---|
86 | |
---|
87 | <a name="#_binary_keyword_number"></a> |
---|
88 | <h4>number |
---|
89 | <font size="-1" color="#006633">in</font> |
---|
90 | |
---|
91 | |
---|
92 | <font size="-1" color="#006633">required</font> |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | </h4> |
---|
98 | |
---|
99 | |
---|
100 | scalar or array of numbers (any numerical type) |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | <h3>Examples</h3><pre> |
---|
108 | |
---|
109 | Binary representation of 11b: |
---|
110 | IDL> print, binary(11b) |
---|
111 | 0 0 0 0 1 0 1 1 |
---|
112 | |
---|
113 | Binary representation of pi (x86: Little-endian IEEE representation): |
---|
114 | IDL> print, format='(z9.8,5x,4(1x,8i1))', long(!pi,0), binary(!pi) |
---|
115 | 40490fdb 01000000 01001001 00001111 11011011 (x86 Linux) |
---|
116 | 0fdb4149 00001111 11011011 01000001 01001001 (Alpha OpenVMS) |
---|
117 | IDL> print, format='(8(1x,8i0))', binary(!dpi) |
---|
118 | 01000000 00001001 00100001 11111011 01010100 01000100 00101101 00011000 |
---|
119 | |
---|
120 | Some first tests before type double was added: |
---|
121 | IDL> print, format='(2a6,4x,2z9.8,4x,8z3.2)', $ |
---|
122 | !version.arch, !version.os, long(!dpi,0,2), byte(!dpi,0,8) |
---|
123 | x86 linux 54442d18 400921fb 18 2d 44 54 fb 21 09 40 |
---|
124 | sparc sunos 400921fb 54442d18 40 09 21 fb 54 44 2d 18 |
---|
125 | alpha vms 0fda4149 68c0a221 49 41 da 0f 21 a2 c0 68 |
---|
126 | (Beginning with IDL 5.1, Alpha VMS uses IEEE representation as well.) |
---|
127 | |
---|
128 | </pre><h3>Version history</h3> |
---|
129 | |
---|
130 | <h4>Version</h4> |
---|
131 | $Id: binary.pro 371 2008-08-07 09:32:02Z pinsard $ |
---|
132 | |
---|
133 | <h4>History</h4> |
---|
134 | 19 Dec 1997 Originally a news posting by David Fanning. |
---|
135 | (Re: bits from bytes) |
---|
136 | 20 Dec 1997 "Complete" rewrite: eliminate loops. |
---|
137 | 22 Dec 1997 Bit shift instead of exponentiation, return byte |
---|
138 | array, handle input arrays. |
---|
139 | Think about double and complex types. |
---|
140 | 22 Sep 1998 Complete rewrite: reduce every numerical type to |
---|
141 | single bytes. Check that big and little endian machines |
---|
142 | return exactly the same results (if IEEE). |
---|
143 | 7 May 2003 Added newish data types, unsigned and long64. BT |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | |
---|
154 | |
---|
155 | |
---|
156 | |
---|
157 | |
---|
158 | |
---|
159 | |
---|
160 | |
---|
161 | <font size="-3"><p> </p></font> |
---|
162 | <hr size="1" color="#CCCCCC"/> |
---|
163 | |
---|
164 | |
---|
165 | |
---|
166 | |
---|
167 | <p><font color="gray" size="-3"> Produced by IDLdoc 2.0.</font></p> |
---|
168 | |
---|
169 | </body> |
---|
170 | </html> |
---|