Add floating point value to android resources/values

I’m trying to add a little space between lines to my TextViews using android:lineSpacingMultiplier from the documentation: Extra spacing between lines of text, as a multiplier. Must be a floating point value, such as “1.2”. As I’m using this in a few different TextViews I would like to add a global dimension/value to my resources, … Read more

Why are some float < integer comparisons four times slower than others?

When comparing floats to integers, some pairs of values take much longer to be evaluated than other values of a similar magnitude. For example: >>> import timeit >>> timeit.timeit(“562949953420000.7 < 562949953421000”) # run 1 million times 0.5387085462592742 But if the float or integer is made smaller or larger by a certain amount, the comparison runs … Read more

Why does NaN – NaN == 0.0 with the Intel C++ Compiler?

It is well-known that NaNs propagate in arithmetic, but I couldn’t find any demonstrations, so I wrote a small test: #include <limits> #include <cstdio> int main(int argc, char* argv[]) { float qNaN = std::numeric_limits<float>::quiet_NaN(); float neg = -qNaN; float sub1 = 6.0f – qNaN; float sub2 = qNaN – 6.0f; float sub3 = qNaN – … Read more