#endif
#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
+# include <inttypes.h>
#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
+#ifdef HAVE_STRING_H
+# include <string.h>
#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
#endif
+#include <stdio.h>
+#include <assert.h>
#include "xmalloc.h"
return _normalize(result, result, sc_had_carry());
}
+#if 0
static void _power_of_ten(int exp, descriptor_t *desc, char *result)
{
char *build;
_normalize(result, result, 0);
}
}
+#endif
/**
* Truncate the fractional part away.
case FC_PACKED:
default:
- snprintf(buf, buflen, "%s", sc_print(_pack(val, mul_1), value_size*4, SC_HEX));
+ snprintf(buf, buflen, "%s", sc_print(_pack(val, mul_1), value_size*4, SC_HEX, 0));
+ buf[buflen - 1] = '\0';
break;
}
return buf;
calc_buffer_size = DESCRIPTOR_POS + sizeof(descriptor_t);
calc_buffer = xmalloc(calc_buffer_size);
+ memset(calc_buffer, 0, calc_buffer_size);
DEBUGPRINTF(("init fltcalc:\n\tVALUE_SIZE = %d\n\tSIGN_POS = %d\n\tEXPONENT_POS = %d\n\tMANTISSA_POS = %d\n\tDESCRIPTOR_POS = %d\n\tCALC_BUFFER_SIZE = %d\n\tcalc_buffer = %p\n\n", value_size, SIGN_POS, EXPONENT_POS, MANTISSA_POS, DESCRIPTOR_POS, calc_buffer_size, calc_buffer));
#ifdef HAVE_LONG_DOUBLE
DEBUGPRINTF(("\tUsing long double (1-15-64) interface\n"));