Index: uspace/app/tester/float/softfloat1.c
===================================================================
--- uspace/app/tester/float/softfloat1.c	(revision ab52a3eecc1b2f233980f13b139dc8d7ef4a416e)
+++ uspace/app/tester/float/softfloat1.c	(revision 123be4f2eff2e4dc405825b94c8fcf712ee17994)
@@ -35,8 +35,9 @@
 #include <div.h>
 #include <comparison.h>
+#include <conversion.h>
 #include <bool.h>
 #include "../tester.h"
 
-#define OPERANDS  6 
+#define OPERANDS  10
 #define PRECISION  10000
 
@@ -44,21 +45,29 @@
 
 typedef int32_t cmptype_t;
-typedef void (* float_op_t)(float, float, float *, float_t *);
-typedef void (* double_op_t)(double, double, double *, double_t *);
+
+typedef void (* uint_to_double_op_t)(unsigned int, double *, double_t *);
+typedef void (* double_to_uint_op_t)(double, unsigned int *, unsigned int *);
+typedef void (* float_binary_op_t)(float, float, float *, float_t *);
+typedef void (* double_binary_op_t)(double, double, double *, double_t *);
 typedef void (* double_cmp_op_t)(double, double, cmptype_t *, cmptype_t *);
-typedef void (* template_t)(void *, unsigned, unsigned, cmptype_t *,
+
+typedef void (* template_unary_t)(void *, unsigned, cmptype_t *, cmptype_t *);
+typedef void (* template_binary_t)(void *, unsigned, unsigned, cmptype_t *,
     cmptype_t *);
 
-static float fop_a[OPERANDS] =
-	{3.5, -2.1, 100.0, 50.0, -1024.0, 0.0};
-
-static float fop_b[OPERANDS] =
-	{-2.1, 100.0, 50.0, -1024.0, 3.5, 0.0};
-
-static double dop_a[OPERANDS] =
-	{3.5, -2.1, 100.0, 50.0, -1024.0, 0.0};
-
-static double dop_b[OPERANDS] =
-	{-2.1, 100.0, 50.0, -1024.0, 3.5, 0.0};
+#define NUMBERS	\
+	3.5, -2.1, 100.0, 50.0, -1024.0, 0.0, 768.3156, 1080.499999, -600.0, 1.0
+
+static float fop_a[OPERANDS] = {
+	NUMBERS
+};
+
+static double dop_a[OPERANDS] =	{
+	NUMBERS
+};
+
+static unsigned int uop_a[OPERANDS] = {
+	4, -100, 100, 50, 1024, 0, 1000000, -1U, 0x80000000U, 500
+};
 
 static cmptype_t cmpabs(cmptype_t a)
@@ -81,5 +90,34 @@
 
 static void
-float_template(void *f, unsigned i, unsigned j, cmptype_t *pic,
+uint_to_double_template(void *f, unsigned i, cmptype_t *pic, cmptype_t *pisc)
+{
+	double c;
+	double_t sc;
+
+	uint_to_double_op_t op = (uint_to_double_op_t) f;
+	
+	op(uop_a[i], &c, &sc);
+
+	*pic = (cmptype_t) (c * PRECISION);
+	*pisc = (cmptype_t) (sc.val * PRECISION);
+}
+
+static void
+double_to_uint_template(void *f, unsigned i, cmptype_t *pic, cmptype_t *pisc)
+{
+	unsigned int c;
+	unsigned int sc;
+
+	double_to_uint_op_t op = (double_to_uint_op_t) f;
+	
+	op(dop_a[i], &c, &sc);
+
+	*pic = (cmptype_t) c;
+	*pisc = (cmptype_t) sc;
+}
+
+
+static void
+float_template_binary(void *f, unsigned i, unsigned j, cmptype_t *pic,
     cmptype_t *pisc)
 {
@@ -87,7 +125,7 @@
 	float_t sc;
 
-	float_op_t op = (float_op_t) f;
-	
-	op(fop_a[i], fop_b[j], &c, &sc);
+	float_binary_op_t op = (float_binary_op_t) f;
+	
+	op(fop_a[i], fop_a[j], &c, &sc);
 
 	*pic = (cmptype_t) (c * PRECISION);
@@ -96,5 +134,5 @@
 
 static void
-double_template(void *f, unsigned i, unsigned j, cmptype_t *pic,
+double_template_binary(void *f, unsigned i, unsigned j, cmptype_t *pic,
     cmptype_t *pisc)
 {
@@ -102,7 +140,7 @@
 	double_t sc;
 
-	double_op_t op = (double_op_t) f;
-	
-	op(dop_a[i], dop_b[j], &c, &sc);
+	double_binary_op_t op = (double_binary_op_t) f;
+	
+	op(dop_a[i], dop_a[j], &c, &sc);
 
 	*pic = (cmptype_t) (c * PRECISION);
@@ -116,8 +154,28 @@
 	double_cmp_op_t op = (double_cmp_op_t) f;
 	
-	op(dop_a[i], dop_b[j], pis, piss);
-}
-
-static bool test_template(template_t template, void *f)
+	op(dop_a[i], dop_a[j], pis, piss);
+}
+
+static bool test_template_unary(template_unary_t template, void *f)
+{
+	bool correct = true;
+	
+	for (unsigned int i = 0; i < OPERANDS; i++) {
+		cmptype_t ic;
+		cmptype_t isc;
+
+		template(f, i, &ic, &isc);	
+		cmptype_t diff = cmpabs(ic - isc);
+			
+		if (diff != 0) {
+			TPRINTF("i=%u diff=%" PRIdCMPTYPE "\n", i, diff);
+			correct = false;
+		}
+	}
+	
+	return correct;
+}
+
+static bool test_template_binary(template_binary_t template, void *f)
 {
 	bool correct = true;
@@ -142,4 +200,32 @@
 }
 
+static void uint_to_double_operator(unsigned int a, double *pc, double_t *psc)
+{
+	*pc = (double) a;
+	psc->data = uint_to_double(a);
+}
+
+static void
+double_to_uint_operator(double a, unsigned int *pc, unsigned int *psc)
+{
+	double_t sa;
+
+	sa.val = a;
+
+	*pc = (unsigned int) a;
+	*psc = double_to_uint(sa.data);
+}
+
+static void
+double_to_int_operator(double a, unsigned int *pc, unsigned int *psc)
+{
+	double_t sa;
+
+	sa.val = a;
+
+	*pc = (int) a;
+	*psc = double_to_int(sa.data);
+}
+
 static void float_add_operator(float a, float b, float *pc, float_t *psc)
 {
@@ -267,32 +353,47 @@
 	const char *err = NULL;
 
-	if (!test_template(float_template, float_add_operator)) {
+	if (!test_template_binary(float_template_binary, float_add_operator)) {
 		err = "Float addition failed";
 		TPRINTF("%s\n", err);
 	}
-	if (!test_template(float_template, float_mul_operator)) {
+	if (!test_template_binary(float_template_binary, float_mul_operator)) {
 		err = "Float multiplication failed";
 		TPRINTF("%s\n", err);
 	}
-	if (!test_template(float_template, float_div_operator)) {
+	if (!test_template_binary(float_template_binary, float_div_operator)) {
 		err = "Float division failed";
 		TPRINTF("%s\n", err);
 	}
-	if (!test_template(double_template, double_add_operator)) {
+	if (!test_template_binary(double_template_binary, double_add_operator)) {
 		err = "Double addition failed";
 		TPRINTF("%s\n", err);
 	}
-	if (!test_template(double_template, double_mul_operator)) {
+	if (!test_template_binary(double_template_binary, double_mul_operator)) {
 		err = "Double multiplication failed";
 		TPRINTF("%s\n", err);
 	}
-	if (!test_template(double_template, double_div_operator)) {
+	if (!test_template_binary(double_template_binary, double_div_operator)) {
 		err = "Double division failed";
 		TPRINTF("%s\n", err);
 	}
-	if (!test_template(double_compare_template, double_cmp_operator)) {
+	if (!test_template_binary(double_compare_template, double_cmp_operator)) {
 		err = "Double comparison failed";
 		TPRINTF("%s\n", err);
 	}
+	if (!test_template_unary(uint_to_double_template,
+	    uint_to_double_operator)) {
+		err = "Conversion from unsigned int to double failed";
+		TPRINTF("%s\n", err);
+	}
+	if (!test_template_unary(double_to_uint_template,
+	    double_to_uint_operator)) {
+		err = "Conversion from double to unsigned int failed";
+		TPRINTF("%s\n", err);
+	}
+	if (!test_template_unary(double_to_uint_template,
+	    double_to_int_operator)) {
+		err = "Conversion from double to signed int failed";
+		TPRINTF("%s\n", err);
+	}
 	
 	return err;
Index: uspace/lib/softfloat/common.c
===================================================================
--- uspace/lib/softfloat/common.c	(revision ab52a3eecc1b2f233980f13b139dc8d7ef4a416e)
+++ uspace/lib/softfloat/common.c	(revision 123be4f2eff2e4dc405825b94c8fcf712ee17994)
@@ -39,5 +39,5 @@
 /* Table for fast leading zeroes counting. */
 char zeroTable[256] = {
-	8, 7, 7, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, \
+	8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, \
 	3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \
 	2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
@@ -307,16 +307,24 @@
 /**
  * Round and normalize number expressed by exponent and fraction with
- * first bit (equal to hidden bit) at 62nd bit.
+ * first bit (equal to hidden bit) at bit 62.
  *
  * @param exp Exponent part.
- * @param fraction Fraction with hidden bit shifted to 62nd bit.
+ * @param fraction Fraction with hidden bit shifted to bit 62.
  */
 void round_float64(int32_t *exp, uint64_t *fraction)
 {
-	/* rounding - if first bit after fraction is set then round up */
+	/*
+	 * Rounding - if first bit after fraction is set then round up.
+	 */
+
+	/*
+	 * Add 1 to the least significant bit of the fraction respecting the
+	 * current shift to bit 62 and see if there will be a carry to bit 63.
+	 */
 	(*fraction) += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3));
 	
+	/* See if there was a carry to bit 63. */
 	if ((*fraction) & 
-	    (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 3))) {
+	    (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1))) {
 		/* rounding overflow */
 		++(*exp);
