lundi 26 janvier 2015

Fmodf returning same value

Here's my code:



x = fmodf((float)rand(), (float)(1/sqsize)) + x1;


The problem is, whenever sqsize is a multiple of square-multiple of 4(e.g 4,16,64), it always returns the same numbers. sqsize is the square root for the multiple (so for 4 it is 2, for 16 it is 4, for 64 it is 8, etc).


x1 is defined as:



x1 = fmodf(value,sqsize)/sqsize;


where value is equal to a number in 0-sqsize^2.


Any ideas why I keep getting the same value? Thanks.





Aucun commentaire:

Enregistrer un commentaire