properly round to the nearest M (=0.001m), which is the smallest
available unit.
This avoids weirdness like (size_t)(0.6 * 10.0) == 5
by instead calculating (size_t)(0.6 * 10.0 + 0.0005) == 6,
and so it fixes the indentation of the readline(3) manual.
-/* $Id: term.c,v 1.86 2014/08/08 16:00:23 schwarze Exp $ */
+/* $Id: term.c,v 1.87 2014/08/08 16:02:55 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
if (r < 0.0)
r = 0.0;
- return((size_t)r);
+ return((size_t)(r + 0.0005));
}
size_t
v = (*p->hspan)(p, su);
if (v < 0.0)
v = 0.0;
- return((size_t)v);
+ return((size_t)(v + 0.0005));
}