Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Sturm danstur

View GitHub Profile
@danstur
danstur / Float.java
Created May 2, 2019
Counts the number of floating point values in [0,0.5) and [0.5,1).
View Float.java
private static int count(float start, float end) {
int count = 0;
float val = start;
while (val < end) {
count++;
val = Math.nextAfter(val, 1);
}
return count;
}