units
Use physical dimensions at compile-time or run-time.
Functions
common-denom-test.cpp File Reference

Test-case for vnix::common_denom_params. More...

#include "../vnix/rat.hpp"
#include "catch.hpp"
Include dependency graph for common-denom-test.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("Number of bits is properly clamped.","[common-denom-params]")
 

Detailed Description

Test-case for vnix::common_denom_params.

License: BSD three-clause; see LICENSE.

Definition in file common-denom-test.cpp.

Function Documentation

TEST_CASE ( "Number of bits is properly clamped."  ,
""  [common-denom-params] 
)

Definition at line 12 of file common-denom-test.cpp.

12  {
13  rational<36, 28> r1(3,4);
14  rational<28, 36> r2(11,12);
15  auto cdp = common_denom(r1, r2);
16  using CDP = decltype(cdp);
17  REQUIRE(CDP::LCD_BITS == 64);
18  REQUIRE(CDP::N1_BITS == 64);
19  REQUIRE(CDP::N2_BITS == 56);
20 }
constexpr common_denom_params< NB1, DB1, NB2, DB2 > common_denom(rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
Compute least common denominator and corresponding numerators for the comparison of a pair of rationa...
Model of a fixed-precision rational number.
Definition: rational.hpp:27

Here is the call graph for this function: