[Vm-dev] ffi-test-main.c fails on FreeBSD
John M McIntosh
johnmci at smalltalkconsulting.com
Thu Nov 19 17:29:50 UTC 2009
> define FLT_EPSILON as something like 1e-20 and rewrite the check as CHECK(fabs(f - ff) < FLT_EPSILON)?
> In math epsilon is a small value tending towards zero. The intent here is to check that you get back something close to ff without assuming that the floating-point arithmetic involved in many is exact enough to return ff.
Ok, the implication then for testing is that
modify the floating point value slightly, if that is acceptable
then you need to epsilon test.
also GCC seems to define
#define FLT_EPSILON 1.19209290e-07F
across all flavours of CPUs and float word lengths.
perhaps via "float.h"
John M. McIntosh <johnmci at smalltalkconsulting.com> Twitter: squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
More information about the Vm-dev