pow() returning wrong result under specific conditions (and an unexpected fix) - Why is all this?
问题 I have been creating a short program for implementing Sieve of Eratosthenes. In he program, I have used int startingPoint which held the value of the current prime number, which had it's multiplications being marked non-prime, starting from its square. I used the pow() function to calculate the square of the starting point in the current loop. While doing so, I came across a weird phenomenon. When startingPoint was equal to 5 , then after int i = pow(startingPoint,2) the value of i was 24,