Should I use rounded or exact f-stop values for a depth of field calculator?

I'm designing a DOF calculator. Looking at other calculators, I can see that some of them use rounded values (e.g. f/2.8) and some use exact values derived from the square root calculation (e.g. f/2.828). My assumption is that the rounded value calculators are just being lazy but I just wanted to make sure there wasn't actually some reason why they do it?

• Many of the "rounded value" calculators may display f/2.8 in the user interface while internally actually using f/2√2 which is approximately equal to f/2.828, just like our cameras do. For more about how cameras round not only f-numbers but also exposure times (i.e. "shutter speeds"), ISO, focal lengths, etc. in what they display compared to what they actually target for a given setting), please see: Is there a sane reason why ¹⁄₁₂₅ is not, instead, exactly half of ¹⁄₆₀?. Nov 30, 2021 at 20:49

Getting your example 2.828 is 1.01 * 2.8. So the error will be 1% which mean for example if you have DoF =0.2m you will add error of 2mm.

From the other answer if lens is 32mm instead of 35mm you will get ~8.6% error.

So use round values (make your life easy)

Given that almost every parameter affecting exposure is an approximation - your 35mm lens may actually be 32mm or 37mm, ISO 400 may be ISO 417 or ISO 393 - it probably doesn't matter as much which number you use. You're not going to get an exact answer anyway...

• Totally valid point, but I think the variability of all those factors could also be a reason why one should be as exact as possible where one can. Lots of rounding errors can add up. Nov 29, 2021 at 14:44
• @RomeoNinov's answer explains why you shouldn't care about this very minor error. Worry about the bigger errors in your system. Nov 29, 2021 at 14:59
• Accurate as possible is the right idea. Our inputs are approximations, but the least accurate number will be your guess about the distance. And if the DOF calculates good out to 30 feet, math computes it exactly, but, there won't be any visible difference in 29.5 and 30.5 feet. Nevertheless, the concept of Depth of Field using the best possible input will be very valuable to know and use. Nov 29, 2021 at 19:13
• @zakray The concept of DoF is just an illusion to begin with. There's no exact line on either side of the actual point of focus where things go from "sharp" to "blurry". Only a single distance will be at sharpest focus. What we call depth of field are the areas on either side of the sharpest focus that are blurred so insignificantly that we still see them as sharp. When we change the display size or viewing distance of the exact same image the DoF changes. The largest variable with any DoF calculator is probably the viewer's visual acuity. Nov 30, 2021 at 21:02
• That is, we can go to the trouble to measure the subject/focus distance for a particular photo with whatever degree of accuracy we want/need to. But we have no way of making a DoF calculator that is equally accurate for every potential viewer of the image we're creating because different potential viewers have different levels of visual acuity. Nov 30, 2021 at 21:08

F# is only accurate when focused at infinity, because the lens' stated focal length is only accurate when focused at infinity.

Combine that with rounded focal lengths and F#'s, that DoF and hyperfocus (in particular) are about not focusing at infinity, and the fact that DoF isn't a fixed aspect of an image (especially if the composition will be changed in post), makes DoF calculators about useless... there's no point in worrying about a few hundredths of F#.

• I wouldn't say DoF calculators are exactly worthless.... but they are just an approximation. Knowing that you have only a couple mm of DoF instead of several cm or even m can be useful; just don't expect that you have exactly 2.713mm.... Nov 29, 2021 at 15:17
• @twalberg, I said "about useless." They're actually more useful in understanding the DoFocus/focus tolerance (relative sharpness @ image plane) because that isn't really variable. Whereas DoField is hugely variable (dependent on viewing conditions and viewer). Nov 29, 2021 at 16:35

As any DoF definition is based on some "arbitrary" limit for the diameter of the circle of diffusion, it will only ever be a rough indicator.

It's not the case that inside the DoF, everything is perfectly sharp, and exactly at the DoF border it immediately becomes unsharp, it's a continuous degradation.

So, what limit will you apply?

• 10µm or 30µm? These two values will make a clearly visible difference.
• 10µm or 11µm? I doubt that anyone will notice a difference in sharpness.
• 10µm or 10.1µm? That surely doesn't matter.

So, as long as your inaccuracies don't exceed 10% or even 20%, it doesn't matter in practice. So, forget about the 1% difference between 2.8 and 2.828.

But, if you want to do a really useful DoF calculator, I'd recommend to include diffraction effects. We all know that after some f-stop, further closing of the aperture makes sharpness degrade, so that the expected increase in DoF turns into an image where nothing is really sharp.