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=
> 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
> 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
> 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
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
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
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
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
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
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
> 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
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*
12 matches
Mail list logo