Re: converting numbers

1999-01-29 Thread ivan
At 11:48 AM 1/28/99 -0800, David Stern wrote: >On Thu, 28 Jan 1999 12:17:34 CST, Andrew Ivanov wrote: >> > Howdy, >> > >> > Where's the FM that tells how to convert numbers, like 0x11A to a >> > "decimal"? >> >> 0x11A is in hex, and to convert it to dec is >> 1*16^2 + 1*16^1 +10*16^0 >> (A=10,B=

Re: converting numbers

1999-01-29 Thread Michael Laing
> Where's the FM that tells how to convert numbers, like 0x11A to a > "decimal"? I use 'dc' for this sort of task, for example: plum:~$ dc Invoke the program 16 push 16 on the stack i pop 16 from the stack and set it as the input radix 11A push 0x11A o

Re: converting numbers

1999-01-29 Thread M.C. Vernon
> If all you want is to convert to decimal, use this short C-program: > #include > > void main(int argc, char **argv) This is undefined. main should return an int. > { > while (*++argv) printf("%s == %i\n", *argv, strtol(*argv)); exit(EXIT_SUCCESS); > } Matthew -- Elen sil

Re: converting numbers

1999-01-29 Thread Helge Hafting
> Where's the FM that tells how to convert numbers, like 0x11A to a > "decimal"? You'll find it in any C manual, or try "man strtol" for the strtol() function. If all you want is to convert to decimal, use this short C-program: #include void main(int argc, char **argv) { while (*++argv) pr

Re: converting numbers

1999-01-29 Thread Alexander N. Benner
hi Ship's Log, Lt. David Stern, Stardate 280199.1148: > OK, hex numbers are radix 16, octal radix 8, decimal radix 1. As mentioned in an other mail, it's 10. There are no base 1 #s @all as 1^r for all r is still 1 (besids you have always base# of digits starting with 0) > Good. Now I can conve

Re: converting numbers

1999-01-28 Thread Björn Elwhagen
On Thu, Jan 28, 1999 at 04:19:10PM -0600, Joey Hess wrote this: > David Stern wrote: > > Where's the FM that tells how to convert numbers, like 0x11A to a > > "decimal"? > > This is in base 16, so: > Hm...i obvilously didn't even look hard enough at the number given since i didn't even noti

Re: converting numbers

1999-01-28 Thread Joey Hess
David Stern wrote: > Where's the FM that tells how to convert numbers, like 0x11A to a > "decimal"? This is in base 16, so: [EMAIL PROTECTED]:~>bc ... ibase=16 11A 282<-- result quit -- see shy jo

Re: converting numbers

1999-01-28 Thread Andrew Ivanov
Thanks for the correction: 0x is hex, 0 is octal. > > OK, hex numbers are radix 16, octal radix 8, decimal radix 1. No, decimal is radix 10 (base 10). Binary is base 2. > I guess I'll have to determine when to use each based on context. In written language the base is used as a subsript to the

Re: converting numbers

1999-01-28 Thread David Stern
On Thu, 28 Jan 1999 12:17:34 CST, Andrew Ivanov wrote: > > Howdy, > > > > Where's the FM that tells how to convert numbers, like 0x11A to a > > "decimal"? > > 0x11A is in hex, and to convert it to dec is > 1*16^2 + 1*16^1 +10*16^0 > (A=10,B=11, C=12, D=13, E=14, F=15) I should never have asked

Re: converting numbers

1999-01-28 Thread Henning Makholm
Björn Elwhagen <[EMAIL PROTECTED]> writes: > 0x0123 is if i don't reccall wrong the way to represent an octal > number. No. 0x "always" means that a hexadecimal number follows. Ocal is "traditionally" indicated by having a leading zero but no x. Outside contexts where one KNOWS that this convent

Re: converting numbers

1999-01-28 Thread Andrew Ivanov
> Howdy, > > Where's the FM that tells how to convert numbers, like 0x11A to a > "decimal"? 0x11A is in hex, and to convert it to dec is 1*16^2 + 1*16^1 +10*16^0 (A=10,B=11, C=12, D=13, E=14, F=15) I may be wrong, but I think octal is in x0# format, so that 0x0300 would be an octal number. To

Re: converting numbers

1999-01-28 Thread Björn Elwhagen
On Thu, Jan 28, 1999 at 11:57:54AM -0600, David Stern wrote this: > Where's the FM that tells how to convert numbers, like 0x11A to a > "decimal"? 0x0123 is if i don't reccall wrong the way to represent an octal number. In that case you get it's decimal number this way. 123 base 8 is (3*8^0 + 2*