The cycles renderer works by taking several samples of pixel values and then averaging there values which means, it adds the samples up and then divides the sum by the number of samples taken. Here is an example for illustration: The scene consists of a diamond object on a reflective plane. The diamond has a glass material and the plane is a glossy material with total reflection. Behind the diamond i have placed a pointlight (image 1).
First i rendered with 10 samples (portion of resulting image is in 2). The render has one single firefly, one white pixel in the lower center as you can see. But it is not just a white pixel. I zoom in and by clicking the mouse on it in the image editor, i can read the value; it is 2368313.25 which is actually brighter than simple white.
In image 4 i rendered the scene with 1 sample only, there is no firefly; the value is instead 0.0509 just like all the other grey pixels around it. In image 5 i rendered with 2 samples, and there the firefly pops in! Here the readout says the pixel brightness is 11841566. Because i used 2 samples and cycles works by taking the average of the samples i can use my pocket calculator to estimate the value of the firefly sample:
Samples taken are
s1 = 0.0509 (i know from image 1)
s2 = ?
average = (s1 + s2) / 2 = 11841566
solving for s2 gives: s2 = (2 * 11841566) - 0.0509 = approx. 23683132
So the “bad” sample has a value of 23683132. I do not know why exactly this sample was created, may be because of some buggy math function or floating point error or something like that (especially because this value is very close to the maximum exact representable floating point number).
If i wanted my image to be correct within 1% (ie 0.01), i could just set the number of samples to 23683132/0.01, that would be enough samples that this error would be averaged out. But rendering 2.3 billion samples could take a while, especially on older computers, so what i instead did is use the clamp value; with the clamp value, any sample value greater than the clamp value would be replaced with the clamp value instead.
i wanted to render with 100 samples, but with 0.01 accuracy, so i need to clamp the value to 1 (because 1/0.01 = 100). Or if i were willing to take 1000 samples, i would set the clamp to 10 respectively. The result is in image 6 and the firefly pixel has only a value of 0.0604 (which is within the 0.01 limit of the “real” value 0.0509). Still visible but damped.
Of course this only works if you have some idea about what the maximum sample value of the whole image could be. In my case 1 works fine. But if the maximum were e.g. 10, because i had some bright lights in the scene, i could not make the clamp value less than 10 without seriously losing contrast, and i would need to take the 1000 samples with the clamp of 10 to get the same error of 0.01.