#include "lisp.h"
#include "sysproc.h" /* For qxe_getpid */
-#include "ent-float.h"
+#include "ent.h"
\f
Lisp_Object Vmost_positive_float;
\f
static Lisp_Object
-mark_float(Lisp_Object obj)
+mark_float(Lisp_Object SXE_UNUSED(obj))
{
return Qnil;
-
- if (obj);
}
static inline int
-float_equal(Lisp_Object obj1, Lisp_Object obj2, int depth)
+float_equal(Lisp_Object obj1, Lisp_Object obj2, int SXE_UNUSED(depth))
{
return (ent_float(obj1) == ent_float(obj2));
-
- if (depth);
}
static inline unsigned long
-float_hash(Lisp_Object obj, int UNUSED(depth))
+float_hash(Lisp_Object obj, int SXE_UNUSED(depth))
{
#if 1
fpfloat h = 22.0/7.0*ent_float(obj);
{
char pigbuf[350]; /* see comments in float_to_string */
- float_to_string(pigbuf, XFLOAT_DATA(obj));
+ float_to_string(pigbuf, XFLOAT_DATA(obj), sizeof(pigbuf));
write_c_string(pigbuf, printcharfun);
}
}
static inline Lisp_Object
-ent_rem_FLOAT_T(Lisp_Object l, Lisp_Object r)
+ent_rem_FLOAT_T(Lisp_Object SXE_UNUSED(l), Lisp_Object SXE_UNUSED(r))
{
- if (l);
return make_float(0.0);
}
static inline Lisp_Object
-ent_rem_FLOAT_T_INT_T(Lisp_Object l, Lisp_Object r)
+ent_rem_FLOAT_T_INT_T(Lisp_Object SXE_UNUSED(l), Lisp_Object SXE_UNUSED(r))
{
- if (l);
return make_float(0.0);
}
return make_float(ent_int(number));
}
static inline Lisp_Object
-_ent_lift_INT_T_FLOAT_T(Lisp_Object number, ent_lift_args_t UNUSED(unused))
+_ent_lift_INT_T_FLOAT_T(Lisp_Object number, ent_lift_args_t SXE_UNUSED(unused))
{
return make_float(ent_int(number));
}
return Ftruncate(number);
}
static inline Lisp_Object
-_ent_lift_FLOAT_T_INT_T(Lisp_Object number, ent_lift_args_t UNUSED(unused))
+_ent_lift_FLOAT_T_INT_T(Lisp_Object number, ent_lift_args_t SXE_UNUSED(unused))
{
return Ftruncate(number);
}
*/);
Vmost_negative_float = make_float(fp);
+ {
+ char tmp[] = "1.0";
/* let's compute the array we need to print such a float */
#if fpfloat_double_p
- max_float_print_size = snprintf(NULL, 0, "%f", fp) + 10;
+ max_float_print_size = snprintf(tmp, sizeof(tmp), "%f", fp);
#elif fpfloat_long_double_p
- max_float_print_size = snprintf(NULL, 0, "%Lf", fp) + 10;
+ max_float_print_size = snprintf(tmp, sizeof(tmp), "%Lf", fp);
#endif
+ }
+ assert(max_float_print_size>0);
+ max_float_print_size += 10;
DEFVAR_CONST_INT("max-float-print-size", &max_float_print_size /*
The maximal string length of a printed float.
*/);
Vleast_negative_float = make_float(fp);
- f = 1.0;
- while ((fp = f, f /= 2) * 2 == fp && f != 0);
+ for( f = fp = 1.0; (f /= 2) * 2 == fp && f != 0; fp = f );
DEFVAR_CONST_LISP("least-positive-normalised-float",
&Vleast_positive_normalised_float /*
The float closest in value to +0 without rounding errors.
*/);
Vleast_positive_normalised_float = make_float(fp);
- f = -1.0;
- while ((fp = f, f /= 2) * 2 == fp && f != 0);
+ for( f = fp = -1.0; ( f /= 2) * 2 == fp && f != 0; fp = f);
DEFVAR_CONST_LISP("least-negative-normalised-float",
&Vleast_negative_normalised_float /*
The float closest in value to -0 without rounding errors.