PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_f2d()

static void test_f2d ( void  )
static

Definition at line 667 of file cu_libgeom.c.

References next_float_down(), and next_float_up().

Referenced by libgeom_suite_setup().

668 {
669  double d = 1000000.123456789123456789;
670  float f;
671  double e;
672 
673  f = next_float_down(d);
674  d = next_float_down(f);
675  CU_ASSERT_DOUBLE_EQUAL(f,d, 0.0000001);
676 
677  e = (double)f;
678  CU_ASSERT_DOUBLE_EQUAL(f,e, 0.0000001);
679 
680  f = next_float_down(d);
681  d = next_float_down(f);
682  CU_ASSERT_DOUBLE_EQUAL(f,d, 0.0000001);
683 
684  f = next_float_up(d);
685  d = next_float_up(f);
686  CU_ASSERT_DOUBLE_EQUAL(f,d, 0.0000001);
687 
688  f = next_float_up(d);
689  d = next_float_up(f);
690  CU_ASSERT_DOUBLE_EQUAL(f,d, 0.0000001);
691 
692  d = DBL_MAX;
693  f = next_float_up(d);
694  d = next_float_up(f);
695  CU_ASSERT_DOUBLE_EQUAL(f, d, 0.0000001);
696 
697  d = DBL_MAX;
698  f = next_float_down(d);
699  d = next_float_down(f);
700  CU_ASSERT_DOUBLE_EQUAL(f, d, 0.0000001);
701 
702  d = -DBL_MAX;
703  f = next_float_up(d);
704  d = next_float_up(f);
705  CU_ASSERT_DOUBLE_EQUAL(f, d, 0.0000001);
706 
707  d = -DBL_MAX;
708  f = next_float_down(d);
709  d = next_float_down(f);
710  CU_ASSERT_DOUBLE_EQUAL(f, d, 0.0000001);
711 }
float next_float_down(double d)
Definition: lwgeom_api.c:51
float next_float_up(double d)
Definition: lwgeom_api.c:72
Here is the call graph for this function:
Here is the caller graph for this function: