Trade: minor cleanup.
Math: better algorithm for comparing floating-point values.

Still not ideal (for values around zero), but can't do much better for
such general case.
Math: less strict precision for comparing floats.

Now the viewer example is usable again.