Limiting the Size of a Float/Double Data Type

I am running an equation where I am using a double to multiply, and there exist a possibility that I could end up with a value that goes in to the the hundredth or possibly thousandth, which are values so small that I have been instructed to ignore. I only need to worry about whole numbers and tenths of a value. I already tried setprecision, but that only affects the output, not the actual value of a variable. Any help or direction would be appreciated, thanks.
i don't really get it. do you want to limit the variable value or the size of the variable in memory?

if it's the first option, then something like this should work:

float f = 0.00000000001;
if (f<0.0001){
I don't think you necessarily need to limit the value of the variable. What you do need to do instead is to modify the program logic. That is, alter the flow of which statements you require to be executed, dependent on the value of the variable(s).

That might involve putting some conditional test in a while loop, or a for loop, or in some if statement. It all really depends upon what data the variables represent and what processing you need to carry out using that data.
Topic archived. No new replies allowed.