Note that there are some explanatory texts on larger screens.

plurals
  1. POJava variables changing randomly
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COI doubt they are "changing randomly" (this would be a serious bug that **would make Java/JVM unsuitable for any serious development**). So, eliminating that line of thought for a minute, what are *other* possibilities for this behavior? Are `startPosition` and `position` *the same object*, perhaps? If not, *do they mutate/update the same variables*? Or, *is there a thread involved*?
      singulars
      1. This table or related slice is empty.
    2. COLet's see now... either java is fundamentally flawed, or you have a bug in your code. Gee, that's a tough one! May I recommend putting breakpoints in the relevant object's setters and examining the call stack to see *who* is setting the values. You may just find out why they are "randomly" changing. Also, sgusc's answer has good info. Try printing the difference between `start` and `end`: You may find it is tiny and therefore an artefact of floating point arithmetic
      singulars
    3. COQ: Is it possible that maybe your have a thread (or threads!) that you're not telling us about, that might be updating values behind your back ;)? ALSO: as sgusc correctly pointed out, you *cannot* reliably compare two floating point values for exact equality. This is true for *any* floating point implementation in *any* language: but especially true for (single-precision) "float" values. 'Hope that helps .. PSM
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload