double a = 1E100 printf("%f", a);   It seems to be printing a different value other than 1 followed by a 100 zeros:  10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104   What might be the problem here?
27
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
13911
Possible Duplicate:          Here is a test case:   void foo(int i, int j) {    printf("%d %d", i, j); } ... test = 0; foo(test++, test);   I would expect to get a "0 1" output, but I get "0 0"  What gives??
95134
When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"?
40309
What is the best way to convert a double to a long without casting?  For example:  double d = 394.000; long l = (new Double(d)).longValue(); System.out.println("double=" + d + ", long=" + l);
111701
I'm messing around with some C code using floats, and I'm getting 1.#INF00, -1.#IND00 and -1.#IND when I try to print floats in the screen. What does those values mean?  I believe that 1.#INF00 means positive infinity, but what about -1.#IND00 and -1.#IND? I also saw sometimes this value: 1.$NaN which is Not a Number, but what causes those strange values and how can those help me with debugging?  I'm using  which I believe uses  representation for float point numbers.  Can someone list all those invalid values and what they mean?
121232
I have this tex: \(\mu_{A}\left(x\right)\in \[0,1  \right\]\)  The issue here is that [ and ] are not showing around 0,1, why is that?  Thanks.
10087
I'd like to output hello world over 20 characters.  printf "%-20s :\n\n" 'hello world!!'  # Actual output hello world!!        :  # Wanted output hello world!!========:   However, I don't want to complete with spaces but with "=" instead. How do I do that?
67106
Is there a function to round a float in C or do I need to write my own?       float conver = 45.592346543;   I would like to round the actual value to one decimal place, conver = 45.6.
6363
Is there a way to match some Unicode range exactly. Let's use the  as an example: U+400 to U+52f  The whole range of chars could be printed (from bash or zsh) with:   $ echo -e $(printf '\\U%x' $(seq 0x400 0x52f)) ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁ҂҃҄҇ҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӏӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹӺӻӼӽӾӿԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԐԑԒԓԔԕԖԗԘԙԚԛԜԝԞԟԠԡԢԣԤԥԦԧԨԩԪԫԬԭԮԯ   $ a=$(zsh -c 'echo -e $(printf '\''\\U%x'\'' $(seq 0x400 0x52f))')     To filter some range of it, lets use 0x452 to 0x490, this is the expected output:  $ b=$(bash -c 'echo -e $(printf '\''\\U%x'\'' $(seq 0x452 0x490))') $ echo "$b" ђѓєѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁ҂҃҄҇ҊҋҌҍҎҏҐ $ echo "$b" | xxd 00000000: d192 d193 d194 d195 d196 d197 d198 d199  ................ 00000010: d19a d19b d19c d19d d19e d19f d1a0 d1a1  ................ 00000020: d1a2 d1a3 d1a4 d1a5 d1a6 d1a7 d1a8 d1a9  ................ 00000030: d1aa d1ab d1ac d1ad d1ae d1af d1b0 d1b1  ................ 00000040: d1b2 d1b3 d1b4 d1b5 d1b6 d1b7 d1b8 d1b9  ................ 00000050: d1ba d1bb d1bc d1bd d1be d1bf d280 d281  ................ 00000060: d282 d283 d284 d285 d286 d287 d288 d289  ................ 00000070: d28a d28b d28c d28d d28e d28f d290 0a    ...............     But it seems impossible to filter with sed. This doesn't work:  $ echo "$a" | sed 's/[^\x452-\x490]//g'   Nor this (the result match other characters (probably a collating issue)):  $ echo "$a" | sed $'s/[^\u452-\u490]//g' АБВГжзийклмнопрстуфхцчшщъыьэюяёђєѕіїјљњћќѝўџҋҍҏҐҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӐӒӔӝӟӡӣӥӧөӫӭӯӱӳӵӹԅԇԉԋԍԏ   Not even this (same collating issue):  $ echo "$a" | sed 's/[^ђ-Ґ]//g'   This work with awk:  $ echo "$a" | awk '{gsub(/[^ђ-Ґ]/,"")}1'   But the only way to use an hex range is to use shell to convert hex to an unicode character  $ echo "$a" | awk $'{gsub(/[^\u452-\u490]/,"")}1'   or (two solutions):  $ c=$(bash -c 'printf "\u452-\u490"')  $ echo "$a" | awk '{gsub(/[^'"$c"']/,"")}1' $ echo $a | awk -v ra="[^$c]" '{gsub(ra,"")}1'   Questions:   Is there a way to do this with sed? Could awk do it in hex numbers without a higher shell. If possible, what is exactly the range matched by the collating sequence that sed use with sed 's/[^ђ-Ґ]//g'.   P.S.: I know that could be done in perl, thanks.
59458
Not sure what to do / how to start this... I have equcation of 504 is: $2 \cdot2 \cdot 2 \cdot 3 \cdot 3 \cdot 7$
38145
I know, the question seems to be strange. Programmers sometimes think too much. Please read on... In C I use signed and unsigned integers a lot. I like the fact that the compiler warns me if I do things like assigning a signed integer to an unsigned variable. I get warnings if I compare signed with unsigned integers and much much more. I like these warnings. They help me to keep my code correct. Why don't we have the same luxury for floats? A square-root will definitely never return a negative number. There are other places as well where a negative float value has no meaning. Perfect candidate for an unsigned float. Btw - I'm not really keen about the single extra bit of precision that I could get by removing the sign bit from the floats. I'm super happy with floats as they are right now.  I'd just like to mark a float as unsigned sometimes and get the same kind of warnings that I get with integers. I'm not aware of any programming language that supports unsigned floating-point numbers. Any idea why they don't exist?  EDIT: I know that the x87 FPU has no instructions to deal with unsigned floats. Lets just use the signed float instructions. Misuse (e.g. going below zero) could be considered undefined behaviour in the same way as overflow of signed integers is undefined.
32837
int temp = 0x5E; // in binary 0b1011110.   Is there such a way to check if bit 3 in temp is 1 or 0 without bit shifting and masking.  Just want to know if there is some built in function for this, or am I forced to write one myself.
6659
Given: a = 1 b = 10 c = 100  How do I display a leading zero for all numbers with less than two digits? This is the output I'm expecting: 01 10 100
41565
The printf function takes an argument type, such as %d or %i for a signed int. However, I don't see anything for a long value.
6418
In my  I was printing a double using cout that got rounded when I wasn't expecting it.  How can I make cout print a double using full precision?
10332
I need to cast single figures (1 to 9) to (01 to 09). I can think of a way but its big and ugly and cumbersome. I'm sure there must be some concise way. Any Suggestions
32798
I can print with printf as a hex or octal number.  Is there a format tag to print as binary, or arbitrary base? I am running gcc. printf(&quot;%d %x %o\n&quot;, 10, 10, 10); //prints &quot;10 A 12\n&quot; print(&quot;%b\n&quot;, 10); // prints &quot;%b\n&quot;