PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_lwprint_roundtrip()

static void test_lwprint_roundtrip ( void  )
static

Definition at line 519 of file cu_print.c.

520{
521 /* Test roundtrip with the first value outside the range that's always printed as zero */
523 assert_lwprint_roundtrip(nextafter(-FP_TOLERANCE, -1));
524
525 /* Test roundtrip in around the switch to scientific notation */
530 assert_lwprint_roundtrip(nextafter(OUT_MAX_DOUBLE, INFINITY));
531 assert_lwprint_roundtrip(nextafter(-OUT_MAX_DOUBLE, -INFINITY));
532
533 /* Test some numbers */
535 assert_lwprint_roundtrip(0.0000000298023223876953125);
538 assert_lwprint_roundtrip(7000109.9999999990686774253845214843750000000000);
539 assert_lwprint_roundtrip(6917529027641081856.0);
542 assert_lwprint_roundtrip(9.000000000000001e+300);
543 assert_lwprint_roundtrip(-9.000000000000001e+300);
544
545 /* Even if we write the **same** number differently as the (compiler) input the roundtrip is guaranteed */
546 assert_lwprint_roundtrip(149.57565307617187);
547 assert_lwprint_roundtrip(149.57565307617188);
548 assert_lwprint_roundtrip(-149.57565307617187);
549 assert_lwprint_roundtrip(-149.57565307617188);
550
551 /* Extremes */
552 assert_lwprint_roundtrip(2.2250738585072014e-308); /* We normalize small numbers to 0 */
553 assert_lwprint_roundtrip(1.7976931348623157e+308);
554 assert_lwprint_roundtrip(2.9802322387695312E-8);
555
556 /* Special cases */
557 assert_lwprint_roundtrip(-0); /* -0 is considered equal to 0 */
558
559 /* Disabled because Windows / MinGW doesn't like them (#4735)
560 * assert_lwprint_roundtrip(INFINITY);
561 * assert_lwprint_roundtrip(-INFINITY);
562 */
563
564 /* nan is never equal to nan
565 * assert_lwprint_roundtrip(NAN);
566 */
567}
#define assert_lwprint_roundtrip(d)
Definition cu_print.c:511
#define OUT_MAX_DOUBLE
#define FP_TOLERANCE
Floating point comparators.

References assert_lwprint_roundtrip, FP_TOLERANCE, and OUT_MAX_DOUBLE.

Referenced by print_suite_setup().

Here is the caller graph for this function: