#Doubles vs integer values
1 messages · Page 1 of 1 (latest)
Helper please have a look, thanks.
both of these are double values
0.4 is a "literal"
which i think you are confusing with "integer"
integers are 0, 1, 2, 3, ...
Oh, so doubling it doesn’t matter?
What would happen if I do float instead of double?
does double effect anything or doesn’t matter?
its both a double value, regardless whether you explicitly specify it in a variable.
If this value a constant and always used in this place I would change it to
private static final double FORWARD_SPEED = 0.4
Otherwise it being initialized every time you create an instance of this class.
And if you question why I suggest this, you can read up on "magic numbers"
doubling it doesn’t matter?
what do you mean by this?
double is kinda a strange name for floating point number, but its the one to use
nothing would happen but you'd have a narrower range of numbers you can use? honestly just ignore float
double is a double precision floating point number according to the IEEE 754 standard.
float is a single precision floating point number
Sorry I don’t know how to disable this thread
its automatic. or u use /help-thread close
Me who uses float everywhere: "Excuse me" 😄
Javascript:
well, at least they have a good use for nans