5
In some videos on numberphile about the Zeno’s Paradox the teacher of the video tried to explain how this paradox worked using hands to hit Palamas (I do not know how to explain this but I will leave the video there in the question, watch the video please is easier to understand).
Briefly in the video is shown that every time you will clap you shorten half the distance as in the example below.
1/2 = 0.5
0.5 / 2 = 0.25
To return these divisions you can use the following code:
static void Main(string[] args)
{
int i = 0;
decimal x = 1m;
decimal dividir = x / 2m;
do
{
i++;
Console.WriteLine("{0}:{1}", i, dividir);
dividir = dividir / 2m;
} while (dividir != 0);
Console.ReadKey();
}
At the end are returned 93 results.
That’s right?
It shouldn’t have much more results than that?
Tried debugging 92 and see what the split value is?
– PauloHDSousa
No, it’s just that as this is not a calculator and it’s far from being also the first time I ran the program and went to compare in Windows calculator the result of the 17° split got like this. 7,62939453125e-6 and the application is different, I kept thinking about it and ended up not even debugging to know the result.
– Rodolfo Olivieri
Each variable type has a maximum bit capacity. Picking a class with a larger capacity should increase the amount of results received.
– mutlei
Yeah, totally forgot about it, good not totally but anyway, just reading the comments and reply I remembered it. Thank you
– Rodolfo Olivieri
@Rodolfoolivieri I didn’t suggest you use the
double
because I thought you wanted absolute accuracy. Yes, thedouble
provides much larger numbers but with deviations. If this is ok for you, and is in many applications, great. But know that the result will not be exactly the same.– Maniero
This little program there was more for a test anyway, I’m not using anywhere, just for learning. I mean I hosted him on github but nothing serious
– Rodolfo Olivieri