What is the numeral for base greater than 16 in bc?
up vote
0
down vote
favorite
I recently read about bc and found that it supports obase upto 999. Can anyone point me to the numeral set for bc for base greater than 16.
bc
add a comment |
up vote
0
down vote
favorite
I recently read about bc and found that it supports obase upto 999. Can anyone point me to the numeral set for bc for base greater than 16.
bc
3
the decimals from 0 to ($base minus one)?echo "obase=20; 20" | bc
,echo "obase=20; 39" | bc
,echo "obase=20; 40" | bc
– Jeff Schaller
Jul 12 '17 at 18:45
So, it is a space separated decimal numbers for each digit ?
– Palash Kanti Kundu
Jul 12 '17 at 18:50
It wouldn't have been particularly difficult for you to try this out yourself.
– roaima
Nov 25 at 17:20
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I recently read about bc and found that it supports obase upto 999. Can anyone point me to the numeral set for bc for base greater than 16.
bc
I recently read about bc and found that it supports obase upto 999. Can anyone point me to the numeral set for bc for base greater than 16.
bc
bc
edited Nov 25 at 15:12
Rui F Ribeiro
38.3k1475126
38.3k1475126
asked Jul 12 '17 at 18:38
Palash Kanti Kundu
596
596
3
the decimals from 0 to ($base minus one)?echo "obase=20; 20" | bc
,echo "obase=20; 39" | bc
,echo "obase=20; 40" | bc
– Jeff Schaller
Jul 12 '17 at 18:45
So, it is a space separated decimal numbers for each digit ?
– Palash Kanti Kundu
Jul 12 '17 at 18:50
It wouldn't have been particularly difficult for you to try this out yourself.
– roaima
Nov 25 at 17:20
add a comment |
3
the decimals from 0 to ($base minus one)?echo "obase=20; 20" | bc
,echo "obase=20; 39" | bc
,echo "obase=20; 40" | bc
– Jeff Schaller
Jul 12 '17 at 18:45
So, it is a space separated decimal numbers for each digit ?
– Palash Kanti Kundu
Jul 12 '17 at 18:50
It wouldn't have been particularly difficult for you to try this out yourself.
– roaima
Nov 25 at 17:20
3
3
the decimals from 0 to ($base minus one)?
echo "obase=20; 20" | bc
, echo "obase=20; 39" | bc
, echo "obase=20; 40" | bc
– Jeff Schaller
Jul 12 '17 at 18:45
the decimals from 0 to ($base minus one)?
echo "obase=20; 20" | bc
, echo "obase=20; 39" | bc
, echo "obase=20; 40" | bc
– Jeff Schaller
Jul 12 '17 at 18:45
So, it is a space separated decimal numbers for each digit ?
– Palash Kanti Kundu
Jul 12 '17 at 18:50
So, it is a space separated decimal numbers for each digit ?
– Palash Kanti Kundu
Jul 12 '17 at 18:50
It wouldn't have been particularly difficult for you to try this out yourself.
– roaima
Nov 25 at 17:20
It wouldn't have been particularly difficult for you to try this out yourself.
– roaima
Nov 25 at 17:20
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Yes, bc can process numbers with bases up to 999.
As an example:
$ echo "ibase=10;obase=40;3*40^2+7" | bc
03 00 07
Or, as it should be "307" = 3*40^2 + 0*40^1 + 7*40^0
. Or 4807 in decimal.
$ echo "ibase=10;obase=10;3*40^2+7" | bc
4807
So, the values are printed as a two digit (decimal) number with an space as separator.
Some other example:
$ echo "ibase=10;obase=530;371*530^9+222*530^3+127" | bc
371 000 000 000 000 000 222 000 000 127
Or, maybe (in bash), the same number:
$ bc <<<"obase=530;1224212292558591376050694127"
371 000 000 000 000 000 222 000 000 127
add a comment |
up vote
6
down vote
This is covered in the manual page for bc
:
For bases greater than 16, bc uses a multi-character digit method of printing the numbers where each higher base digit is printed as a base 10 number. The multi-character digits are separated by spaces. Each digit contains the number of characters required to represent the base ten value of "obase-1".
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Yes, bc can process numbers with bases up to 999.
As an example:
$ echo "ibase=10;obase=40;3*40^2+7" | bc
03 00 07
Or, as it should be "307" = 3*40^2 + 0*40^1 + 7*40^0
. Or 4807 in decimal.
$ echo "ibase=10;obase=10;3*40^2+7" | bc
4807
So, the values are printed as a two digit (decimal) number with an space as separator.
Some other example:
$ echo "ibase=10;obase=530;371*530^9+222*530^3+127" | bc
371 000 000 000 000 000 222 000 000 127
Or, maybe (in bash), the same number:
$ bc <<<"obase=530;1224212292558591376050694127"
371 000 000 000 000 000 222 000 000 127
add a comment |
up vote
1
down vote
accepted
Yes, bc can process numbers with bases up to 999.
As an example:
$ echo "ibase=10;obase=40;3*40^2+7" | bc
03 00 07
Or, as it should be "307" = 3*40^2 + 0*40^1 + 7*40^0
. Or 4807 in decimal.
$ echo "ibase=10;obase=10;3*40^2+7" | bc
4807
So, the values are printed as a two digit (decimal) number with an space as separator.
Some other example:
$ echo "ibase=10;obase=530;371*530^9+222*530^3+127" | bc
371 000 000 000 000 000 222 000 000 127
Or, maybe (in bash), the same number:
$ bc <<<"obase=530;1224212292558591376050694127"
371 000 000 000 000 000 222 000 000 127
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Yes, bc can process numbers with bases up to 999.
As an example:
$ echo "ibase=10;obase=40;3*40^2+7" | bc
03 00 07
Or, as it should be "307" = 3*40^2 + 0*40^1 + 7*40^0
. Or 4807 in decimal.
$ echo "ibase=10;obase=10;3*40^2+7" | bc
4807
So, the values are printed as a two digit (decimal) number with an space as separator.
Some other example:
$ echo "ibase=10;obase=530;371*530^9+222*530^3+127" | bc
371 000 000 000 000 000 222 000 000 127
Or, maybe (in bash), the same number:
$ bc <<<"obase=530;1224212292558591376050694127"
371 000 000 000 000 000 222 000 000 127
Yes, bc can process numbers with bases up to 999.
As an example:
$ echo "ibase=10;obase=40;3*40^2+7" | bc
03 00 07
Or, as it should be "307" = 3*40^2 + 0*40^1 + 7*40^0
. Or 4807 in decimal.
$ echo "ibase=10;obase=10;3*40^2+7" | bc
4807
So, the values are printed as a two digit (decimal) number with an space as separator.
Some other example:
$ echo "ibase=10;obase=530;371*530^9+222*530^3+127" | bc
371 000 000 000 000 000 222 000 000 127
Or, maybe (in bash), the same number:
$ bc <<<"obase=530;1224212292558591376050694127"
371 000 000 000 000 000 222 000 000 127
answered Jul 12 '17 at 19:51
Arrow
2,460218
2,460218
add a comment |
add a comment |
up vote
6
down vote
This is covered in the manual page for bc
:
For bases greater than 16, bc uses a multi-character digit method of printing the numbers where each higher base digit is printed as a base 10 number. The multi-character digits are separated by spaces. Each digit contains the number of characters required to represent the base ten value of "obase-1".
add a comment |
up vote
6
down vote
This is covered in the manual page for bc
:
For bases greater than 16, bc uses a multi-character digit method of printing the numbers where each higher base digit is printed as a base 10 number. The multi-character digits are separated by spaces. Each digit contains the number of characters required to represent the base ten value of "obase-1".
add a comment |
up vote
6
down vote
up vote
6
down vote
This is covered in the manual page for bc
:
For bases greater than 16, bc uses a multi-character digit method of printing the numbers where each higher base digit is printed as a base 10 number. The multi-character digits are separated by spaces. Each digit contains the number of characters required to represent the base ten value of "obase-1".
This is covered in the manual page for bc
:
For bases greater than 16, bc uses a multi-character digit method of printing the numbers where each higher base digit is printed as a base 10 number. The multi-character digits are separated by spaces. Each digit contains the number of characters required to represent the base ten value of "obase-1".
answered Jul 12 '17 at 18:56
user4556274
5,33811224
5,33811224
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f378036%2fwhat-is-the-numeral-for-base-greater-than-16-in-bc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
the decimals from 0 to ($base minus one)?
echo "obase=20; 20" | bc
,echo "obase=20; 39" | bc
,echo "obase=20; 40" | bc
– Jeff Schaller
Jul 12 '17 at 18:45
So, it is a space separated decimal numbers for each digit ?
– Palash Kanti Kundu
Jul 12 '17 at 18:50
It wouldn't have been particularly difficult for you to try this out yourself.
– roaima
Nov 25 at 17:20