C, logs, binary, and the number four. they don't mix?

Floating point operations like log are not exact. On my machine this code runs as expected (4 on STDIN gives 100) One way you could do this, is by using the mod (%) operator with successive powers of two.

Floating point operations like log are not exact. On my machine this code runs as expected (4 on STDIN gives 100). One way you could do this, is by using the mod (%) operator with successive powers of two.

– tekknolagi 01 Feb7 at 2:59 start with the highest power of two I think it's (ULONG_MAX/2+1) – levis501 Feb 4 at 3:05 if your input is higher than that, print a 1, otherwise print a 0. Then, set your input to the modulus (% operator) of the input with the highest power of two.Repeat. – levis501 Feb 4 at 3:08 There are many ways to go about this.

You could use subtraction instead of the mod operator. – levis501 Feb 4 at 3:08 But you would only subtract if you printed a 1. – levis501 Feb 4 at 3:08.

Works fine : ideone.com/PPZG5 As mentioned in the comments, your approach is really strange. A general base-n conversion routine looks like: void print_base_n(int val, int n) { if(val==0) { printf("0"); return; } else if(val.

This prints 20... – tekknolagi Feb 4 at 3:14 it should say else if(val.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions