2 replaced http://stackoverflow.com/ with https://stackoverflow.com/ edited May 23 '17 at 12:40 Generally, you should be very careful of using them. Understanding the loss of precision that can arise from even simple calculations is a challenge. For example, averaging a list of numbers like this is a very bad idea: ``````double average(List data) { double ans = 0; for(Double d : data) { ans += d; } return ans / data.size(); } `````` The reason is that, for sufficiently large lists, you basically lose all the data points when `ans` gets large enough (see e.g. thisthis). The problem with this code is that for small lists, it'll probably just work --- it's only at scale that it breaks. Personally, I think you should only use them when: a) the calculation really must be fast; b) you don't care that the result is likely to be way off (unless you really know what you're doing). Generally, you should be very careful of using them. Understanding the loss of precision that can arise from even simple calculations is a challenge. For example, averaging a list of numbers like this is a very bad idea: ``````double average(List data) { double ans = 0; for(Double d : data) { ans += d; } return ans / data.size(); } `````` The reason is that, for sufficiently large lists, you basically lose all the data points when `ans` gets large enough (see e.g. this). The problem with this code is that for small lists, it'll probably just work --- it's only at scale that it breaks. Personally, I think you should only use them when: a) the calculation really must be fast; b) you don't care that the result is likely to be way off (unless you really know what you're doing). Generally, you should be very careful of using them. Understanding the loss of precision that can arise from even simple calculations is a challenge. For example, averaging a list of numbers like this is a very bad idea: ``````double average(List data) { double ans = 0; for(Double d : data) { ans += d; } return ans / data.size(); } `````` The reason is that, for sufficiently large lists, you basically lose all the data points when `ans` gets large enough (see e.g. this). The problem with this code is that for small lists, it'll probably just work --- it's only at scale that it breaks. Personally, I think you should only use them when: a) the calculation really must be fast; b) you don't care that the result is likely to be way off (unless you really know what you're doing). 1 answered Jun 27 '11 at 21:14 redjamjar 56411 gold badge55 silver badges99 bronze badges Generally, you should be very careful of using them. Understanding the loss of precision that can arise from even simple calculations is a challenge. For example, averaging a list of numbers like this is a very bad idea: ``````double average(List data) { double ans = 0; for(Double d : data) { ans += d; } return ans / data.size(); } `````` The reason is that, for sufficiently large lists, you basically lose all the data points when `ans` gets large enough (see e.g. this). The problem with this code is that for small lists, it'll probably just work --- it's only at scale that it breaks. Personally, I think you should only use them when: a) the calculation really must be fast; b) you don't care that the result is likely to be way off (unless you really know what you're doing).