mercredi 27 juillet 2016

Creating if (double has certain number of decimal points)

I'm curious if there is a succinct way to create a conditional that checks for a generated double value over a certain number of digits, and throws it away if it's too many decimal places. For instance, if 1.0, 1.5, or 2.2 are generated use those digits. If it generates numbers like 1.61, 1.64, or 2.432, throw these away. Something like this:

if(generated number is over alloted decimal points) continue;

Aucun commentaire:

Enregistrer un commentaire