A
August Karlstrom
Is there any difference between `%d' and `%i' in formatted IO? Which one
is preferred?
Regards,
August
is preferred?
Regards,
August
Is there any difference between `%d' and `%i' in formatted IO? Which one
is preferred?
Chris Torek said:base of 10 (%d) or 0 (%i).
How does one count in base 0?
Mark said:How does one count in base 0?
Michael Mair said:BTW: You cannot work sensibly with base 1
You can if all you need to do is count -- have you never used hash/tally
marks?
Nope, so I do not know about that.
In base 1, every digit can take values from 0 to base-1=0 and digit
n (counting from 0) represents the multiples of 1^n=1.
So, we can only represent the value 0 which does not make much sense
in terms of counting. If you want to count occurrences of 0, you are
not performing base 1 arithmetics in my book, as you cannot count in
base 1.
Right, which means that there is only one value that a digit can take
(we can call it "0" or we can call it "1", whatever).
Sure you can:
0 -> ""
1 -> "1"
2 -> "11"
3 -> "111"
4 -> "1111"
5 -> "11111"
6 -> "111111"
7 -> "1111111"
8 -> "11111111"
9 -> "111111111"
10-> "1111111111"
Coos Haak said:No, if you call your digit '1', 1+1+1+1 still is 1.
So you can't count with base 1.
Ben Pfaff said:1+1+1+1 would be 1111 in the suggested meaning for base 1.
I don't know whether this is a widely accepted or understood
meaning for "base 1".
Keith said:These rules apply to binary, octal, decimal, hexadecimal, sexagesimal,
etc (ignoring things like C's "0x" prefix).
So unless you invent new special-case rules for base 1,
Ben Pfaff said:1+1+1+1 would be 1111 in the suggested meaning for base 1.
I don't know whether this is a widely accepted or understood
meaning for "base 1".
pete said:There's a little bit about postional number systems
and nonpositional number systems in Knuth,
The Art Of Computer Programming, Volume 2,
section 4.1 Positional Numbers Systems,
page 195.
Base one is a nonpositional number system,
unlike the ones you mentioned.
Each base one digit stands for one.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.