Previously, the base math headers included GMP headers in all cases. This was problematic because we don't want all modules that use the math headers to depend on GMP, and the unnecessary includes could theoretically have detrimental effects to compile times. Now `BLI_math_mpq.hh` depends on `BLI_math_base.hh`, so if a file needs to use exact arithmatic, it can just include the former. Differential Revision: https://developer.blender.org/D15079
29 lines
726 B
C++
29 lines
726 B
C++
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup bli
|
|
*/
|
|
|
|
#ifdef WITH_GMP
|
|
|
|
/* This file uses an external file header to define the multi-precision
|
|
* rational type, mpq_class.
|
|
* This class keeps separate multi-precision integer numerator and
|
|
* denominator, reduced to lowest terms after each arithmetic operation.
|
|
* It can be used where it is important to have exact arithmetic results.
|
|
*
|
|
* See gmplib.org for full documentation. In particular:
|
|
* https://gmplib.org/manual/C_002b_002b-Interface-Rationals
|
|
*/
|
|
# include "gmpxx.h"
|
|
|
|
# include "BLI_math_base.hh"
|
|
|
|
namespace blender::math {
|
|
template<> inline constexpr bool is_math_float_type<mpq_class> = true;
|
|
}
|
|
|
|
#endif /* WITH_GMP */
|