Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Strange Gmpzf behavior?

Subject: CGAL users discussion list

List archive

[cgal-discuss] Strange Gmpzf behavior?


Chronological Thread 
  • From: Adam Getchell <>
  • To:
  • Subject: [cgal-discuss] Strange Gmpzf behavior?
  • Date: Fri, 23 Jan 2015 10:05:47 -0800

Hello all,

For this piece of code:

const long double tolerance{0.05};

CGAL::Gmpzf Bulk_action = S3_bulk_action(N1_TL, N3_31, N3_22,
    Alpha, K, Lambda);
  CGAL::Gmpzf Bulk_action_one = S3_bulk_action_alpha_one(N1_TL,
    N3_31, N3_22, K, Lambda);
  std::cout << (1.0-tolerance) << std::endl;
  CGAL::Gmpzf min(abs(Bulk_action_one*(1.0-tolerance)));
  std::cout << "(Gmpzf) min = " << min << std::endl;
  std::cout << (1.0+tolerance) << std::endl;
  CGAL::Gmpzf max = abs(Bulk_action_one*(1.0+tolerance));
  std::cout << "(Gmpzf) max = " << max << std::endl;

  ASSERT_THAT(abs(Bulk_action), AllOf(Ge(min), Le(max)))
    << "General Bulk action does not match Bulk action for alpha=1.";

In this file:

https://github.com/acgetchell/CDT-plusplus/blob/master/unittests/S3BulkActionTest.cpp

Gmpzf(1.0-tolerance) = 0, yet Gmpzf(1.0+tolerance) gives the normal value:

┌─[adam][Hapkido][±][master ][~/CDT-plusplus]

└─▪ ./build/unittests --gtest_filter=S3BulkAction.GeneralBulkActionE*

Note: Google Test filter = S3BulkAction.GeneralBulkActionE*

[==========] Running 1 test from 1 test case.

[----------] Global test environment set-up.

[----------] 1 test from S3BulkAction

[ RUN      ] S3BulkAction.GeneralBulkActionEquivalentToAlpha1BulkAction

Generating universe ...

Pass #1

Fixing foliation....

Pass #2

Fixing foliation....

Pass #3

Fixing foliation....

Pass #4

Fixing foliation....

Classifying simplices....

Valid foliation: true

Delaunay triangulation has 97319 cells.

There are 30317 (3,1) simplices and 36366 (2,2) simplices and 30636 (1,3) simplices.

N1_SL = 45985

N1_TL = 66956

(Unsigned) N1_TL = 66956

(Unsigned) N3_31 = 60953

(Unsigned) N3_22 = 36366

(Long double) Alpha = 1

(Long double) K = 1.1

(Long double) Lambda = 2.2

result is -2.800688724949974576737072783301035236228214800450166604257791276251275672232602e483

result is -2.804983342973199104573080939525782360659232139621072320577600041374197112669744e483

0.95

(Gmpzf) min = 0

1.05

(Gmpzf) max = 28049.8

[       OK ] S3BulkAction.GeneralBulkActionEquivalentToAlpha1BulkAction (2086 ms)

[----------] 1 test from S3BulkAction (2086 ms total)


[----------] Global test environment tear-down

[==========] 1 test from 1 test case ran. (2086 ms total)

[  PASSED  ] 1 test.


Is this a bug, or am I misusing Gmpzf?
--
Adam Getchell
"Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu



Archive powered by MHonArc 2.6.18.

Top of Page