COMPILATION LISTING OF SEGMENT decimal_sqrt_ Compiled by: Multics PL/I Compiler, Release 28d, of September 14, 1983 Compiled at: Honeywell LCPD Phoenix, System M Compiled on: 10/03/83 1437.7 mst Mon Options: optimize map 1 /* ****************************************************** 2* * * 3* * * 4* * Copyright (c) 1972 by Massachusetts Institute of * 5* * Technology and Honeywell Information Systems, Inc. * 6* * * 7* * * 8* ****************************************************** */ 9 10 decimal_sqrt_: procedure(presult,prdesc,parg,padesc); 11 12 /* procedure to get sqrt(parg) using decimal arithmetic */ 13 14 dcl presult char(1) unal, 15 prdesc bit(36) aligned, 16 parg char(1) unal, 17 padesc bit(36) aligned; 18 19 dcl 1 adesc aligned, /* argument descriptor */ 20 2 flag bit(1) unal, 21 2 type bit(6) unal, 22 2 packed bit(1) unal, 23 2 number_dims bit(4) unal, 24 2 scale bit(12) unal, 25 2 precision bit(12) unal; 26 27 dcl 1 rdesc like adesc aligned; /* result descriptor (full) */ 28 29 dcl desc_fix bit(36) aligned int static init("100100100000000000000000000000000000"b); 30 31 dcl zero char(64) internal static init("+000000000000000000000000000000000000000000000000000000000000000"); 32 dcl azero char(1) unal defined(zero); 33 34 dcl ( addition init(1), 35 subtraction init(2)) fixed bin(17) int static; 36 37 dcl (exp,scale,length,j,n2move) fixed bin(17); 38 dcl aprec fixed bin(17); /* precision of argument */ 39 dcl iprec fixed bin(17); /* precision of i */ 40 dcl rprec fixed bin(17); /* precision of result */ 41 dcl ip1 fixed bin(17); /* short precision of i */ 42 dcl rp1 fixed bin(17); /* short precision of result */ 43 44 dcl ch char(1) aligned; 45 46 dcl (arg,atemp,istring,result) char(64) ; 47 48 dcl ( a defined (arg), 49 at defined (atemp), 50 i defined (istring), 51 r defined (result)) char(1) unal; 52 53 dcl 1 idesc like adesc aligned; 54 dcl 1 idesc1 like adesc aligned; 55 dcl 1 rdesc1 like adesc aligned; 56 57 dcl ( ad based(addr(adesc)), 58 rd based(addr(rdesc)), 59 id based(addr(idesc)), 60 rd1 based(addr(rdesc1)), 61 id1 based(addr(idesc1))) bit(36) aligned; 62 63 dcl ( one init("+1"), 64 two init("+2"), 65 nine init("+9")) char(2) ; 66 67 dcl ( c1 defined(one), 68 c2 defined(two), 69 c9 defined(nine)) char(1) unal; 70 71 dcl cdesc bit(36) aligned int static init("100100100000000000000000000000000001"b); 72 73 /* Function definitions */ 74 75 dcl code_ entry(fixed bin); 76 dcl decimal_op_ entry(fixed bin,char(1),bit(36) aligned,char(1),bit(36) aligned, 77 char(1),bit(36) aligned); 78 79 dcl (addr,bit,divide,fixed,min,mod,substr,unspec) builtin; 80 81 /* */ 82 83 begin: 84 ad = padesc; 85 86 /* Set up argument and descriptors */ 87 88 aprec = fixed(adesc.precision,12); 89 length = aprec + 1; 90 if substr(adesc.type,6,1) then 91 do; /* fixed decimal */ 92 scale = fixed(adesc.scale,12); 93 if scale > 2047 then scale = scale - 4096; 94 exp = -scale; 95 adesc.scale = (12)"0"b; 96 end; 97 else 98 do; /* float decimal */ 99 ch = substr(parg,length+1,1); 100 exp = fixed(unspec(ch),9); 101 if exp >= 128 then exp = exp - 256; 102 substr(adesc.type,5,2) = "01"b; 103 end; 104 105 /* Move decimal point to left end of string */ 106 107 exp = exp + aprec; 108 109 /* Set up precisions and descriptors */ 110 111 rprec = aprec; 112 aprec = min(aprec+2,63); 113 adesc.precision = bit(fixed(aprec,12),12); 114 result, arg = zero; 115 rd = desc_fix; 116 rdesc.precision = bit(fixed(rprec,12),12); 117 118 /* Normalize arg as we move it over */ 119 120 do j = 2 to length while (substr(parg,j,1) = "0"); 121 end; 122 n2move = length + 1 - j; 123 exp = exp - (j-2); 124 if n2move > 0 then substr(arg,2,n2move) = substr(parg,j,n2move); 125 else go to return; 126 if substr(parg,1,1) = "-" then call code_(22); 127 128 /* Finish setting up descriptors */ 129 130 length = aprec + 1; 131 iprec = aprec; 132 id = ad; 133 rd1 = rd; 134 rdesc1.precision = "000000000001"b; 135 rp1 = 1; 136 id1 = id; 137 idesc1.precision = "000000000010"b; 138 ip1 = 2; 139 140 /* Initialize istring to +01000...0 */ 141 142 istring = zero; 143 substr(istring,3,1) = "1"; 144 145 /* Adjust if exponent is odd */ 146 147 if mod(exp,2) ^= 0 then 148 do; 149 exp = exp + 1; 150 idesc1.precision = "000000000001"b; 151 ip1 = 1; 152 substr(istring,2,2) = "10"; 153 end; 154 155 /* Set exponent */ 156 157 exp = divide(exp,2,17,0); 158 159 /* Subtract-loop */ 160 161 sloop: 162 call decimal_op_(subtraction,at,ad,a,ad,i,id); 163 if at = "+" then 164 do; 165 substr(arg,1,length) = substr(atemp,1,length); 166 call decimal_op_(addition,i,id1,i,id1,c2,cdesc); 167 call decimal_op_(addition,r,rd1,r,rd1,c1,cdesc); 168 go to sloop; 169 end; 170 171 /* Shift precisions for next round */ 172 173 rp1 = rp1 + 1; 174 if rp1 <= rprec then 175 do; 176 ip1 = ip1 + 1; 177 idesc1.precision = bit(fixed(ip1,12),12); 178 rdesc1.precision = bit(fixed(rp1,12),12); 179 call decimal_op_(subtraction,i,id1,i,id1,c9,cdesc); 180 iprec = iprec - 1; 181 idesc.precision = bit(fixed(iprec,12),12); 182 go to sloop; 183 end; 184 185 else 186 187 /* Return the result */ 188 189 return: do; 190 exp = exp - rprec; /* Move decimal point back to right end of string */ 191 scale = -exp; 192 if scale < 0 then scale = scale + 4096; 193 rdesc.scale = bit(fixed(scale,12),12); 194 call decimal_op_(addition,presult,prdesc,r,rd,azero,rd); 195 return; 196 end; 197 end; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 10/03/83 1005.8 decimal_sqrt_.pl1 >spec>on>pl128d>decimal_sqrt_.pl1 NAMES DECLARED IN THIS COMPILATION. IDENTIFIER OFFSET LOC STORAGE CLASS DATA TYPE ATTRIBUTES AND REFERENCES (* indicates a set context) NAMES DECLARED BY DECLARE STATEMENT. a defined char(1) unaligned dcl 48 set ref 161* ad based bit(36) dcl 57 set ref 83* 132 161* 161* addition 000030 internal static fixed bin(17,0) initial dcl 34 set ref 166* 167* 194* addr builtin function dcl 79 ref 83 115 132 132 133 133 136 136 161 161 161 166 166 167 167 179 179 194 194 adesc 000100 automatic structure level 1 dcl 19 set ref 83 132 161 161 aprec 000107 automatic fixed bin(17,0) dcl 38 set ref 88* 89 107 111 112* 112 113 130 131 arg 000115 automatic char(64) unaligned dcl 46 set ref 114* 124* 161 161 165* at defined char(1) unaligned dcl 48 set ref 161* 163 atemp 000135 automatic char(64) unaligned dcl 46 ref 161 161 163 163 165 azero defined char(1) unaligned dcl 32 set ref 194* bit builtin function dcl 79 ref 113 116 177 178 181 193 c1 defined char(1) unaligned dcl 67 set ref 167* c2 defined char(1) unaligned dcl 67 set ref 166* c9 defined char(1) unaligned dcl 67 set ref 179* cdesc 000032 internal static bit(36) initial dcl 71 set ref 166* 167* 179* ch 000114 automatic char(1) dcl 44 set ref 99* 100 code_ 000034 constant entry external dcl 75 ref 126 decimal_op_ 000036 constant entry external dcl 76 ref 161 166 167 179 194 desc_fix constant bit(36) initial dcl 29 ref 115 divide builtin function dcl 79 ref 157 exp 000102 automatic fixed bin(17,0) dcl 37 set ref 94* 100* 101 101* 101 107* 107 123* 123 147 149* 149 157* 157 190* 190 191 fixed builtin function dcl 79 ref 88 92 100 113 116 177 178 181 193 i defined char(1) unaligned dcl 48 set ref 161* 166* 166* 179* 179* id based bit(36) dcl 57 set ref 132* 136 161* id1 based bit(36) dcl 57 set ref 136* 166* 166* 179* 179* idesc 000215 automatic structure level 1 dcl 53 set ref 132 136 161 idesc1 000216 automatic structure level 1 dcl 54 set ref 136 166 166 179 179 ip1 000112 automatic fixed bin(17,0) dcl 41 set ref 138* 151* 176* 176 177 iprec 000110 automatic fixed bin(17,0) dcl 39 set ref 131* 180* 180 181 istring 000155 automatic char(64) unaligned dcl 46 set ref 142* 143* 152* 161 161 166 166 166 166 179 179 179 179 j 000105 automatic fixed bin(17,0) dcl 37 set ref 120* 120* 122 123 124 length 000104 automatic fixed bin(17,0) dcl 37 set ref 89* 99 120 122 130* 165 165 min builtin function dcl 79 ref 112 mod builtin function dcl 79 ref 147 n2move 000106 automatic fixed bin(17,0) dcl 37 set ref 122* 124 124 124 nine 000222 automatic char(2) initial unaligned dcl 63 set ref 63* 179 179 one 000220 automatic char(2) initial unaligned dcl 63 set ref 63* 167 167 padesc parameter bit(36) dcl 14 ref 10 83 parg parameter char(1) unaligned dcl 14 ref 10 99 120 124 126 prdesc parameter bit(36) dcl 14 set ref 10 194* precision 0(24) 000215 automatic bit(12) level 2 in structure "idesc" packed unaligned dcl 53 in procedure "decimal_sqrt_" set ref 181* precision 0(24) 000100 automatic bit(12) level 2 in structure "adesc" packed unaligned dcl 19 in procedure "decimal_sqrt_" set ref 88 113* precision 0(24) 000101 automatic bit(12) level 2 in structure "rdesc" packed unaligned dcl 27 in procedure "decimal_sqrt_" set ref 116* precision 0(24) 000216 automatic bit(12) level 2 in structure "idesc1" packed unaligned dcl 54 in procedure "decimal_sqrt_" set ref 137* 150* 177* precision 0(24) 000217 automatic bit(12) level 2 in structure "rdesc1" packed unaligned dcl 55 in procedure "decimal_sqrt_" set ref 134* 178* presult parameter char(1) unaligned dcl 14 set ref 10 194* r defined char(1) unaligned dcl 48 set ref 167* 167* 194* rd based bit(36) dcl 57 set ref 115* 133 194* 194* rd1 based bit(36) dcl 57 set ref 133* 167* 167* rdesc 000101 automatic structure level 1 dcl 27 set ref 115 133 194 194 rdesc1 000217 automatic structure level 1 dcl 55 set ref 133 167 167 result 000175 automatic char(64) unaligned dcl 46 set ref 114* 167 167 167 167 194 194 rp1 000113 automatic fixed bin(17,0) dcl 42 set ref 135* 173* 173 174 178 rprec 000111 automatic fixed bin(17,0) dcl 40 set ref 111* 116 174 190 scale 0(12) 000100 automatic bit(12) level 2 in structure "adesc" packed unaligned dcl 19 in procedure "decimal_sqrt_" set ref 92 95* scale 0(12) 000101 automatic bit(12) level 2 in structure "rdesc" packed unaligned dcl 27 in procedure "decimal_sqrt_" set ref 193* scale 000103 automatic fixed bin(17,0) dcl 37 in procedure "decimal_sqrt_" set ref 92* 93 93* 93 94 191* 192 192* 192 193 substr builtin function dcl 79 set ref 90 99 102* 120 124* 124 126 143* 152* 165* 165 subtraction 000031 internal static fixed bin(17,0) initial dcl 34 set ref 161* 179* two 000221 automatic char(2) initial unaligned dcl 63 set ref 63* 166 166 type 0(01) 000100 automatic bit(6) level 2 packed unaligned dcl 19 set ref 90 102* unspec builtin function dcl 79 ref 100 zero 000010 internal static char(64) initial unaligned dcl 31 ref 114 142 194 194 NAMES DECLARED BY EXPLICIT CONTEXT. begin 000022 constant label dcl 83 decimal_sqrt_ 000007 constant entry external dcl 10 return 000430 constant label dcl 185 ref 124 sloop 000254 constant label dcl 161 ref 168 182 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 540 600 477 550 Length 756 477 40 141 40 24 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME decimal_sqrt_ 165 external procedure is an external procedure. STORAGE FOR INTERNAL STATIC VARIABLES. LOC IDENTIFIER BLOCK NAME 000010 zero decimal_sqrt_ 000030 addition decimal_sqrt_ 000031 subtraction decimal_sqrt_ 000032 cdesc decimal_sqrt_ STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME decimal_sqrt_ 000100 adesc decimal_sqrt_ 000101 rdesc decimal_sqrt_ 000102 exp decimal_sqrt_ 000103 scale decimal_sqrt_ 000104 length decimal_sqrt_ 000105 j decimal_sqrt_ 000106 n2move decimal_sqrt_ 000107 aprec decimal_sqrt_ 000110 iprec decimal_sqrt_ 000111 rprec decimal_sqrt_ 000112 ip1 decimal_sqrt_ 000113 rp1 decimal_sqrt_ 000114 ch decimal_sqrt_ 000115 arg decimal_sqrt_ 000135 atemp decimal_sqrt_ 000155 istring decimal_sqrt_ 000175 result decimal_sqrt_ 000215 idesc decimal_sqrt_ 000216 idesc1 decimal_sqrt_ 000217 rdesc1 decimal_sqrt_ 000220 one decimal_sqrt_ 000221 two decimal_sqrt_ 000222 nine decimal_sqrt_ THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out return mod_fx1 ext_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. code_ decimal_op_ NO EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 10 000002 63 000014 83 000022 88 000025 89 000030 90 000032 92 000035 93 000041 94 000045 95 000047 96 000051 99 000052 100 000057 101 000062 102 000066 107 000072 111 000074 112 000075 113 000102 114 000107 115 000120 116 000122 120 000127 121 000145 122 000147 123 000153 124 000160 126 000170 130 000205 131 000210 132 000212 133 000214 134 000216 135 000220 136 000222 137 000224 138 000226 142 000230 143 000234 147 000236 149 000242 150 000243 151 000245 152 000247 157 000251 161 000254 163 000277 165 000303 166 000307 167 000332 168 000355 173 000356 174 000357 176 000362 177 000363 178 000370 179 000375 180 000420 181 000422 182 000427 190 000430 191 000432 192 000434 193 000437 194 000445 195 000471 ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved