mqt-core 3.3.2__cp314-cp314t-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. mqt/core/__init__.py +77 -0
  2. mqt/core/__main__.py +55 -0
  3. mqt/core/_commands.py +52 -0
  4. mqt/core/_compat/__init__.py +11 -0
  5. mqt/core/_compat/typing.py +29 -0
  6. mqt/core/_version.py +34 -0
  7. mqt/core/_version.pyi +12 -0
  8. mqt/core/dd.cpython-314t-darwin.so +0 -0
  9. mqt/core/dd.pyi +1016 -0
  10. mqt/core/dd_evaluation.py +368 -0
  11. mqt/core/fomac.cpython-314t-darwin.so +0 -0
  12. mqt/core/fomac.pyi +125 -0
  13. mqt/core/include/mqt-core/algorithms/BernsteinVazirani.hpp +39 -0
  14. mqt/core/include/mqt-core/algorithms/GHZState.hpp +18 -0
  15. mqt/core/include/mqt-core/algorithms/Grover.hpp +33 -0
  16. mqt/core/include/mqt-core/algorithms/QFT.hpp +21 -0
  17. mqt/core/include/mqt-core/algorithms/QPE.hpp +30 -0
  18. mqt/core/include/mqt-core/algorithms/RandomCliffordCircuit.hpp +22 -0
  19. mqt/core/include/mqt-core/algorithms/StatePreparation.hpp +43 -0
  20. mqt/core/include/mqt-core/algorithms/WState.hpp +18 -0
  21. mqt/core/include/mqt-core/algorithms/mqt_core_algorithms_export.h +43 -0
  22. mqt/core/include/mqt-core/boost/config/abi/borland_prefix.hpp +27 -0
  23. mqt/core/include/mqt-core/boost/config/abi/borland_suffix.hpp +12 -0
  24. mqt/core/include/mqt-core/boost/config/abi/msvc_prefix.hpp +22 -0
  25. mqt/core/include/mqt-core/boost/config/abi/msvc_suffix.hpp +8 -0
  26. mqt/core/include/mqt-core/boost/config/abi_prefix.hpp +25 -0
  27. mqt/core/include/mqt-core/boost/config/abi_suffix.hpp +25 -0
  28. mqt/core/include/mqt-core/boost/config/assert_cxx03.hpp +211 -0
  29. mqt/core/include/mqt-core/boost/config/assert_cxx11.hpp +212 -0
  30. mqt/core/include/mqt-core/boost/config/assert_cxx14.hpp +47 -0
  31. mqt/core/include/mqt-core/boost/config/assert_cxx17.hpp +65 -0
  32. mqt/core/include/mqt-core/boost/config/assert_cxx20.hpp +59 -0
  33. mqt/core/include/mqt-core/boost/config/assert_cxx23.hpp +41 -0
  34. mqt/core/include/mqt-core/boost/config/assert_cxx98.hpp +23 -0
  35. mqt/core/include/mqt-core/boost/config/auto_link.hpp +525 -0
  36. mqt/core/include/mqt-core/boost/config/compiler/borland.hpp +342 -0
  37. mqt/core/include/mqt-core/boost/config/compiler/clang.hpp +370 -0
  38. mqt/core/include/mqt-core/boost/config/compiler/clang_version.hpp +89 -0
  39. mqt/core/include/mqt-core/boost/config/compiler/codegear.hpp +389 -0
  40. mqt/core/include/mqt-core/boost/config/compiler/comeau.hpp +59 -0
  41. mqt/core/include/mqt-core/boost/config/compiler/common_edg.hpp +185 -0
  42. mqt/core/include/mqt-core/boost/config/compiler/compaq_cxx.hpp +19 -0
  43. mqt/core/include/mqt-core/boost/config/compiler/cray.hpp +446 -0
  44. mqt/core/include/mqt-core/boost/config/compiler/diab.hpp +26 -0
  45. mqt/core/include/mqt-core/boost/config/compiler/digitalmars.hpp +146 -0
  46. mqt/core/include/mqt-core/boost/config/compiler/gcc.hpp +386 -0
  47. mqt/core/include/mqt-core/boost/config/compiler/gcc_xml.hpp +115 -0
  48. mqt/core/include/mqt-core/boost/config/compiler/greenhills.hpp +28 -0
  49. mqt/core/include/mqt-core/boost/config/compiler/hp_acc.hpp +153 -0
  50. mqt/core/include/mqt-core/boost/config/compiler/intel.hpp +577 -0
  51. mqt/core/include/mqt-core/boost/config/compiler/kai.hpp +33 -0
  52. mqt/core/include/mqt-core/boost/config/compiler/metrowerks.hpp +201 -0
  53. mqt/core/include/mqt-core/boost/config/compiler/mpw.hpp +143 -0
  54. mqt/core/include/mqt-core/boost/config/compiler/nvcc.hpp +64 -0
  55. mqt/core/include/mqt-core/boost/config/compiler/pathscale.hpp +141 -0
  56. mqt/core/include/mqt-core/boost/config/compiler/pgi.hpp +23 -0
  57. mqt/core/include/mqt-core/boost/config/compiler/sgi_mipspro.hpp +29 -0
  58. mqt/core/include/mqt-core/boost/config/compiler/sunpro_cc.hpp +225 -0
  59. mqt/core/include/mqt-core/boost/config/compiler/vacpp.hpp +189 -0
  60. mqt/core/include/mqt-core/boost/config/compiler/visualc.hpp +398 -0
  61. mqt/core/include/mqt-core/boost/config/compiler/xlcpp.hpp +303 -0
  62. mqt/core/include/mqt-core/boost/config/compiler/xlcpp_zos.hpp +174 -0
  63. mqt/core/include/mqt-core/boost/config/detail/cxx_composite.hpp +218 -0
  64. mqt/core/include/mqt-core/boost/config/detail/posix_features.hpp +95 -0
  65. mqt/core/include/mqt-core/boost/config/detail/select_compiler_config.hpp +157 -0
  66. mqt/core/include/mqt-core/boost/config/detail/select_platform_config.hpp +147 -0
  67. mqt/core/include/mqt-core/boost/config/detail/select_stdlib_config.hpp +121 -0
  68. mqt/core/include/mqt-core/boost/config/detail/suffix.hpp +1334 -0
  69. mqt/core/include/mqt-core/boost/config/header_deprecated.hpp +26 -0
  70. mqt/core/include/mqt-core/boost/config/helper_macros.hpp +37 -0
  71. mqt/core/include/mqt-core/boost/config/no_tr1/cmath.hpp +28 -0
  72. mqt/core/include/mqt-core/boost/config/no_tr1/complex.hpp +28 -0
  73. mqt/core/include/mqt-core/boost/config/no_tr1/functional.hpp +28 -0
  74. mqt/core/include/mqt-core/boost/config/no_tr1/memory.hpp +28 -0
  75. mqt/core/include/mqt-core/boost/config/no_tr1/utility.hpp +28 -0
  76. mqt/core/include/mqt-core/boost/config/platform/aix.hpp +33 -0
  77. mqt/core/include/mqt-core/boost/config/platform/amigaos.hpp +15 -0
  78. mqt/core/include/mqt-core/boost/config/platform/beos.hpp +26 -0
  79. mqt/core/include/mqt-core/boost/config/platform/bsd.hpp +83 -0
  80. mqt/core/include/mqt-core/boost/config/platform/cloudabi.hpp +18 -0
  81. mqt/core/include/mqt-core/boost/config/platform/cray.hpp +18 -0
  82. mqt/core/include/mqt-core/boost/config/platform/cygwin.hpp +71 -0
  83. mqt/core/include/mqt-core/boost/config/platform/haiku.hpp +31 -0
  84. mqt/core/include/mqt-core/boost/config/platform/hpux.hpp +87 -0
  85. mqt/core/include/mqt-core/boost/config/platform/irix.hpp +31 -0
  86. mqt/core/include/mqt-core/boost/config/platform/linux.hpp +106 -0
  87. mqt/core/include/mqt-core/boost/config/platform/macos.hpp +87 -0
  88. mqt/core/include/mqt-core/boost/config/platform/qnxnto.hpp +31 -0
  89. mqt/core/include/mqt-core/boost/config/platform/solaris.hpp +31 -0
  90. mqt/core/include/mqt-core/boost/config/platform/symbian.hpp +97 -0
  91. mqt/core/include/mqt-core/boost/config/platform/vms.hpp +25 -0
  92. mqt/core/include/mqt-core/boost/config/platform/vxworks.hpp +422 -0
  93. mqt/core/include/mqt-core/boost/config/platform/wasm.hpp +23 -0
  94. mqt/core/include/mqt-core/boost/config/platform/win32.hpp +90 -0
  95. mqt/core/include/mqt-core/boost/config/platform/zos.hpp +32 -0
  96. mqt/core/include/mqt-core/boost/config/pragma_message.hpp +31 -0
  97. mqt/core/include/mqt-core/boost/config/requires_threads.hpp +92 -0
  98. mqt/core/include/mqt-core/boost/config/stdlib/dinkumware.hpp +324 -0
  99. mqt/core/include/mqt-core/boost/config/stdlib/libcomo.hpp +93 -0
  100. mqt/core/include/mqt-core/boost/config/stdlib/libcpp.hpp +180 -0
  101. mqt/core/include/mqt-core/boost/config/stdlib/libstdcpp3.hpp +482 -0
  102. mqt/core/include/mqt-core/boost/config/stdlib/modena.hpp +79 -0
  103. mqt/core/include/mqt-core/boost/config/stdlib/msl.hpp +98 -0
  104. mqt/core/include/mqt-core/boost/config/stdlib/roguewave.hpp +208 -0
  105. mqt/core/include/mqt-core/boost/config/stdlib/sgi.hpp +168 -0
  106. mqt/core/include/mqt-core/boost/config/stdlib/stlport.hpp +258 -0
  107. mqt/core/include/mqt-core/boost/config/stdlib/vacpp.hpp +74 -0
  108. mqt/core/include/mqt-core/boost/config/stdlib/xlcpp_zos.hpp +61 -0
  109. mqt/core/include/mqt-core/boost/config/user.hpp +133 -0
  110. mqt/core/include/mqt-core/boost/config/warning_disable.hpp +47 -0
  111. mqt/core/include/mqt-core/boost/config/workaround.hpp +305 -0
  112. mqt/core/include/mqt-core/boost/config.hpp +67 -0
  113. mqt/core/include/mqt-core/boost/cstdint.hpp +556 -0
  114. mqt/core/include/mqt-core/boost/cxx11_char_types.hpp +70 -0
  115. mqt/core/include/mqt-core/boost/detail/workaround.hpp +10 -0
  116. mqt/core/include/mqt-core/boost/limits.hpp +146 -0
  117. mqt/core/include/mqt-core/boost/multiprecision/complex128.hpp +24 -0
  118. mqt/core/include/mqt-core/boost/multiprecision/complex_adaptor.hpp +1046 -0
  119. mqt/core/include/mqt-core/boost/multiprecision/concepts/mp_number_archetypes.hpp +257 -0
  120. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/io.hpp +698 -0
  121. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/transcendental.hpp +157 -0
  122. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float.hpp +2297 -0
  123. mqt/core/include/mqt-core/boost/multiprecision/cpp_complex.hpp +12 -0
  124. mqt/core/include/mqt-core/boost/multiprecision/cpp_dec_float.hpp +3690 -0
  125. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add.hpp +368 -0
  126. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add_unsigned.hpp +387 -0
  127. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/bitwise.hpp +889 -0
  128. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/checked.hpp +178 -0
  129. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/comparison.hpp +374 -0
  130. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/cpp_int_config.hpp +161 -0
  131. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/divide.hpp +703 -0
  132. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/import_export.hpp +248 -0
  133. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/intel_intrinsics.hpp +138 -0
  134. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/limits.hpp +282 -0
  135. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/literals.hpp +295 -0
  136. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/misc.hpp +1457 -0
  137. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/multiply.hpp +848 -0
  138. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/serialize.hpp +211 -0
  139. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/value_pack.hpp +42 -0
  140. mqt/core/include/mqt-core/boost/multiprecision/cpp_int.hpp +2360 -0
  141. mqt/core/include/mqt-core/boost/multiprecision/debug_adaptor.hpp +760 -0
  142. mqt/core/include/mqt-core/boost/multiprecision/detail/assert.hpp +29 -0
  143. mqt/core/include/mqt-core/boost/multiprecision/detail/atomic.hpp +62 -0
  144. mqt/core/include/mqt-core/boost/multiprecision/detail/bitscan.hpp +317 -0
  145. mqt/core/include/mqt-core/boost/multiprecision/detail/check_cpp11_config.hpp +64 -0
  146. mqt/core/include/mqt-core/boost/multiprecision/detail/constexpr.hpp +88 -0
  147. mqt/core/include/mqt-core/boost/multiprecision/detail/default_ops.hpp +4052 -0
  148. mqt/core/include/mqt-core/boost/multiprecision/detail/digits.hpp +49 -0
  149. mqt/core/include/mqt-core/boost/multiprecision/detail/dynamic_array.hpp +44 -0
  150. mqt/core/include/mqt-core/boost/multiprecision/detail/empty_value.hpp +87 -0
  151. mqt/core/include/mqt-core/boost/multiprecision/detail/endian.hpp +35 -0
  152. mqt/core/include/mqt-core/boost/multiprecision/detail/et_ops.hpp +1831 -0
  153. mqt/core/include/mqt-core/boost/multiprecision/detail/float128_functions.hpp +95 -0
  154. mqt/core/include/mqt-core/boost/multiprecision/detail/float_string_cvt.hpp +333 -0
  155. mqt/core/include/mqt-core/boost/multiprecision/detail/fpclassify.hpp +101 -0
  156. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/constants.hpp +288 -0
  157. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/pow.hpp +905 -0
  158. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trig.hpp +1058 -0
  159. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trunc.hpp +82 -0
  160. mqt/core/include/mqt-core/boost/multiprecision/detail/generic_interconvert.hpp +687 -0
  161. mqt/core/include/mqt-core/boost/multiprecision/detail/hash.hpp +56 -0
  162. mqt/core/include/mqt-core/boost/multiprecision/detail/integer_ops.hpp +474 -0
  163. mqt/core/include/mqt-core/boost/multiprecision/detail/itos.hpp +39 -0
  164. mqt/core/include/mqt-core/boost/multiprecision/detail/min_max.hpp +106 -0
  165. mqt/core/include/mqt-core/boost/multiprecision/detail/no_et_ops.hpp +661 -0
  166. mqt/core/include/mqt-core/boost/multiprecision/detail/no_exceptions_support.hpp +55 -0
  167. mqt/core/include/mqt-core/boost/multiprecision/detail/number_base.hpp +1656 -0
  168. mqt/core/include/mqt-core/boost/multiprecision/detail/number_compare.hpp +848 -0
  169. mqt/core/include/mqt-core/boost/multiprecision/detail/precision.hpp +313 -0
  170. mqt/core/include/mqt-core/boost/multiprecision/detail/rebind.hpp +19 -0
  171. mqt/core/include/mqt-core/boost/multiprecision/detail/standalone_config.hpp +148 -0
  172. mqt/core/include/mqt-core/boost/multiprecision/detail/static_array.hpp +42 -0
  173. mqt/core/include/mqt-core/boost/multiprecision/detail/string_helpers.hpp +48 -0
  174. mqt/core/include/mqt-core/boost/multiprecision/detail/tables.hpp +80 -0
  175. mqt/core/include/mqt-core/boost/multiprecision/detail/ublas_interop.hpp +75 -0
  176. mqt/core/include/mqt-core/boost/multiprecision/detail/uniform_int_distribution.hpp +212 -0
  177. mqt/core/include/mqt-core/boost/multiprecision/detail/utype_helper.hpp +374 -0
  178. mqt/core/include/mqt-core/boost/multiprecision/eigen.hpp +248 -0
  179. mqt/core/include/mqt-core/boost/multiprecision/float128.hpp +920 -0
  180. mqt/core/include/mqt-core/boost/multiprecision/fwd.hpp +268 -0
  181. mqt/core/include/mqt-core/boost/multiprecision/gmp.hpp +4060 -0
  182. mqt/core/include/mqt-core/boost/multiprecision/integer.hpp +363 -0
  183. mqt/core/include/mqt-core/boost/multiprecision/logged_adaptor.hpp +834 -0
  184. mqt/core/include/mqt-core/boost/multiprecision/miller_rabin.hpp +221 -0
  185. mqt/core/include/mqt-core/boost/multiprecision/mpc.hpp +1721 -0
  186. mqt/core/include/mqt-core/boost/multiprecision/mpfi.hpp +2559 -0
  187. mqt/core/include/mqt-core/boost/multiprecision/mpfr.hpp +3644 -0
  188. mqt/core/include/mqt-core/boost/multiprecision/number.hpp +2500 -0
  189. mqt/core/include/mqt-core/boost/multiprecision/random.hpp +23 -0
  190. mqt/core/include/mqt-core/boost/multiprecision/rational_adaptor.hpp +1289 -0
  191. mqt/core/include/mqt-core/boost/multiprecision/tommath.hpp +1034 -0
  192. mqt/core/include/mqt-core/boost/multiprecision/traits/explicit_conversion.hpp +67 -0
  193. mqt/core/include/mqt-core/boost/multiprecision/traits/extract_exponent_type.hpp +28 -0
  194. mqt/core/include/mqt-core/boost/multiprecision/traits/is_backend.hpp +91 -0
  195. mqt/core/include/mqt-core/boost/multiprecision/traits/is_byte_container.hpp +51 -0
  196. mqt/core/include/mqt-core/boost/multiprecision/traits/is_complex.hpp +22 -0
  197. mqt/core/include/mqt-core/boost/multiprecision/traits/is_convertible_arithmetic.hpp +51 -0
  198. mqt/core/include/mqt-core/boost/multiprecision/traits/is_restricted_conversion.hpp +47 -0
  199. mqt/core/include/mqt-core/boost/multiprecision/traits/is_variable_precision.hpp +25 -0
  200. mqt/core/include/mqt-core/boost/multiprecision/traits/max_digits10.hpp +79 -0
  201. mqt/core/include/mqt-core/boost/multiprecision/traits/std_integer_traits.hpp +90 -0
  202. mqt/core/include/mqt-core/boost/multiprecision/traits/transcendental_reduction_type.hpp +21 -0
  203. mqt/core/include/mqt-core/boost/version.hpp +32 -0
  204. mqt/core/include/mqt-core/circuit_optimizer/CircuitOptimizer.hpp +119 -0
  205. mqt/core/include/mqt-core/circuit_optimizer/mqt_core_circuit_optimizer_export.h +43 -0
  206. mqt/core/include/mqt-core/datastructures/DirectedAcyclicGraph.hpp +117 -0
  207. mqt/core/include/mqt-core/datastructures/DirectedGraph.hpp +158 -0
  208. mqt/core/include/mqt-core/datastructures/DisjointSet.hpp +50 -0
  209. mqt/core/include/mqt-core/datastructures/Layer.hpp +172 -0
  210. mqt/core/include/mqt-core/datastructures/SymmetricMatrix.hpp +57 -0
  211. mqt/core/include/mqt-core/datastructures/UndirectedGraph.hpp +227 -0
  212. mqt/core/include/mqt-core/datastructures/mqt_core_ds_export.h +43 -0
  213. mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
  214. mqt/core/include/mqt-core/dd/CachedEdge.hpp +174 -0
  215. mqt/core/include/mqt-core/dd/Complex.hpp +165 -0
  216. mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +150 -0
  217. mqt/core/include/mqt-core/dd/ComplexValue.hpp +184 -0
  218. mqt/core/include/mqt-core/dd/ComputeTable.hpp +183 -0
  219. mqt/core/include/mqt-core/dd/DDDefinitions.hpp +139 -0
  220. mqt/core/include/mqt-core/dd/DDpackageConfig.hpp +104 -0
  221. mqt/core/include/mqt-core/dd/DensityNoiseTable.hpp +114 -0
  222. mqt/core/include/mqt-core/dd/Edge.hpp +416 -0
  223. mqt/core/include/mqt-core/dd/Export.hpp +438 -0
  224. mqt/core/include/mqt-core/dd/FunctionalityConstruction.hpp +75 -0
  225. mqt/core/include/mqt-core/dd/GateMatrixDefinitions.hpp +43 -0
  226. mqt/core/include/mqt-core/dd/LinkedListBase.hpp +45 -0
  227. mqt/core/include/mqt-core/dd/MemoryManager.hpp +193 -0
  228. mqt/core/include/mqt-core/dd/Node.hpp +223 -0
  229. mqt/core/include/mqt-core/dd/NoiseFunctionality.hpp +144 -0
  230. mqt/core/include/mqt-core/dd/Operations.hpp +306 -0
  231. mqt/core/include/mqt-core/dd/Package.hpp +2036 -0
  232. mqt/core/include/mqt-core/dd/Package_fwd.hpp +22 -0
  233. mqt/core/include/mqt-core/dd/RealNumber.hpp +255 -0
  234. mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +217 -0
  235. mqt/core/include/mqt-core/dd/Simulation.hpp +98 -0
  236. mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
  237. mqt/core/include/mqt-core/dd/StochasticNoiseOperationTable.hpp +88 -0
  238. mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +121 -0
  239. mqt/core/include/mqt-core/dd/UniqueTable.hpp +243 -0
  240. mqt/core/include/mqt-core/dd/mqt_core_dd_export.h +43 -0
  241. mqt/core/include/mqt-core/dd/statistics/MemoryManagerStatistics.hpp +84 -0
  242. mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +55 -0
  243. mqt/core/include/mqt-core/dd/statistics/Statistics.hpp +48 -0
  244. mqt/core/include/mqt-core/dd/statistics/TableStatistics.hpp +79 -0
  245. mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +31 -0
  246. mqt/core/include/mqt-core/fomac/FoMaC.hpp +568 -0
  247. mqt/core/include/mqt-core/ir/Definitions.hpp +108 -0
  248. mqt/core/include/mqt-core/ir/Permutation.hpp +213 -0
  249. mqt/core/include/mqt-core/ir/QuantumComputation.hpp +596 -0
  250. mqt/core/include/mqt-core/ir/Register.hpp +125 -0
  251. mqt/core/include/mqt-core/ir/mqt_core_ir_export.h +43 -0
  252. mqt/core/include/mqt-core/ir/operations/AodOperation.hpp +92 -0
  253. mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +212 -0
  254. mqt/core/include/mqt-core/ir/operations/Control.hpp +142 -0
  255. mqt/core/include/mqt-core/ir/operations/Expression.hpp +847 -0
  256. mqt/core/include/mqt-core/ir/operations/IfElseOperation.hpp +169 -0
  257. mqt/core/include/mqt-core/ir/operations/NonUnitaryOperation.hpp +118 -0
  258. mqt/core/include/mqt-core/ir/operations/OpType.hpp +120 -0
  259. mqt/core/include/mqt-core/ir/operations/OpType.inc +76 -0
  260. mqt/core/include/mqt-core/ir/operations/Operation.hpp +247 -0
  261. mqt/core/include/mqt-core/ir/operations/StandardOperation.hpp +140 -0
  262. mqt/core/include/mqt-core/ir/operations/SymbolicOperation.hpp +144 -0
  263. mqt/core/include/mqt-core/mqt_na_qdmi/device.h +602 -0
  264. mqt/core/include/mqt-core/mqt_na_qdmi/types.h +78 -0
  265. mqt/core/include/mqt-core/na/NAComputation.hpp +185 -0
  266. mqt/core/include/mqt-core/na/device/Device.hpp +410 -0
  267. mqt/core/include/mqt-core/na/device/DeviceMemberInitializers.hpp +724 -0
  268. mqt/core/include/mqt-core/na/device/Generator.hpp +447 -0
  269. mqt/core/include/mqt-core/na/entities/Atom.hpp +62 -0
  270. mqt/core/include/mqt-core/na/entities/Location.hpp +154 -0
  271. mqt/core/include/mqt-core/na/entities/Zone.hpp +95 -0
  272. mqt/core/include/mqt-core/na/fomac/Device.hpp +169 -0
  273. mqt/core/include/mqt-core/na/mqt_core_na_export.h +43 -0
  274. mqt/core/include/mqt-core/na/operations/GlobalCZOp.hpp +38 -0
  275. mqt/core/include/mqt-core/na/operations/GlobalOp.hpp +58 -0
  276. mqt/core/include/mqt-core/na/operations/GlobalRYOp.hpp +42 -0
  277. mqt/core/include/mqt-core/na/operations/LoadOp.hpp +89 -0
  278. mqt/core/include/mqt-core/na/operations/LocalOp.hpp +56 -0
  279. mqt/core/include/mqt-core/na/operations/LocalRZOp.hpp +42 -0
  280. mqt/core/include/mqt-core/na/operations/LocalUOp.hpp +49 -0
  281. mqt/core/include/mqt-core/na/operations/MoveOp.hpp +66 -0
  282. mqt/core/include/mqt-core/na/operations/Op.hpp +62 -0
  283. mqt/core/include/mqt-core/na/operations/ShuttlingOp.hpp +51 -0
  284. mqt/core/include/mqt-core/na/operations/StoreOp.hpp +87 -0
  285. mqt/core/include/mqt-core/qasm3/Exception.hpp +85 -0
  286. mqt/core/include/mqt-core/qasm3/Gate.hpp +65 -0
  287. mqt/core/include/mqt-core/qasm3/Importer.hpp +192 -0
  288. mqt/core/include/mqt-core/qasm3/InstVisitor.hpp +145 -0
  289. mqt/core/include/mqt-core/qasm3/NestedEnvironment.hpp +41 -0
  290. mqt/core/include/mqt-core/qasm3/Parser.hpp +170 -0
  291. mqt/core/include/mqt-core/qasm3/Scanner.hpp +73 -0
  292. mqt/core/include/mqt-core/qasm3/Statement.hpp +486 -0
  293. mqt/core/include/mqt-core/qasm3/Statement_fwd.hpp +39 -0
  294. mqt/core/include/mqt-core/qasm3/StdGates.hpp +232 -0
  295. mqt/core/include/mqt-core/qasm3/Token.hpp +198 -0
  296. mqt/core/include/mqt-core/qasm3/Types.hpp +238 -0
  297. mqt/core/include/mqt-core/qasm3/Types_fwd.hpp +22 -0
  298. mqt/core/include/mqt-core/qasm3/mqt_core_qasm_export.h +43 -0
  299. mqt/core/include/mqt-core/qasm3/passes/CompilerPass.hpp +22 -0
  300. mqt/core/include/mqt-core/qasm3/passes/ConstEvalPass.hpp +102 -0
  301. mqt/core/include/mqt-core/qasm3/passes/TypeCheckPass.hpp +124 -0
  302. mqt/core/include/mqt-core/qdmi/Driver.hpp +431 -0
  303. mqt/core/include/mqt-core/zx/FunctionalityConstruction.hpp +125 -0
  304. mqt/core/include/mqt-core/zx/Rational.hpp +318 -0
  305. mqt/core/include/mqt-core/zx/Rules.hpp +132 -0
  306. mqt/core/include/mqt-core/zx/Simplify.hpp +182 -0
  307. mqt/core/include/mqt-core/zx/Utils.hpp +212 -0
  308. mqt/core/include/mqt-core/zx/ZXDefinitions.hpp +93 -0
  309. mqt/core/include/mqt-core/zx/ZXDiagram.hpp +480 -0
  310. mqt/core/include/mqt-core/zx/mqt_core_zx_export.h +43 -0
  311. mqt/core/include/nlohmann/adl_serializer.hpp +55 -0
  312. mqt/core/include/nlohmann/byte_container_with_subtype.hpp +103 -0
  313. mqt/core/include/nlohmann/detail/abi_macros.hpp +111 -0
  314. mqt/core/include/nlohmann/detail/conversions/from_json.hpp +577 -0
  315. mqt/core/include/nlohmann/detail/conversions/to_chars.hpp +1118 -0
  316. mqt/core/include/nlohmann/detail/conversions/to_json.hpp +479 -0
  317. mqt/core/include/nlohmann/detail/exceptions.hpp +291 -0
  318. mqt/core/include/nlohmann/detail/hash.hpp +129 -0
  319. mqt/core/include/nlohmann/detail/input/binary_reader.hpp +3068 -0
  320. mqt/core/include/nlohmann/detail/input/input_adapters.hpp +549 -0
  321. mqt/core/include/nlohmann/detail/input/json_sax.hpp +986 -0
  322. mqt/core/include/nlohmann/detail/input/lexer.hpp +1643 -0
  323. mqt/core/include/nlohmann/detail/input/parser.hpp +519 -0
  324. mqt/core/include/nlohmann/detail/input/position_t.hpp +37 -0
  325. mqt/core/include/nlohmann/detail/iterators/internal_iterator.hpp +35 -0
  326. mqt/core/include/nlohmann/detail/iterators/iter_impl.hpp +760 -0
  327. mqt/core/include/nlohmann/detail/iterators/iteration_proxy.hpp +235 -0
  328. mqt/core/include/nlohmann/detail/iterators/iterator_traits.hpp +61 -0
  329. mqt/core/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +130 -0
  330. mqt/core/include/nlohmann/detail/iterators/primitive_iterator.hpp +132 -0
  331. mqt/core/include/nlohmann/detail/json_custom_base_class.hpp +39 -0
  332. mqt/core/include/nlohmann/detail/json_pointer.hpp +988 -0
  333. mqt/core/include/nlohmann/detail/json_ref.hpp +78 -0
  334. mqt/core/include/nlohmann/detail/macro_scope.hpp +595 -0
  335. mqt/core/include/nlohmann/detail/macro_unscope.hpp +46 -0
  336. mqt/core/include/nlohmann/detail/meta/call_std/begin.hpp +17 -0
  337. mqt/core/include/nlohmann/detail/meta/call_std/end.hpp +17 -0
  338. mqt/core/include/nlohmann/detail/meta/cpp_future.hpp +171 -0
  339. mqt/core/include/nlohmann/detail/meta/detected.hpp +70 -0
  340. mqt/core/include/nlohmann/detail/meta/identity_tag.hpp +21 -0
  341. mqt/core/include/nlohmann/detail/meta/is_sax.hpp +159 -0
  342. mqt/core/include/nlohmann/detail/meta/std_fs.hpp +29 -0
  343. mqt/core/include/nlohmann/detail/meta/type_traits.hpp +795 -0
  344. mqt/core/include/nlohmann/detail/meta/void_t.hpp +24 -0
  345. mqt/core/include/nlohmann/detail/output/binary_writer.hpp +1850 -0
  346. mqt/core/include/nlohmann/detail/output/output_adapters.hpp +147 -0
  347. mqt/core/include/nlohmann/detail/output/serializer.hpp +988 -0
  348. mqt/core/include/nlohmann/detail/string_concat.hpp +146 -0
  349. mqt/core/include/nlohmann/detail/string_escape.hpp +72 -0
  350. mqt/core/include/nlohmann/detail/string_utils.hpp +37 -0
  351. mqt/core/include/nlohmann/detail/value_t.hpp +118 -0
  352. mqt/core/include/nlohmann/json.hpp +5306 -0
  353. mqt/core/include/nlohmann/json_fwd.hpp +75 -0
  354. mqt/core/include/nlohmann/ordered_map.hpp +359 -0
  355. mqt/core/include/nlohmann/thirdparty/hedley/hedley.hpp +2045 -0
  356. mqt/core/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +158 -0
  357. mqt/core/include/qdmi/qdmi/client.h +990 -0
  358. mqt/core/include/qdmi/qdmi/constants.h +1139 -0
  359. mqt/core/include/qdmi/qdmi/device.h +602 -0
  360. mqt/core/include/qdmi/qdmi/types.h +78 -0
  361. mqt/core/include/spdlog/async.h +99 -0
  362. mqt/core/include/spdlog/async_logger-inl.h +84 -0
  363. mqt/core/include/spdlog/async_logger.h +74 -0
  364. mqt/core/include/spdlog/cfg/argv.h +40 -0
  365. mqt/core/include/spdlog/cfg/env.h +36 -0
  366. mqt/core/include/spdlog/cfg/helpers-inl.h +107 -0
  367. mqt/core/include/spdlog/cfg/helpers.h +29 -0
  368. mqt/core/include/spdlog/common-inl.h +68 -0
  369. mqt/core/include/spdlog/common.h +406 -0
  370. mqt/core/include/spdlog/details/backtracer-inl.h +63 -0
  371. mqt/core/include/spdlog/details/backtracer.h +45 -0
  372. mqt/core/include/spdlog/details/circular_q.h +115 -0
  373. mqt/core/include/spdlog/details/console_globals.h +28 -0
  374. mqt/core/include/spdlog/details/file_helper-inl.h +153 -0
  375. mqt/core/include/spdlog/details/file_helper.h +61 -0
  376. mqt/core/include/spdlog/details/fmt_helper.h +141 -0
  377. mqt/core/include/spdlog/details/log_msg-inl.h +44 -0
  378. mqt/core/include/spdlog/details/log_msg.h +40 -0
  379. mqt/core/include/spdlog/details/log_msg_buffer-inl.h +54 -0
  380. mqt/core/include/spdlog/details/log_msg_buffer.h +32 -0
  381. mqt/core/include/spdlog/details/mpmc_blocking_q.h +177 -0
  382. mqt/core/include/spdlog/details/null_mutex.h +35 -0
  383. mqt/core/include/spdlog/details/os-inl.h +606 -0
  384. mqt/core/include/spdlog/details/os.h +127 -0
  385. mqt/core/include/spdlog/details/periodic_worker-inl.h +26 -0
  386. mqt/core/include/spdlog/details/periodic_worker.h +58 -0
  387. mqt/core/include/spdlog/details/registry-inl.h +270 -0
  388. mqt/core/include/spdlog/details/registry.h +131 -0
  389. mqt/core/include/spdlog/details/synchronous_factory.h +22 -0
  390. mqt/core/include/spdlog/details/tcp_client-windows.h +135 -0
  391. mqt/core/include/spdlog/details/tcp_client.h +127 -0
  392. mqt/core/include/spdlog/details/thread_pool-inl.h +126 -0
  393. mqt/core/include/spdlog/details/thread_pool.h +117 -0
  394. mqt/core/include/spdlog/details/udp_client-windows.h +98 -0
  395. mqt/core/include/spdlog/details/udp_client.h +81 -0
  396. mqt/core/include/spdlog/details/windows_include.h +11 -0
  397. mqt/core/include/spdlog/fmt/bin_to_hex.h +224 -0
  398. mqt/core/include/spdlog/fmt/bundled/args.h +220 -0
  399. mqt/core/include/spdlog/fmt/bundled/base.h +2989 -0
  400. mqt/core/include/spdlog/fmt/bundled/chrono.h +2330 -0
  401. mqt/core/include/spdlog/fmt/bundled/color.h +637 -0
  402. mqt/core/include/spdlog/fmt/bundled/compile.h +539 -0
  403. mqt/core/include/spdlog/fmt/bundled/core.h +5 -0
  404. mqt/core/include/spdlog/fmt/bundled/fmt.license.rst +27 -0
  405. mqt/core/include/spdlog/fmt/bundled/format-inl.h +1948 -0
  406. mqt/core/include/spdlog/fmt/bundled/format.h +4244 -0
  407. mqt/core/include/spdlog/fmt/bundled/os.h +427 -0
  408. mqt/core/include/spdlog/fmt/bundled/ostream.h +167 -0
  409. mqt/core/include/spdlog/fmt/bundled/printf.h +633 -0
  410. mqt/core/include/spdlog/fmt/bundled/ranges.h +850 -0
  411. mqt/core/include/spdlog/fmt/bundled/std.h +728 -0
  412. mqt/core/include/spdlog/fmt/bundled/xchar.h +369 -0
  413. mqt/core/include/spdlog/fmt/chrono.h +23 -0
  414. mqt/core/include/spdlog/fmt/compile.h +23 -0
  415. mqt/core/include/spdlog/fmt/fmt.h +30 -0
  416. mqt/core/include/spdlog/fmt/ostr.h +23 -0
  417. mqt/core/include/spdlog/fmt/ranges.h +23 -0
  418. mqt/core/include/spdlog/fmt/std.h +24 -0
  419. mqt/core/include/spdlog/fmt/xchar.h +23 -0
  420. mqt/core/include/spdlog/formatter.h +17 -0
  421. mqt/core/include/spdlog/fwd.h +18 -0
  422. mqt/core/include/spdlog/logger-inl.h +198 -0
  423. mqt/core/include/spdlog/logger.h +379 -0
  424. mqt/core/include/spdlog/mdc.h +52 -0
  425. mqt/core/include/spdlog/pattern_formatter-inl.h +1340 -0
  426. mqt/core/include/spdlog/pattern_formatter.h +118 -0
  427. mqt/core/include/spdlog/sinks/android_sink.h +137 -0
  428. mqt/core/include/spdlog/sinks/ansicolor_sink-inl.h +142 -0
  429. mqt/core/include/spdlog/sinks/ansicolor_sink.h +116 -0
  430. mqt/core/include/spdlog/sinks/base_sink-inl.h +59 -0
  431. mqt/core/include/spdlog/sinks/base_sink.h +51 -0
  432. mqt/core/include/spdlog/sinks/basic_file_sink-inl.h +48 -0
  433. mqt/core/include/spdlog/sinks/basic_file_sink.h +66 -0
  434. mqt/core/include/spdlog/sinks/callback_sink.h +56 -0
  435. mqt/core/include/spdlog/sinks/daily_file_sink.h +254 -0
  436. mqt/core/include/spdlog/sinks/dist_sink.h +81 -0
  437. mqt/core/include/spdlog/sinks/dup_filter_sink.h +91 -0
  438. mqt/core/include/spdlog/sinks/hourly_file_sink.h +193 -0
  439. mqt/core/include/spdlog/sinks/kafka_sink.h +119 -0
  440. mqt/core/include/spdlog/sinks/mongo_sink.h +108 -0
  441. mqt/core/include/spdlog/sinks/msvc_sink.h +68 -0
  442. mqt/core/include/spdlog/sinks/null_sink.h +41 -0
  443. mqt/core/include/spdlog/sinks/ostream_sink.h +43 -0
  444. mqt/core/include/spdlog/sinks/qt_sinks.h +304 -0
  445. mqt/core/include/spdlog/sinks/ringbuffer_sink.h +67 -0
  446. mqt/core/include/spdlog/sinks/rotating_file_sink-inl.h +179 -0
  447. mqt/core/include/spdlog/sinks/rotating_file_sink.h +93 -0
  448. mqt/core/include/spdlog/sinks/sink-inl.h +22 -0
  449. mqt/core/include/spdlog/sinks/sink.h +34 -0
  450. mqt/core/include/spdlog/sinks/stdout_color_sinks-inl.h +38 -0
  451. mqt/core/include/spdlog/sinks/stdout_color_sinks.h +49 -0
  452. mqt/core/include/spdlog/sinks/stdout_sinks-inl.h +127 -0
  453. mqt/core/include/spdlog/sinks/stdout_sinks.h +84 -0
  454. mqt/core/include/spdlog/sinks/syslog_sink.h +104 -0
  455. mqt/core/include/spdlog/sinks/systemd_sink.h +121 -0
  456. mqt/core/include/spdlog/sinks/tcp_sink.h +75 -0
  457. mqt/core/include/spdlog/sinks/udp_sink.h +69 -0
  458. mqt/core/include/spdlog/sinks/win_eventlog_sink.h +260 -0
  459. mqt/core/include/spdlog/sinks/wincolor_sink-inl.h +172 -0
  460. mqt/core/include/spdlog/sinks/wincolor_sink.h +82 -0
  461. mqt/core/include/spdlog/spdlog-inl.h +96 -0
  462. mqt/core/include/spdlog/spdlog.h +357 -0
  463. mqt/core/include/spdlog/stopwatch.h +66 -0
  464. mqt/core/include/spdlog/tweakme.h +148 -0
  465. mqt/core/include/spdlog/version.h +11 -0
  466. mqt/core/ir/__init__.pyi +2078 -0
  467. mqt/core/ir/operations.pyi +1011 -0
  468. mqt/core/ir/registers.pyi +91 -0
  469. mqt/core/ir/symbolic.pyi +177 -0
  470. mqt/core/ir.cpython-314t-darwin.so +0 -0
  471. mqt/core/lib/libmqt-core-algorithms.3.3.2.dylib +0 -0
  472. mqt/core/lib/libmqt-core-algorithms.3.3.dylib +0 -0
  473. mqt/core/lib/libmqt-core-algorithms.dylib +0 -0
  474. mqt/core/lib/libmqt-core-circuit-optimizer.3.3.2.dylib +0 -0
  475. mqt/core/lib/libmqt-core-circuit-optimizer.3.3.dylib +0 -0
  476. mqt/core/lib/libmqt-core-circuit-optimizer.dylib +0 -0
  477. mqt/core/lib/libmqt-core-dd.3.3.2.dylib +0 -0
  478. mqt/core/lib/libmqt-core-dd.3.3.dylib +0 -0
  479. mqt/core/lib/libmqt-core-dd.dylib +0 -0
  480. mqt/core/lib/libmqt-core-ds.3.3.2.dylib +0 -0
  481. mqt/core/lib/libmqt-core-ds.3.3.dylib +0 -0
  482. mqt/core/lib/libmqt-core-ds.dylib +0 -0
  483. mqt/core/lib/libmqt-core-fomac.3.3.2.dylib +0 -0
  484. mqt/core/lib/libmqt-core-fomac.3.3.dylib +0 -0
  485. mqt/core/lib/libmqt-core-fomac.dylib +0 -0
  486. mqt/core/lib/libmqt-core-ir.3.3.2.dylib +0 -0
  487. mqt/core/lib/libmqt-core-ir.3.3.dylib +0 -0
  488. mqt/core/lib/libmqt-core-ir.dylib +0 -0
  489. mqt/core/lib/libmqt-core-na-fomac.3.3.2.dylib +0 -0
  490. mqt/core/lib/libmqt-core-na-fomac.3.3.dylib +0 -0
  491. mqt/core/lib/libmqt-core-na-fomac.dylib +0 -0
  492. mqt/core/lib/libmqt-core-na.3.3.2.dylib +0 -0
  493. mqt/core/lib/libmqt-core-na.3.3.dylib +0 -0
  494. mqt/core/lib/libmqt-core-na.dylib +0 -0
  495. mqt/core/lib/libmqt-core-qasm.3.3.2.dylib +0 -0
  496. mqt/core/lib/libmqt-core-qasm.3.3.dylib +0 -0
  497. mqt/core/lib/libmqt-core-qasm.dylib +0 -0
  498. mqt/core/lib/libmqt-core-qdmi-driver.3.3.2.dylib +0 -0
  499. mqt/core/lib/libmqt-core-qdmi-driver.3.3.dylib +0 -0
  500. mqt/core/lib/libmqt-core-qdmi-driver.dylib +0 -0
  501. mqt/core/lib/libmqt-core-qdmi-na-device-gen.a +0 -0
  502. mqt/core/lib/libmqt-core-qdmi-na-device.3.3.2.dylib +0 -0
  503. mqt/core/lib/libmqt-core-qdmi-na-device.3.3.dylib +0 -0
  504. mqt/core/lib/libmqt-core-qdmi-na-device.dylib +0 -0
  505. mqt/core/lib/libmqt-core-zx.3.3.2.dylib +0 -0
  506. mqt/core/lib/libmqt-core-zx.3.3.dylib +0 -0
  507. mqt/core/lib/libmqt-core-zx.dylib +0 -0
  508. mqt/core/lib/libspdlog.a +0 -0
  509. mqt/core/lib/pkgconfig/spdlog.pc +13 -0
  510. mqt/core/na/__init__.py +12 -0
  511. mqt/core/na/fomac.cpython-314t-darwin.so +0 -0
  512. mqt/core/na/fomac.pyi +117 -0
  513. mqt/core/plugins/__init__.py +9 -0
  514. mqt/core/plugins/qiskit/__init__.py +19 -0
  515. mqt/core/plugins/qiskit/mqt_to_qiskit.py +420 -0
  516. mqt/core/plugins/qiskit/qiskit_to_mqt.py +562 -0
  517. mqt/core/py.typed +2 -0
  518. mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +55 -0
  519. mqt/core/share/cmake/mqt-core/Cache.cmake +33 -0
  520. mqt/core/share/cmake/mqt-core/FindGMP.cmake +103 -0
  521. mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +46 -0
  522. mqt/core/share/cmake/mqt-core/PreventInSourceBuilds.cmake +25 -0
  523. mqt/core/share/cmake/mqt-core/StandardProjectSettings.cmake +87 -0
  524. mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +85 -0
  525. mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +52 -0
  526. mqt/core/share/cmake/mqt-core/mqt-core-targets-release.cmake +141 -0
  527. mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +446 -0
  528. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake +15 -0
  529. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake +20 -0
  530. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake +109 -0
  531. mqt/core/share/cmake/qdmi/Cache.cmake +44 -0
  532. mqt/core/share/cmake/qdmi/PrefixHandling.cmake +78 -0
  533. mqt/core/share/cmake/qdmi/prefix_defs.txt +26 -0
  534. mqt/core/share/cmake/qdmi/qdmi-config-version.cmake +85 -0
  535. mqt/core/share/cmake/qdmi/qdmi-config.cmake +42 -0
  536. mqt/core/share/cmake/qdmi/qdmi-targets.cmake +129 -0
  537. mqt/core/share/cmake/spdlog/spdlogConfig.cmake +44 -0
  538. mqt/core/share/cmake/spdlog/spdlogConfigTargets-release.cmake +19 -0
  539. mqt/core/share/cmake/spdlog/spdlogConfigTargets.cmake +118 -0
  540. mqt/core/share/cmake/spdlog/spdlogConfigVersion.cmake +65 -0
  541. mqt/core/share/pkgconfig/nlohmann_json.pc +7 -0
  542. mqt_core-3.3.2.dist-info/METADATA +210 -0
  543. mqt_core-3.3.2.dist-info/RECORD +546 -0
  544. mqt_core-3.3.2.dist-info/WHEEL +6 -0
  545. mqt_core-3.3.2.dist-info/entry_points.txt +4 -0
  546. mqt_core-3.3.2.dist-info/licenses/LICENSE.md +22 -0
@@ -0,0 +1,2559 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright 2011 John Maddock. Distributed under the Boost
3
+ // Software License, Version 1.0. (See accompanying file
4
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
+
6
+ #ifndef BOOST_MP_MPFI_HPP
7
+ #define BOOST_MP_MPFI_HPP
8
+
9
+ #include <algorithm>
10
+ #include <cmath>
11
+ #include <cstdint>
12
+ #include <type_traits>
13
+ #include <string>
14
+ #include <boost/multiprecision/detail/standalone_config.hpp>
15
+ #include <boost/multiprecision/detail/fpclassify.hpp>
16
+ #include <boost/multiprecision/number.hpp>
17
+ #include <boost/multiprecision/detail/digits.hpp>
18
+ #include <boost/multiprecision/detail/precision.hpp>
19
+ #include <boost/multiprecision/detail/atomic.hpp>
20
+ #include <boost/multiprecision/traits/max_digits10.hpp>
21
+ #include <boost/multiprecision/mpfr.hpp>
22
+ #include <boost/multiprecision/logged_adaptor.hpp>
23
+ #include <boost/multiprecision/detail/hash.hpp>
24
+ #include <boost/multiprecision/detail/no_exceptions_support.hpp>
25
+ #include <boost/multiprecision/detail/assert.hpp>
26
+ #include <mpfi.h>
27
+
28
+ #ifdef BOOST_MP_MATH_AVAILABLE
29
+ #include <boost/math/constants/constants.hpp>
30
+ #endif
31
+
32
+ #ifndef BOOST_MULTIPRECISION_MPFI_DEFAULT_PRECISION
33
+ #define BOOST_MULTIPRECISION_MPFI_DEFAULT_PRECISION 20
34
+ #endif
35
+
36
+ namespace boost {
37
+ namespace multiprecision {
38
+
39
+ template <unsigned digits10>
40
+ struct number_category<backends::mpfi_float_backend<digits10> > : public std::integral_constant<int, number_kind_floating_point>
41
+ {};
42
+
43
+ struct interval_error : public std::runtime_error
44
+ {
45
+ interval_error(const std::string& s) : std::runtime_error(s) {}
46
+ };
47
+
48
+ namespace detail {
49
+ template <>
50
+ struct is_variable_precision<backends::mpfi_float_backend<0> > : public std::integral_constant<bool, true>
51
+ {};
52
+ } // namespace detail
53
+
54
+
55
+ namespace backends {
56
+
57
+ namespace detail {
58
+
59
+ inline int mpfi_sgn(mpfi_srcptr p)
60
+ {
61
+ if (mpfi_is_zero(p))
62
+ return 0;
63
+ if (mpfi_is_strictly_pos(p))
64
+ return 1;
65
+ if (mpfi_is_strictly_neg(p))
66
+ return -1;
67
+ BOOST_MP_THROW_EXCEPTION(interval_error("Sign of interval is ambiguous."));
68
+ }
69
+
70
+ template <unsigned digits10>
71
+ struct mpfi_float_imp;
72
+
73
+ template <unsigned digits10>
74
+ struct mpfi_float_imp
75
+ {
76
+ #ifdef BOOST_HAS_LONG_LONG
77
+ using signed_types = std::tuple<long, long long> ;
78
+ using unsigned_types = std::tuple<unsigned long, unsigned long long>;
79
+ #else
80
+ using signed_types = std::tuple<long> ;
81
+ using unsigned_types = std::tuple<unsigned long>;
82
+ #endif
83
+ using float_types = std::tuple<double, long double>;
84
+ using exponent_type = long ;
85
+
86
+ mpfi_float_imp()
87
+ {
88
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
89
+ mpfi_set_ui(m_data, 0u);
90
+ }
91
+ mpfi_float_imp(unsigned prec)
92
+ {
93
+ mpfi_init2(m_data, prec);
94
+ mpfi_set_ui(m_data, 0u);
95
+ }
96
+
97
+ mpfi_float_imp(const mpfi_float_imp& o)
98
+ {
99
+ mpfi_init2(m_data, preserve_source_precision() ? mpfi_get_prec(o.data()) : boost::multiprecision::detail::digits10_2_2(get_default_precision()));
100
+ if (o.m_data[0].left._mpfr_d)
101
+ mpfi_set(m_data, o.m_data);
102
+ }
103
+ template <unsigned D, mpfr_allocation_type AllocationType>
104
+ mpfi_float_imp(const mpfr_float_imp<D, AllocationType>& o)
105
+ {
106
+ mpfi_init2(m_data, (D == 0 ? preserve_component_precision() : preserve_related_precision()) ? mpfr_get_prec(o.data()) : boost::multiprecision::detail::digits10_2_2(get_default_precision()));
107
+ if (o.data()[0]._mpfr_d)
108
+ mpfi_set_fr(m_data, o.data());
109
+ }
110
+ // rvalue copy
111
+ mpfi_float_imp(mpfi_float_imp&& o) noexcept
112
+ {
113
+ mpfr_prec_t binary_default_precision = boost::multiprecision::detail::digits10_2_2(get_default_precision());
114
+ if ((this->get_default_options() != variable_precision_options::preserve_target_precision) || (mpfi_get_prec(o.data()) == binary_default_precision))
115
+ {
116
+ m_data[0] = o.m_data[0];
117
+ o.m_data[0].left._mpfr_d = nullptr;
118
+ }
119
+ else
120
+ {
121
+ // NOTE: C allocation interface must not throw:
122
+ mpfi_init2(m_data, binary_default_precision);
123
+ mpfi_set(m_data, o.m_data);
124
+ }
125
+ }
126
+ mpfi_float_imp& operator=(const mpfi_float_imp& o)
127
+ {
128
+ if (this != &o)
129
+ {
130
+ if (m_data[0].left._mpfr_d == nullptr)
131
+ mpfi_init2(m_data, preserve_source_precision() ? mpfi_get_prec(o.m_data) : boost::multiprecision::detail::digits10_2_2(get_default_precision()));
132
+ else if (preserve_source_precision() && (mpfi_get_prec(o.data()) != mpfi_get_prec(data())))
133
+ {
134
+ mpfi_set_prec(m_data, mpfi_get_prec(o.m_data));
135
+ }
136
+ mpfi_set(m_data, o.m_data);
137
+ }
138
+ return *this;
139
+ }
140
+ // rvalue assign
141
+ mpfi_float_imp& operator=(mpfi_float_imp&& o) noexcept
142
+ {
143
+ if ((this->get_default_options() != variable_precision_options::preserve_target_precision) || (mpfi_get_prec(o.data()) == mpfi_get_prec(data())))
144
+ mpfi_swap(m_data, o.m_data);
145
+ else
146
+ *this = static_cast<const mpfi_float_imp&>(o);
147
+ return *this;
148
+ }
149
+ #ifdef BOOST_HAS_LONG_LONG
150
+ #ifdef _MPFR_H_HAVE_INTMAX_T
151
+ mpfi_float_imp& operator=(unsigned long long i)
152
+ {
153
+ if (m_data[0].left._mpfr_d == nullptr)
154
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
155
+ mpfr_set_uj(left_data(), i, GMP_RNDD);
156
+ mpfr_set_uj(right_data(), i, GMP_RNDU);
157
+ return *this;
158
+ }
159
+ mpfi_float_imp& operator=(long long i)
160
+ {
161
+ if (m_data[0].left._mpfr_d == nullptr)
162
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
163
+ mpfr_set_sj(left_data(), i, GMP_RNDD);
164
+ mpfr_set_sj(right_data(), i, GMP_RNDU);
165
+ return *this;
166
+ }
167
+ #else
168
+ mpfi_float_imp& operator=(unsigned long long i)
169
+ {
170
+ if (m_data[0].left._mpfr_d == nullptr)
171
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
172
+ unsigned long long mask = ((((1uLL << (std::numeric_limits<unsigned long>::digits - 1)) - 1) << 1) | 1u);
173
+ unsigned shift = 0;
174
+ mpfi_t t;
175
+ mpfi_init2(t, (std::max)(static_cast<mpfr_prec_t>(std::numeric_limits<unsigned long long>::digits), static_cast<mpfr_prec_t>(multiprecision::detail::digits10_2_2(digits10))));
176
+ mpfi_set_ui(m_data, 0);
177
+ while (i)
178
+ {
179
+ mpfi_set_ui(t, static_cast<unsigned long>(i & mask));
180
+ if (shift)
181
+ mpfi_mul_2exp(t, t, shift);
182
+ mpfi_add(m_data, m_data, t);
183
+ shift += std::numeric_limits<unsigned long>::digits;
184
+ i >>= std::numeric_limits<unsigned long>::digits;
185
+ }
186
+ mpfi_clear(t);
187
+ return *this;
188
+ }
189
+ mpfi_float_imp& operator=(long long i)
190
+ {
191
+ if (m_data[0].left._mpfr_d == nullptr)
192
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
193
+ bool neg = i < 0;
194
+ *this = boost::multiprecision::detail::unsigned_abs(i);
195
+ if (neg)
196
+ mpfi_neg(m_data, m_data);
197
+ return *this;
198
+ }
199
+ #endif
200
+ #endif
201
+ #ifdef BOOST_HAS_INT128
202
+ mpfi_float_imp& operator=(uint128_type i)
203
+ {
204
+ if (m_data[0].left._mpfr_d == nullptr)
205
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
206
+ constexpr uint128_type mask = ((((static_cast<uint128_type>(1u) << (std::numeric_limits<unsigned long>::digits - 1)) - 1) << 1) | 1u);
207
+ unsigned shift = 0;
208
+ mpfi_t t;
209
+ mpfi_init2(t, (std::max)(static_cast<mpfr_prec_t>(128), static_cast<mpfr_prec_t>(multiprecision::detail::digits10_2_2(digits10))));
210
+ mpfi_set_ui(m_data, 0);
211
+ while (i)
212
+ {
213
+ mpfi_set_ui(t, static_cast<unsigned long>(i & mask));
214
+ if (shift)
215
+ mpfi_mul_2exp(t, t, shift);
216
+ mpfi_add(m_data, m_data, t);
217
+ shift += std::numeric_limits<unsigned long>::digits;
218
+ i >>= std::numeric_limits<unsigned long>::digits;
219
+ }
220
+ mpfi_clear(t);
221
+ return *this;
222
+ }
223
+ mpfi_float_imp& operator=(int128_type i)
224
+ {
225
+ if (m_data[0].left._mpfr_d == nullptr)
226
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
227
+ bool neg = i < 0;
228
+ *this = boost::multiprecision::detail::unsigned_abs(i);
229
+ if (neg)
230
+ mpfi_neg(m_data, m_data);
231
+ return *this;
232
+ }
233
+ #endif
234
+ mpfi_float_imp& operator=(unsigned long i)
235
+ {
236
+ if (m_data[0].left._mpfr_d == nullptr)
237
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
238
+ mpfi_set_ui(m_data, i);
239
+ return *this;
240
+ }
241
+ mpfi_float_imp& operator=(long i)
242
+ {
243
+ if (m_data[0].left._mpfr_d == nullptr)
244
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
245
+ mpfi_set_si(m_data, i);
246
+ return *this;
247
+ }
248
+ mpfi_float_imp& operator=(double d)
249
+ {
250
+ if (m_data[0].left._mpfr_d == nullptr)
251
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
252
+ mpfi_set_d(m_data, d);
253
+ return *this;
254
+ }
255
+ mpfi_float_imp& operator=(long double a)
256
+ {
257
+ if (m_data[0].left._mpfr_d == nullptr)
258
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
259
+ mpfr_set_ld(left_data(), a, GMP_RNDD);
260
+ mpfr_set_ld(right_data(), a, GMP_RNDU);
261
+ return *this;
262
+ }
263
+ #ifdef BOOST_HAS_FLOAT128
264
+ mpfi_float_imp& operator=(float128_type a)
265
+ {
266
+ BOOST_MP_FLOAT128_USING
267
+ if (m_data[0].left._mpfr_d == nullptr)
268
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
269
+
270
+ if (a == 0)
271
+ {
272
+ mpfi_set_si(m_data, 0);
273
+ return *this;
274
+ }
275
+
276
+ if (a == 1)
277
+ {
278
+ mpfi_set_si(m_data, 1);
279
+ return *this;
280
+ }
281
+
282
+ BOOST_MP_ASSERT(!BOOST_MP_ISINF(a));
283
+ BOOST_MP_ASSERT(!BOOST_MP_ISNAN(a));
284
+
285
+ int e;
286
+ float128_type f, term;
287
+ mpfi_set_ui(m_data, 0u);
288
+
289
+ f = frexp(a, &e);
290
+
291
+ constexpr const int shift = std::numeric_limits<int>::digits - 1;
292
+
293
+ while (f)
294
+ {
295
+ // extract int sized bits from f:
296
+ f = ldexp(f, shift);
297
+ term = floor(f);
298
+ e -= shift;
299
+ mpfi_mul_2exp(m_data, m_data, shift);
300
+ if (term > 0)
301
+ mpfi_add_ui(m_data, m_data, static_cast<unsigned>(term));
302
+ else
303
+ mpfi_sub_ui(m_data, m_data, static_cast<unsigned>(-term));
304
+ f -= term;
305
+ }
306
+ if (e > 0)
307
+ mpfi_mul_2exp(m_data, m_data, e);
308
+ else if (e < 0)
309
+ mpfi_div_2exp(m_data, m_data, -e);
310
+ return *this;
311
+ }
312
+ #endif
313
+ mpfi_float_imp& operator=(const char* s)
314
+ {
315
+ using default_ops::eval_fpclassify;
316
+
317
+ if (m_data[0].left._mpfr_d == nullptr)
318
+ mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : (unsigned)get_default_precision()));
319
+
320
+ if (s && (*s == '{'))
321
+ {
322
+ mpfr_float_backend<digits10> a, b;
323
+ std::string part;
324
+ const char* p = ++s;
325
+ while (*p && (*p != ',') && (*p != '}'))
326
+ ++p;
327
+ part.assign(s, p);
328
+ a = part.c_str();
329
+ s = p;
330
+ if (*p && (*p != '}'))
331
+ {
332
+ ++p;
333
+ while (*p && (*p != ',') && (*p != '}'))
334
+ ++p;
335
+ part.assign(s + 1, p);
336
+ }
337
+ else
338
+ part.erase();
339
+ b = part.c_str();
340
+
341
+ if (eval_fpclassify(a) == static_cast<int>(FP_NAN))
342
+ {
343
+ mpfi_set_fr(this->data(), a.data());
344
+ }
345
+ else if (eval_fpclassify(b) == static_cast<int>(FP_NAN))
346
+ {
347
+ mpfi_set_fr(this->data(), b.data());
348
+ }
349
+ else
350
+ {
351
+ if (a.compare(b) > 0)
352
+ {
353
+ BOOST_MP_THROW_EXCEPTION(std::runtime_error("Attempt to create interval with invalid range (start is greater than end)."));
354
+ }
355
+ mpfi_interv_fr(m_data, a.data(), b.data());
356
+ }
357
+ }
358
+ else if (mpfi_set_str(m_data, s, 10) != 0)
359
+ {
360
+ BOOST_MP_THROW_EXCEPTION(std::runtime_error(std::string("Unable to parse string \"") + s + std::string("\"as a valid floating point number.")));
361
+ }
362
+ return *this;
363
+ }
364
+ void swap(mpfi_float_imp& o) noexcept
365
+ {
366
+ mpfi_swap(m_data, o.m_data);
367
+ }
368
+ std::string str(std::streamsize digits, std::ios_base::fmtflags f) const
369
+ {
370
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
371
+
372
+ mpfr_float_backend<digits10> a, b;
373
+
374
+ mpfi_get_left(a.data(), m_data);
375
+ mpfi_get_right(b.data(), m_data);
376
+
377
+ if (a.compare(b) == 0)
378
+ return a.str(digits, f);
379
+
380
+ return "{" + a.str(digits, f) + "," + b.str(digits, f) + "}";
381
+ }
382
+ ~mpfi_float_imp() noexcept
383
+ {
384
+ if (m_data[0].left._mpfr_d)
385
+ mpfi_clear(m_data);
386
+ }
387
+ void negate() noexcept
388
+ {
389
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
390
+ mpfi_neg(m_data, m_data);
391
+ }
392
+ int compare(const mpfi_float_imp& o) const noexcept
393
+ {
394
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d && o.m_data[0].left._mpfr_d);
395
+ if (mpfr_cmp(right_data(), o.left_data()) < 0)
396
+ return -1;
397
+ if (mpfr_cmp(left_data(), o.right_data()) > 0)
398
+ return 1;
399
+ if ((mpfr_cmp(left_data(), o.left_data()) == 0) && (mpfr_cmp(right_data(), o.right_data()) == 0))
400
+ return 0;
401
+ BOOST_MP_THROW_EXCEPTION(interval_error("Ambiguous comparison between two values."));
402
+ return 0;
403
+ }
404
+ template <class V>
405
+ int compare(V v) const noexcept
406
+ {
407
+ mpfi_float_imp d;
408
+ d = v;
409
+ return compare(d);
410
+ }
411
+ mpfi_t& data() noexcept
412
+ {
413
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
414
+ return m_data;
415
+ }
416
+ const mpfi_t& data() const noexcept
417
+ {
418
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
419
+ return m_data;
420
+ }
421
+ mpfr_ptr left_data() noexcept
422
+ {
423
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
424
+ return &(m_data[0].left);
425
+ }
426
+ mpfr_srcptr left_data() const noexcept
427
+ {
428
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
429
+ return &(m_data[0].left);
430
+ }
431
+ mpfr_ptr right_data() noexcept
432
+ {
433
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
434
+ return &(m_data[0].right);
435
+ }
436
+ mpfr_srcptr right_data() const noexcept
437
+ {
438
+ BOOST_MP_ASSERT(m_data[0].left._mpfr_d);
439
+ return &(m_data[0].right);
440
+ }
441
+
442
+ protected:
443
+ mpfi_t m_data;
444
+ static boost::multiprecision::detail::precision_type& get_global_default_precision() noexcept
445
+ {
446
+ static boost::multiprecision::detail::precision_type val(BOOST_MULTIPRECISION_MPFI_DEFAULT_PRECISION);
447
+ return val;
448
+ }
449
+ static unsigned& get_default_precision() noexcept
450
+ {
451
+ static BOOST_MP_THREAD_LOCAL unsigned val(get_global_default_precision());
452
+ return val;
453
+ }
454
+ #ifndef BOOST_MT_NO_ATOMIC_INT
455
+ static std::atomic<variable_precision_options>& get_global_default_options() noexcept
456
+ #else
457
+ static variable_precision_options& get_global_default_options() noexcept
458
+ #endif
459
+ {
460
+ #ifndef BOOST_MT_NO_ATOMIC_INT
461
+ static std::atomic<variable_precision_options> val{variable_precision_options::preserve_related_precision};
462
+ #else
463
+ static variable_precision_optionss val{variable_precision_options::preserve_related_precision};
464
+ #endif
465
+ return val;
466
+ }
467
+ static variable_precision_options& get_default_options() noexcept
468
+ {
469
+ static BOOST_MP_THREAD_LOCAL variable_precision_options val(get_global_default_options());
470
+ return val;
471
+ }
472
+ static bool preserve_source_precision() noexcept
473
+ {
474
+ return get_default_options() >= variable_precision_options::preserve_source_precision;
475
+ }
476
+ static bool preserve_component_precision() noexcept
477
+ {
478
+ return get_default_options() >= variable_precision_options::preserve_component_precision;
479
+ }
480
+ static bool preserve_related_precision() noexcept
481
+ {
482
+ return get_default_options() >= variable_precision_options::preserve_related_precision;
483
+ }
484
+ static bool preserve_all_precision() noexcept
485
+ {
486
+ return get_default_options() >= variable_precision_options::preserve_all_precision;
487
+ }
488
+ };
489
+
490
+ } // namespace detail
491
+
492
+ template <unsigned digits10>
493
+ struct mpfi_float_backend : public detail::mpfi_float_imp<digits10>
494
+ {
495
+ mpfi_float_backend() : detail::mpfi_float_imp<digits10>() {}
496
+ mpfi_float_backend(const mpfi_float_backend& o) : detail::mpfi_float_imp<digits10>(o) {}
497
+ // rvalue copy
498
+ mpfi_float_backend(mpfi_float_backend&& o) : detail::mpfi_float_imp<digits10>(static_cast<detail::mpfi_float_imp<digits10>&&>(o))
499
+ {}
500
+ template <unsigned D>
501
+ mpfi_float_backend(const mpfi_float_backend<D>& val, typename std::enable_if<D <= digits10>::type* = nullptr)
502
+ : detail::mpfi_float_imp<digits10>()
503
+ {
504
+ mpfi_set(this->m_data, val.data());
505
+ }
506
+ template <unsigned D, mpfr_allocation_type AllocationType>
507
+ mpfi_float_backend(const mpfr_float_backend<D, AllocationType>& val, typename std::enable_if<D <= digits10>::type* = nullptr)
508
+ : detail::mpfi_float_imp<digits10>(val) {}
509
+
510
+ template <unsigned D>
511
+ explicit mpfi_float_backend(const mpfi_float_backend<D>& val, typename std::enable_if<!(D <= digits10)>::type* = nullptr)
512
+ : detail::mpfi_float_imp<digits10>()
513
+ {
514
+ mpfi_set(this->m_data, val.data());
515
+ }
516
+ mpfi_float_backend(const mpfi_t val)
517
+ : detail::mpfi_float_imp<digits10>()
518
+ {
519
+ mpfi_set(this->m_data, val);
520
+ }
521
+ mpfi_float_backend& operator=(const mpfi_float_backend& o)
522
+ {
523
+ *static_cast<detail::mpfi_float_imp<digits10>*>(this) = static_cast<detail::mpfi_float_imp<digits10> const&>(o);
524
+ return *this;
525
+ }
526
+ template <unsigned D>
527
+ mpfi_float_backend(const mpfr_float_backend<D>& val, typename std::enable_if<D <= digits10>::type* = nullptr)
528
+ : detail::mpfi_float_imp<digits10>()
529
+ {
530
+ mpfi_set_fr(this->m_data, val.data());
531
+ }
532
+ template <unsigned D>
533
+ mpfi_float_backend& operator=(const mpfr_float_backend<D>& val)
534
+ {
535
+ mpfi_set_fr(this->m_data, val.data());
536
+ return *this;
537
+ }
538
+ template <unsigned D>
539
+ explicit mpfi_float_backend(const mpfr_float_backend<D>& val, typename std::enable_if<!(D <= digits10)>::type* = nullptr)
540
+ : detail::mpfi_float_imp<digits10>()
541
+ {
542
+ mpfi_set_fr(this->m_data, val.data());
543
+ }
544
+ // rvalue copy
545
+ mpfi_float_backend& operator=(mpfi_float_backend&& o) noexcept
546
+ {
547
+ *static_cast<detail::mpfi_float_imp<digits10>*>(this) = static_cast<detail::mpfi_float_imp<digits10>&&>(o);
548
+ return *this;
549
+ }
550
+ template <class V>
551
+ typename std::enable_if<std::is_assignable<detail::mpfi_float_imp<digits10>, V>::value, mpfi_float_backend&>::type operator=(const V& v)
552
+ {
553
+ *static_cast<detail::mpfi_float_imp<digits10>*>(this) = v;
554
+ return *this;
555
+ }
556
+ mpfi_float_backend& operator=(const mpfi_t val)
557
+ {
558
+ mpfi_set(this->m_data, val);
559
+ return *this;
560
+ }
561
+ // We don't change our precision here, this is a fixed precision type:
562
+ template <unsigned D>
563
+ mpfi_float_backend& operator=(const mpfi_float_backend<D>& val)
564
+ {
565
+ mpfi_set(this->m_data, val.data());
566
+ return *this;
567
+ }
568
+ };
569
+
570
+ template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
571
+ void assign_components(mpfi_float_backend<D1>& result, const mpfr_float_backend<D2, AllocationType>& a, const mpfr_float_backend<D2, AllocationType>& b);
572
+
573
+ template <unsigned Digits10, class V>
574
+ typename std::enable_if<std::is_constructible<number<mpfr_float_backend<Digits10, allocate_dynamic>, et_on>, V>::value || std::is_convertible<V, const char*>::value>::type
575
+ assign_components(mpfi_float_backend<Digits10>& result, const V& a, const V& b);
576
+
577
+ template <>
578
+ struct mpfi_float_backend<0> : public detail::mpfi_float_imp<0>
579
+ {
580
+ mpfi_float_backend() : detail::mpfi_float_imp<0>() {}
581
+ mpfi_float_backend(const mpfi_t val)
582
+ : detail::mpfi_float_imp<0>(mpfi_get_prec(val))
583
+ {
584
+ mpfi_set(this->m_data, val);
585
+ }
586
+ mpfi_float_backend(const mpfi_float_backend& o) : detail::mpfi_float_imp<0>(o) {}
587
+
588
+ template <unsigned D, mpfr_allocation_type AllocationType>
589
+ mpfi_float_backend(const mpfr_float_backend<D, AllocationType>& val)
590
+ : detail::mpfi_float_imp<0>(val) {}
591
+
592
+ // rvalue copy
593
+ mpfi_float_backend(mpfi_float_backend&& o) noexcept : detail::mpfi_float_imp<0>(static_cast<detail::mpfi_float_imp<0>&&>(o))
594
+ {}
595
+ mpfi_float_backend(const mpfi_float_backend& o, unsigned digits10)
596
+ : detail::mpfi_float_imp<0>(multiprecision::detail::digits10_2_2(digits10))
597
+ {
598
+ mpfi_set(this->m_data, o.data());
599
+ }
600
+ template <class V>
601
+ mpfi_float_backend(const V& a, const V& b, unsigned digits10)
602
+ : detail::mpfi_float_imp<0>(multiprecision::detail::digits10_2_2(digits10))
603
+ {
604
+ boost::multiprecision::detail::scoped_target_precision<mpfi_float_backend<0> > opts;
605
+ assign_components(*this, a, b);
606
+ }
607
+
608
+ template <unsigned D>
609
+ mpfi_float_backend(const mpfi_float_backend<D>& val)
610
+ : detail::mpfi_float_imp<0>(mpfi_get_prec(val.data()))
611
+ {
612
+ mpfi_set(this->m_data, val.data());
613
+ }
614
+ mpfi_float_backend& operator=(const mpfi_float_backend& o) = default;
615
+ // rvalue assign
616
+ mpfi_float_backend& operator=(mpfi_float_backend&& o) noexcept = default;
617
+
618
+ template <class V>
619
+ mpfi_float_backend& operator=(const V& v)
620
+ {
621
+ constexpr unsigned d10 = std::is_floating_point<V>::value ?
622
+ std::numeric_limits<V>::digits10 :
623
+ std::numeric_limits<V>::digits10 ? 1 + std::numeric_limits<V>::digits10 :
624
+ 1 + boost::multiprecision::detail::digits2_2_10(std::numeric_limits<V>::digits);
625
+
626
+ if (thread_default_variable_precision_options() >= variable_precision_options::preserve_all_precision)
627
+ {
628
+ BOOST_IF_CONSTEXPR(std::is_floating_point<V>::value)
629
+ {
630
+ if (std::numeric_limits<V>::digits > mpfi_get_prec(this->data()))
631
+ mpfi_set_prec(this->data(), std::numeric_limits<V>::digits);
632
+ }
633
+ else
634
+ {
635
+ if (precision() < d10)
636
+ this->precision(d10);
637
+ }
638
+ }
639
+
640
+ *static_cast<detail::mpfi_float_imp<0>*>(this) = v;
641
+ return *this;
642
+ }
643
+ mpfi_float_backend& operator=(const mpfi_t val)
644
+ {
645
+ mpfi_set_prec(this->m_data, mpfi_get_prec(val));
646
+ mpfi_set(this->m_data, val);
647
+ return *this;
648
+ }
649
+ template <unsigned D>
650
+ mpfi_float_backend& operator=(const mpfi_float_backend<D>& val)
651
+ {
652
+ mpfi_set_prec(this->m_data, mpfi_get_prec(val.data()));
653
+ mpfi_set(this->m_data, val.data());
654
+ return *this;
655
+ }
656
+ static unsigned thread_default_precision() noexcept
657
+ {
658
+ return get_default_precision();
659
+ }
660
+ static void thread_default_precision(unsigned v) noexcept
661
+ {
662
+ get_default_precision() = v;
663
+ }
664
+ static unsigned default_precision() noexcept
665
+ {
666
+ return get_global_default_precision();
667
+ }
668
+ static void default_precision(unsigned v) noexcept
669
+ {
670
+ get_global_default_precision() = v;
671
+ }
672
+ unsigned precision() const noexcept
673
+ {
674
+ return multiprecision::detail::digits2_2_10(mpfi_get_prec(this->m_data));
675
+ }
676
+ void precision(unsigned digits10) noexcept
677
+ {
678
+ mpfi_float_backend t(*this, digits10);
679
+ this->swap(t);
680
+ }
681
+ //
682
+ // Variable precision options:
683
+ //
684
+ static variable_precision_options default_variable_precision_options() noexcept
685
+ {
686
+ return get_global_default_options();
687
+ }
688
+ static variable_precision_options thread_default_variable_precision_options() noexcept
689
+ {
690
+ return get_default_options();
691
+ }
692
+ static void default_variable_precision_options(variable_precision_options opts)
693
+ {
694
+ get_global_default_options() = opts;
695
+ }
696
+ static void thread_default_variable_precision_options(variable_precision_options opts)
697
+ {
698
+ get_default_options() = opts;
699
+ }
700
+ };
701
+
702
+ template <unsigned digits10, class T>
703
+ inline typename std::enable_if<boost::multiprecision::detail::is_arithmetic<T>::value, bool>::type eval_eq(const mpfi_float_backend<digits10>& a, const T& b) noexcept
704
+ {
705
+ return a.compare(b) == 0;
706
+ }
707
+ template <unsigned digits10, class T>
708
+ inline typename std::enable_if<boost::multiprecision::detail::is_arithmetic<T>::value, bool>::type eval_lt(const mpfi_float_backend<digits10>& a, const T& b) noexcept
709
+ {
710
+ return a.compare(b) < 0;
711
+ }
712
+ template <unsigned digits10, class T>
713
+ inline typename std::enable_if<boost::multiprecision::detail::is_arithmetic<T>::value, bool>::type eval_gt(const mpfi_float_backend<digits10>& a, const T& b) noexcept
714
+ {
715
+ return a.compare(b) > 0;
716
+ }
717
+
718
+ template <unsigned D1, unsigned D2>
719
+ inline void eval_add(mpfi_float_backend<D1>& result, const mpfi_float_backend<D2>& o)
720
+ {
721
+ mpfi_add(result.data(), result.data(), o.data());
722
+ }
723
+ template <unsigned D1, unsigned D2>
724
+ inline void eval_subtract(mpfi_float_backend<D1>& result, const mpfi_float_backend<D2>& o)
725
+ {
726
+ mpfi_sub(result.data(), result.data(), o.data());
727
+ }
728
+ template <unsigned D1, unsigned D2>
729
+ inline void eval_multiply(mpfi_float_backend<D1>& result, const mpfi_float_backend<D2>& o)
730
+ {
731
+ if ((void*)&result == (void*)&o)
732
+ mpfi_sqr(result.data(), o.data());
733
+ else
734
+ mpfi_mul(result.data(), result.data(), o.data());
735
+ }
736
+ template <unsigned D1, unsigned D2>
737
+ inline void eval_divide(mpfi_float_backend<D1>& result, const mpfi_float_backend<D2>& o)
738
+ {
739
+ mpfi_div(result.data(), result.data(), o.data());
740
+ }
741
+ template <unsigned digits10>
742
+ inline void eval_add(mpfi_float_backend<digits10>& result, unsigned long i)
743
+ {
744
+ mpfi_add_ui(result.data(), result.data(), i);
745
+ }
746
+ template <unsigned digits10>
747
+ inline void eval_subtract(mpfi_float_backend<digits10>& result, unsigned long i)
748
+ {
749
+ mpfi_sub_ui(result.data(), result.data(), i);
750
+ }
751
+ template <unsigned digits10>
752
+ inline void eval_multiply(mpfi_float_backend<digits10>& result, unsigned long i)
753
+ {
754
+ mpfi_mul_ui(result.data(), result.data(), i);
755
+ }
756
+ template <unsigned digits10>
757
+ inline void eval_divide(mpfi_float_backend<digits10>& result, unsigned long i)
758
+ {
759
+ mpfi_div_ui(result.data(), result.data(), i);
760
+ }
761
+ template <unsigned digits10>
762
+ inline void eval_add(mpfi_float_backend<digits10>& result, long i)
763
+ {
764
+ if (i > 0)
765
+ mpfi_add_ui(result.data(), result.data(), i);
766
+ else
767
+ mpfi_sub_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i));
768
+ }
769
+ template <unsigned digits10>
770
+ inline void eval_subtract(mpfi_float_backend<digits10>& result, long i)
771
+ {
772
+ if (i > 0)
773
+ mpfi_sub_ui(result.data(), result.data(), i);
774
+ else
775
+ mpfi_add_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i));
776
+ }
777
+ template <unsigned digits10>
778
+ inline void eval_multiply(mpfi_float_backend<digits10>& result, long i)
779
+ {
780
+ mpfi_mul_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i));
781
+ if (i < 0)
782
+ mpfi_neg(result.data(), result.data());
783
+ }
784
+ template <unsigned digits10>
785
+ inline void eval_divide(mpfi_float_backend<digits10>& result, long i)
786
+ {
787
+ mpfi_div_ui(result.data(), result.data(), boost::multiprecision::detail::unsigned_abs(i));
788
+ if (i < 0)
789
+ mpfi_neg(result.data(), result.data());
790
+ }
791
+ //
792
+ // Specialised 3 arg versions of the basic operators:
793
+ //
794
+ template <unsigned D1, unsigned D2, unsigned D3>
795
+ inline void eval_add(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, const mpfi_float_backend<D3>& y)
796
+ {
797
+ mpfi_add(a.data(), x.data(), y.data());
798
+ }
799
+ template <unsigned D1, unsigned D2>
800
+ inline void eval_add(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, unsigned long y)
801
+ {
802
+ mpfi_add_ui(a.data(), x.data(), y);
803
+ }
804
+ template <unsigned D1, unsigned D2>
805
+ inline void eval_add(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, long y)
806
+ {
807
+ if (y < 0)
808
+ mpfi_sub_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y));
809
+ else
810
+ mpfi_add_ui(a.data(), x.data(), y);
811
+ }
812
+ template <unsigned D1, unsigned D2>
813
+ inline void eval_add(mpfi_float_backend<D1>& a, unsigned long x, const mpfi_float_backend<D2>& y)
814
+ {
815
+ mpfi_add_ui(a.data(), y.data(), x);
816
+ }
817
+ template <unsigned D1, unsigned D2>
818
+ inline void eval_add(mpfi_float_backend<D1>& a, long x, const mpfi_float_backend<D2>& y)
819
+ {
820
+ if (x < 0)
821
+ {
822
+ mpfi_ui_sub(a.data(), boost::multiprecision::detail::unsigned_abs(x), y.data());
823
+ mpfi_neg(a.data(), a.data());
824
+ }
825
+ else
826
+ mpfi_add_ui(a.data(), y.data(), x);
827
+ }
828
+ template <unsigned D1, unsigned D2, unsigned D3>
829
+ inline void eval_subtract(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, const mpfi_float_backend<D3>& y)
830
+ {
831
+ mpfi_sub(a.data(), x.data(), y.data());
832
+ }
833
+ template <unsigned D1, unsigned D2>
834
+ inline void eval_subtract(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, unsigned long y)
835
+ {
836
+ mpfi_sub_ui(a.data(), x.data(), y);
837
+ }
838
+ template <unsigned D1, unsigned D2>
839
+ inline void eval_subtract(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, long y)
840
+ {
841
+ if (y < 0)
842
+ mpfi_add_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y));
843
+ else
844
+ mpfi_sub_ui(a.data(), x.data(), y);
845
+ }
846
+ template <unsigned D1, unsigned D2>
847
+ inline void eval_subtract(mpfi_float_backend<D1>& a, unsigned long x, const mpfi_float_backend<D2>& y)
848
+ {
849
+ mpfi_ui_sub(a.data(), x, y.data());
850
+ }
851
+ template <unsigned D1, unsigned D2>
852
+ inline void eval_subtract(mpfi_float_backend<D1>& a, long x, const mpfi_float_backend<D2>& y)
853
+ {
854
+ if (x < 0)
855
+ {
856
+ mpfi_add_ui(a.data(), y.data(), boost::multiprecision::detail::unsigned_abs(x));
857
+ mpfi_neg(a.data(), a.data());
858
+ }
859
+ else
860
+ mpfi_ui_sub(a.data(), x, y.data());
861
+ }
862
+
863
+ template <unsigned D1, unsigned D2, unsigned D3>
864
+ inline void eval_multiply(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, const mpfi_float_backend<D3>& y)
865
+ {
866
+ if ((void*)&x == (void*)&y)
867
+ mpfi_sqr(a.data(), x.data());
868
+ else
869
+ mpfi_mul(a.data(), x.data(), y.data());
870
+ }
871
+ template <unsigned D1, unsigned D2>
872
+ inline void eval_multiply(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, unsigned long y)
873
+ {
874
+ mpfi_mul_ui(a.data(), x.data(), y);
875
+ }
876
+ template <unsigned D1, unsigned D2>
877
+ inline void eval_multiply(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, long y)
878
+ {
879
+ if (y < 0)
880
+ {
881
+ mpfi_mul_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y));
882
+ a.negate();
883
+ }
884
+ else
885
+ mpfi_mul_ui(a.data(), x.data(), y);
886
+ }
887
+ template <unsigned D1, unsigned D2>
888
+ inline void eval_multiply(mpfi_float_backend<D1>& a, unsigned long x, const mpfi_float_backend<D2>& y)
889
+ {
890
+ mpfi_mul_ui(a.data(), y.data(), x);
891
+ }
892
+ template <unsigned D1, unsigned D2>
893
+ inline void eval_multiply(mpfi_float_backend<D1>& a, long x, const mpfi_float_backend<D2>& y)
894
+ {
895
+ if (x < 0)
896
+ {
897
+ mpfi_mul_ui(a.data(), y.data(), boost::multiprecision::detail::unsigned_abs(x));
898
+ mpfi_neg(a.data(), a.data());
899
+ }
900
+ else
901
+ mpfi_mul_ui(a.data(), y.data(), x);
902
+ }
903
+
904
+ template <unsigned D1, unsigned D2, unsigned D3>
905
+ inline void eval_divide(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, const mpfi_float_backend<D3>& y)
906
+ {
907
+ mpfi_div(a.data(), x.data(), y.data());
908
+ }
909
+ template <unsigned D1, unsigned D2>
910
+ inline void eval_divide(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, unsigned long y)
911
+ {
912
+ mpfi_div_ui(a.data(), x.data(), y);
913
+ }
914
+ template <unsigned D1, unsigned D2>
915
+ inline void eval_divide(mpfi_float_backend<D1>& a, const mpfi_float_backend<D2>& x, long y)
916
+ {
917
+ if (y < 0)
918
+ {
919
+ mpfi_div_ui(a.data(), x.data(), boost::multiprecision::detail::unsigned_abs(y));
920
+ a.negate();
921
+ }
922
+ else
923
+ mpfi_div_ui(a.data(), x.data(), y);
924
+ }
925
+ template <unsigned D1, unsigned D2>
926
+ inline void eval_divide(mpfi_float_backend<D1>& a, unsigned long x, const mpfi_float_backend<D2>& y)
927
+ {
928
+ mpfi_ui_div(a.data(), x, y.data());
929
+ }
930
+ template <unsigned D1, unsigned D2>
931
+ inline void eval_divide(mpfi_float_backend<D1>& a, long x, const mpfi_float_backend<D2>& y)
932
+ {
933
+ if (x < 0)
934
+ {
935
+ mpfi_ui_div(a.data(), boost::multiprecision::detail::unsigned_abs(x), y.data());
936
+ mpfi_neg(a.data(), a.data());
937
+ }
938
+ else
939
+ mpfi_ui_div(a.data(), x, y.data());
940
+ }
941
+
942
+ template <unsigned digits10>
943
+ inline bool eval_is_zero(const mpfi_float_backend<digits10>& val) noexcept
944
+ {
945
+ return 0 != mpfi_is_zero(val.data());
946
+ }
947
+ template <unsigned digits10>
948
+ inline int eval_get_sign(const mpfi_float_backend<digits10>& val)
949
+ {
950
+ return detail::mpfi_sgn(val.data());
951
+ }
952
+
953
+ template <unsigned digits10>
954
+ inline void eval_convert_to(unsigned long* result, const mpfi_float_backend<digits10>& val)
955
+ {
956
+ mpfr_float_backend<digits10> t;
957
+ mpfi_mid(t.data(), val.data());
958
+ eval_convert_to(result, t);
959
+ }
960
+ template <unsigned digits10>
961
+ inline void eval_convert_to(long* result, const mpfi_float_backend<digits10>& val)
962
+ {
963
+ mpfr_float_backend<digits10> t;
964
+ mpfi_mid(t.data(), val.data());
965
+ eval_convert_to(result, t);
966
+ }
967
+ #ifdef _MPFR_H_HAVE_INTMAX_T
968
+ template <unsigned digits10>
969
+ inline void eval_convert_to(unsigned long long* result, const mpfi_float_backend<digits10>& val)
970
+ {
971
+ mpfr_float_backend<digits10> t;
972
+ mpfi_mid(t.data(), val.data());
973
+ eval_convert_to(result, t);
974
+ }
975
+ template <unsigned digits10>
976
+ inline void eval_convert_to(long long* result, const mpfi_float_backend<digits10>& val)
977
+ {
978
+ mpfr_float_backend<digits10> t;
979
+ mpfi_mid(t.data(), val.data());
980
+ eval_convert_to(result, t);
981
+ }
982
+ #endif
983
+ #ifdef BOOST_HAS_INT128
984
+ template <unsigned digits10>
985
+ inline void eval_convert_to(uint128_type* result, const mpfi_float_backend<digits10>& val)
986
+ {
987
+ mpfr_float_backend<digits10> t;
988
+ mpfi_mid(t.data(), val.data());
989
+ eval_convert_to(result, t);
990
+ }
991
+ template <unsigned digits10>
992
+ inline void eval_convert_to(int128_type* result, const mpfi_float_backend<digits10>& val)
993
+ {
994
+ mpfr_float_backend<digits10> t;
995
+ mpfi_mid(t.data(), val.data());
996
+ eval_convert_to(result, t);
997
+ }
998
+ #endif
999
+ template <unsigned digits10>
1000
+ inline void eval_convert_to(double* result, const mpfi_float_backend<digits10>& val) noexcept
1001
+ {
1002
+ *result = mpfi_get_d(val.data());
1003
+ }
1004
+ template <unsigned digits10>
1005
+ inline void eval_convert_to(long double* result, const mpfi_float_backend<digits10>& val) noexcept
1006
+ {
1007
+ mpfr_float_backend<digits10> t;
1008
+ mpfi_mid(t.data(), val.data());
1009
+ eval_convert_to(result, t);
1010
+ }
1011
+ #ifdef BOOST_HAS_FLOAT128
1012
+ template <unsigned digits10>
1013
+ inline void eval_convert_to(float128_type* result, const mpfi_float_backend<digits10>& val)
1014
+ {
1015
+ mpfr_float_backend<digits10> t;
1016
+ mpfi_mid(t.data(), val.data());
1017
+ eval_convert_to(result, t);
1018
+ }
1019
+ #endif
1020
+ template <mpfr_allocation_type AllocationType>
1021
+ inline void assign_components_set_precision(mpfi_float_backend<0>& result, const mpfr_float_backend<0, AllocationType>& a, const mpfr_float_backend<0, AllocationType>& b)
1022
+ {
1023
+ if (result.thread_default_variable_precision_options() >= variable_precision_options::preserve_component_precision)
1024
+ {
1025
+ unsigned long prec = (std::max)(mpfr_get_prec(a.data()), mpfr_get_prec(b.data()));
1026
+ mpfi_set_prec(result.data(), prec);
1027
+ }
1028
+ }
1029
+ template <unsigned D2, mpfr_allocation_type AllocationType>
1030
+ inline void assign_components_set_precision(mpfi_float_backend<0>& result, const mpfr_float_backend<D2, AllocationType>& a, const mpfr_float_backend<D2, AllocationType>& b)
1031
+ {
1032
+ if (result.thread_default_variable_precision_options() >= variable_precision_options::preserve_related_precision)
1033
+ {
1034
+ unsigned long prec = (std::max)(mpfr_get_prec(a.data()), mpfr_get_prec(b.data()));
1035
+ mpfi_set_prec(result.data(), prec);
1036
+ }
1037
+ }
1038
+ template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
1039
+ inline void assign_components_set_precision(mpfi_float_backend<D1>&, const mpfr_float_backend<D2, AllocationType>&, const mpfr_float_backend<D2, AllocationType>&)
1040
+ {
1041
+ }
1042
+
1043
+
1044
+ template <unsigned D1, unsigned D2, mpfr_allocation_type AllocationType>
1045
+ inline void assign_components(mpfi_float_backend<D1>& result, const mpfr_float_backend<D2, AllocationType>& a, const mpfr_float_backend<D2, AllocationType>& b)
1046
+ {
1047
+ //
1048
+ // This is called from class number's constructors, so if we have variable
1049
+ // precision, then copy the precision of the source variables.
1050
+ //
1051
+ assign_components_set_precision(result, a, b);
1052
+
1053
+ using default_ops::eval_fpclassify;
1054
+ if (eval_fpclassify(a) == static_cast<int>(FP_NAN))
1055
+ {
1056
+ mpfi_set_fr(result.data(), a.data());
1057
+ }
1058
+ else if (eval_fpclassify(b) == static_cast<int>(FP_NAN))
1059
+ {
1060
+ mpfi_set_fr(result.data(), b.data());
1061
+ }
1062
+ else
1063
+ {
1064
+ if (a.compare(b) > 0)
1065
+ {
1066
+ BOOST_MP_THROW_EXCEPTION(std::runtime_error("Attempt to create interval with invalid range (start is greater than end)."));
1067
+ }
1068
+ mpfi_interv_fr(result.data(), a.data(), b.data());
1069
+ }
1070
+ }
1071
+
1072
+ template <unsigned Digits10, class V>
1073
+ inline typename std::enable_if<std::is_constructible<number<mpfr_float_backend<Digits10, allocate_dynamic>, et_on>, V>::value || std::is_convertible<V, const char*>::value>::type
1074
+ assign_components(mpfi_float_backend<Digits10>& result, const V& a, const V& b)
1075
+ {
1076
+ number<mpfr_float_backend<Digits10, allocate_dynamic>, et_on> x(a), y(b);
1077
+ assign_components(result, x.backend(), y.backend());
1078
+ }
1079
+
1080
+ //
1081
+ // Native non-member operations:
1082
+ //
1083
+ template <unsigned Digits10>
1084
+ inline void eval_sqrt(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val)
1085
+ {
1086
+ mpfi_sqrt(result.data(), val.data());
1087
+ }
1088
+
1089
+ template <unsigned Digits10>
1090
+ inline void eval_abs(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val)
1091
+ {
1092
+ mpfi_abs(result.data(), val.data());
1093
+ }
1094
+
1095
+ template <unsigned Digits10>
1096
+ inline void eval_fabs(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val)
1097
+ {
1098
+ mpfi_abs(result.data(), val.data());
1099
+ }
1100
+ template <unsigned Digits10>
1101
+ inline void eval_ceil(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val)
1102
+ {
1103
+ mpfr_float_backend<Digits10> a, b;
1104
+ mpfr_set(a.data(), val.left_data(), GMP_RNDN);
1105
+ mpfr_set(b.data(), val.right_data(), GMP_RNDN);
1106
+ eval_ceil(a, a);
1107
+ eval_ceil(b, b);
1108
+ if (a.compare(b) != 0)
1109
+ {
1110
+ BOOST_MP_THROW_EXCEPTION(interval_error("Attempt to take the ceil of a value that straddles an integer boundary."));
1111
+ }
1112
+ mpfi_set_fr(result.data(), a.data());
1113
+ }
1114
+ template <unsigned Digits10>
1115
+ inline void eval_floor(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val)
1116
+ {
1117
+ mpfr_float_backend<Digits10> a, b;
1118
+ mpfr_set(a.data(), val.left_data(), GMP_RNDN);
1119
+ mpfr_set(b.data(), val.right_data(), GMP_RNDN);
1120
+ eval_floor(a, a);
1121
+ eval_floor(b, b);
1122
+ if (a.compare(b) != 0)
1123
+ {
1124
+ BOOST_MP_THROW_EXCEPTION(interval_error("Attempt to take the floor of a value that straddles an integer boundary."));
1125
+ }
1126
+ mpfi_set_fr(result.data(), a.data());
1127
+ }
1128
+ template <unsigned Digits10>
1129
+ inline void eval_ldexp(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val, long e)
1130
+ {
1131
+ if (e > 0)
1132
+ mpfi_mul_2exp(result.data(), val.data(), e);
1133
+ else if (e < 0)
1134
+ mpfi_div_2exp(result.data(), val.data(), -e);
1135
+ else
1136
+ result = val;
1137
+ }
1138
+ template <unsigned Digits10>
1139
+ inline void eval_frexp(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val, int* e)
1140
+ {
1141
+ mpfr_float_backend<Digits10> t, rt;
1142
+ mpfi_mid(t.data(), val.data());
1143
+ eval_frexp(rt, t, e);
1144
+ eval_ldexp(result, val, -*e);
1145
+ }
1146
+ template <unsigned Digits10>
1147
+ inline void eval_frexp(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& val, long* e)
1148
+ {
1149
+ mpfr_float_backend<Digits10> t, rt;
1150
+ mpfi_mid(t.data(), val.data());
1151
+ eval_frexp(rt, t, e);
1152
+ eval_ldexp(result, val, -*e);
1153
+ }
1154
+
1155
+ template <unsigned Digits10>
1156
+ inline int eval_fpclassify(const mpfi_float_backend<Digits10>& val) noexcept
1157
+ {
1158
+ return mpfi_inf_p(val.data()) ? FP_INFINITE : mpfi_nan_p(val.data()) ? FP_NAN : mpfi_is_zero(val.data()) ? FP_ZERO : FP_NORMAL;
1159
+ }
1160
+
1161
+ template <unsigned Digits10>
1162
+ inline void eval_pow(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& b, const mpfi_float_backend<Digits10>& e)
1163
+ {
1164
+ using ui_type = typename boost::multiprecision::detail::canonical<unsigned, mpfi_float_backend<Digits10> >::type;
1165
+ using default_ops::eval_get_sign;
1166
+ int s = eval_get_sign(b);
1167
+ if (s == 0)
1168
+ {
1169
+ if (eval_get_sign(e) == 0)
1170
+ {
1171
+ result = ui_type(1);
1172
+ }
1173
+ else
1174
+ {
1175
+ result = ui_type(0);
1176
+ }
1177
+ return;
1178
+ }
1179
+ if (s < 0)
1180
+ {
1181
+ if (eval_get_sign(e) < 0)
1182
+ {
1183
+ mpfi_float_backend<Digits10> t1, t2;
1184
+ t1 = e;
1185
+ t1.negate();
1186
+ eval_pow(t2, b, t1);
1187
+ t1 = ui_type(1);
1188
+ eval_divide(result, t1, t2);
1189
+ return;
1190
+ }
1191
+ typename boost::multiprecision::detail::canonical<std::uintmax_t, mpfi_float_backend<Digits10> >::type an;
1192
+ #ifndef BOOST_NO_EXCEPTIONS
1193
+ try
1194
+ {
1195
+ #endif
1196
+ using default_ops::eval_convert_to;
1197
+ eval_convert_to(&an, e);
1198
+ if (e.compare(an) == 0)
1199
+ {
1200
+ mpfi_float_backend<Digits10> pb(b);
1201
+ pb.negate();
1202
+ eval_pow(result, pb, e);
1203
+ if (an & 1u)
1204
+ result.negate();
1205
+ return;
1206
+ }
1207
+ #ifndef BOOST_NO_EXCEPTIONS
1208
+ }
1209
+ catch (const std::exception&)
1210
+ {
1211
+ // conversion failed, just fall through, value is not an integer.
1212
+ }
1213
+ #endif
1214
+ result = std::numeric_limits<number<mpfi_float_backend<Digits10>, et_on> >::quiet_NaN().backend();
1215
+ return;
1216
+ }
1217
+ mpfi_log(result.data(), b.data());
1218
+ mpfi_mul(result.data(), result.data(), e.data());
1219
+ mpfi_exp(result.data(), result.data());
1220
+ }
1221
+
1222
+ template <unsigned Digits10>
1223
+ inline void eval_exp(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1224
+ {
1225
+ mpfi_exp(result.data(), arg.data());
1226
+ }
1227
+
1228
+ template <unsigned Digits10>
1229
+ inline void eval_exp2(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1230
+ {
1231
+ mpfi_exp2(result.data(), arg.data());
1232
+ }
1233
+
1234
+ template <unsigned Digits10>
1235
+ inline void eval_log(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1236
+ {
1237
+ mpfi_log(result.data(), arg.data());
1238
+ }
1239
+
1240
+ template <unsigned Digits10>
1241
+ inline void eval_log10(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1242
+ {
1243
+ mpfi_log10(result.data(), arg.data());
1244
+ }
1245
+
1246
+ template <unsigned Digits10>
1247
+ inline void eval_sin(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1248
+ {
1249
+ mpfi_sin(result.data(), arg.data());
1250
+ }
1251
+
1252
+ template <unsigned Digits10>
1253
+ inline void eval_cos(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1254
+ {
1255
+ mpfi_cos(result.data(), arg.data());
1256
+ }
1257
+
1258
+ template <unsigned Digits10>
1259
+ inline void eval_tan(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1260
+ {
1261
+ mpfi_tan(result.data(), arg.data());
1262
+ }
1263
+
1264
+ template <unsigned Digits10>
1265
+ inline void eval_asin(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1266
+ {
1267
+ mpfi_asin(result.data(), arg.data());
1268
+ }
1269
+
1270
+ template <unsigned Digits10>
1271
+ inline void eval_acos(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1272
+ {
1273
+ mpfi_acos(result.data(), arg.data());
1274
+ }
1275
+
1276
+ template <unsigned Digits10>
1277
+ inline void eval_atan(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1278
+ {
1279
+ mpfi_atan(result.data(), arg.data());
1280
+ }
1281
+
1282
+ template <unsigned Digits10>
1283
+ inline void eval_atan2(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg1, const mpfi_float_backend<Digits10>& arg2)
1284
+ {
1285
+ mpfi_atan2(result.data(), arg1.data(), arg2.data());
1286
+ }
1287
+
1288
+ template <unsigned Digits10>
1289
+ inline void eval_sinh(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1290
+ {
1291
+ mpfi_sinh(result.data(), arg.data());
1292
+ }
1293
+
1294
+ template <unsigned Digits10>
1295
+ inline void eval_cosh(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1296
+ {
1297
+ mpfi_cosh(result.data(), arg.data());
1298
+ }
1299
+
1300
+ template <unsigned Digits10>
1301
+ inline void eval_tanh(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1302
+ {
1303
+ mpfi_tanh(result.data(), arg.data());
1304
+ }
1305
+
1306
+ template <unsigned Digits10>
1307
+ inline void eval_log2(mpfi_float_backend<Digits10>& result, const mpfi_float_backend<Digits10>& arg)
1308
+ {
1309
+ mpfi_log2(result.data(), arg.data());
1310
+ }
1311
+
1312
+ template <unsigned Digits10>
1313
+ inline std::size_t hash_value(const mpfi_float_backend<Digits10>& val)
1314
+ {
1315
+ std::size_t result = 0;
1316
+ std::size_t len = val.left_data()[0]._mpfr_prec / mp_bits_per_limb;
1317
+ if (val.left_data()[0]._mpfr_prec % mp_bits_per_limb)
1318
+ ++len;
1319
+ for (std::size_t i = 0; i < len; ++i)
1320
+ boost::multiprecision::detail::hash_combine(result, val.left_data()[0]._mpfr_d[i]);
1321
+ boost::multiprecision::detail::hash_combine(result, val.left_data()[0]._mpfr_exp, val.left_data()[0]._mpfr_sign);
1322
+
1323
+ len = val.right_data()[0]._mpfr_prec / mp_bits_per_limb;
1324
+ if (val.right_data()[0]._mpfr_prec % mp_bits_per_limb)
1325
+ ++len;
1326
+ for (std::size_t i = 0; i < len; ++i)
1327
+ boost::multiprecision::detail::hash_combine(result, val.right_data()[0]._mpfr_d[i]);
1328
+ boost::multiprecision::detail::hash_combine(result, val.right_data()[0]._mpfr_exp, val.right_data()[0]._mpfr_sign);
1329
+ return result;
1330
+ }
1331
+
1332
+ template <class To, unsigned D>
1333
+ void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const std::integral_constant<int, number_kind_integer>& to_type, const std::integral_constant<int, number_kind_floating_point>& from_type)
1334
+ {
1335
+ using boost::multiprecision::detail::generic_interconvert;
1336
+ boost::multiprecision::detail::scoped_precision_options<number<mpfr_float_backend<D>>> scoped(from);
1337
+ mpfr_float_backend<D> t;
1338
+ mpfi_mid(t.data(), from.data());
1339
+ generic_interconvert(to, t, to_type, from_type);
1340
+ }
1341
+
1342
+ template <class To, unsigned D>
1343
+ void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const std::integral_constant<int, number_kind_rational>& to_type, const std::integral_constant<int, number_kind_floating_point>& from_type)
1344
+ {
1345
+ using boost::multiprecision::detail::generic_interconvert;
1346
+ boost::multiprecision::detail::scoped_precision_options<number<mpfr_float_backend<D>>> scoped(from);
1347
+ mpfr_float_backend<D> t;
1348
+ mpfi_mid(t.data(), from.data());
1349
+ generic_interconvert(to, t, to_type, from_type);
1350
+ }
1351
+
1352
+ template <class To, unsigned D>
1353
+ void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const std::integral_constant<int, number_kind_floating_point>& to_type, const std::integral_constant<int, number_kind_floating_point>& from_type)
1354
+ {
1355
+ using boost::multiprecision::detail::generic_interconvert;
1356
+ boost::multiprecision::detail::scoped_precision_options<number<mpfr_float_backend<D>>> scoped(from);
1357
+ mpfr_float_backend<D> t;
1358
+ mpfi_mid(t.data(), from.data());
1359
+ generic_interconvert(to, t, to_type, from_type);
1360
+ }
1361
+
1362
+ } // namespace backends
1363
+
1364
+ template <>
1365
+ struct number_category<detail::canonical<mpfi_t, backends::mpfi_float_backend<0> >::type> : public std::integral_constant<int, number_kind_floating_point>
1366
+ {};
1367
+ template <unsigned Digits10>
1368
+ struct is_interval_number<backends::mpfi_float_backend<Digits10> > : public std::integral_constant<bool, true>
1369
+ {};
1370
+
1371
+ //
1372
+ // Special interval specific functions:
1373
+ //
1374
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1375
+ inline number<mpfr_float_backend<Digits10>, ExpressionTemplates> lower(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& val)
1376
+ {
1377
+ boost::multiprecision::detail::scoped_precision_options<number<mpfr_float_backend<Digits10>, ExpressionTemplates> > precision_guard(val);
1378
+ number<mpfr_float_backend<Digits10> > result;
1379
+ mpfr_set(result.backend().data(), val.backend().left_data(), GMP_RNDN);
1380
+ return result;
1381
+ }
1382
+
1383
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1384
+ inline number<mpfr_float_backend<Digits10>, ExpressionTemplates> upper(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& val)
1385
+ {
1386
+ boost::multiprecision::detail::scoped_precision_options<number<mpfr_float_backend<Digits10>, ExpressionTemplates> > precision_guard(val);
1387
+ number<mpfr_float_backend<Digits10> > result;
1388
+ mpfr_set(result.backend().data(), val.backend().right_data(), GMP_RNDN);
1389
+ return result;
1390
+ }
1391
+
1392
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1393
+ inline number<mpfr_float_backend<Digits10>, ExpressionTemplates> median(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& val)
1394
+ {
1395
+ boost::multiprecision::detail::scoped_precision_options<number<mpfr_float_backend<Digits10>, ExpressionTemplates> > precision_guard(val);
1396
+ number<mpfr_float_backend<Digits10> > result;
1397
+ mpfi_mid(result.backend().data(), val.backend().data());
1398
+ return result;
1399
+ }
1400
+
1401
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1402
+ inline number<mpfr_float_backend<Digits10>, ExpressionTemplates> width(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& val)
1403
+ {
1404
+ boost::multiprecision::detail::scoped_precision_options<number<mpfr_float_backend<Digits10>, ExpressionTemplates> > precision_guard(val);
1405
+ number<mpfr_float_backend<Digits10> > result;
1406
+ mpfi_diam_abs(result.backend().data(), val.backend().data());
1407
+ return result;
1408
+ }
1409
+
1410
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1411
+ inline number<mpfi_float_backend<Digits10>, ExpressionTemplates> intersect(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a, const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& b)
1412
+ {
1413
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(a, b);
1414
+ number<mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1415
+ mpfi_intersect(result.backend().data(), a.backend().data(), b.backend().data());
1416
+ return result;
1417
+ }
1418
+
1419
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1420
+ inline number<mpfi_float_backend<Digits10>, ExpressionTemplates> hull(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a, const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& b)
1421
+ {
1422
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(a, b);
1423
+ number<mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1424
+ mpfi_union(result.backend().data(), a.backend().data(), b.backend().data());
1425
+ return result;
1426
+ }
1427
+
1428
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1429
+ inline bool overlap(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a, const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& b)
1430
+ {
1431
+ return (lower(a) <= lower(b) && lower(b) <= upper(a)) ||
1432
+ (lower(b) <= lower(a) && lower(a) <= upper(b));
1433
+ }
1434
+
1435
+ template <unsigned Digits10, expression_template_option ExpressionTemplates1, expression_template_option ExpressionTemplates2>
1436
+ inline bool in(const number<mpfr_float_backend<Digits10>, ExpressionTemplates1>& a, const number<mpfi_float_backend<Digits10>, ExpressionTemplates2>& b)
1437
+ {
1438
+ return mpfi_is_inside_fr(a.backend().data(), b.backend().data()) != 0;
1439
+ }
1440
+
1441
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1442
+ inline bool zero_in(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a)
1443
+ {
1444
+ return mpfi_has_zero(a.backend().data()) != 0;
1445
+ }
1446
+
1447
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1448
+ inline bool subset(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a, const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& b)
1449
+ {
1450
+ return mpfi_is_inside(a.backend().data(), b.backend().data()) != 0;
1451
+ }
1452
+
1453
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1454
+ inline bool proper_subset(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a, const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& b)
1455
+ {
1456
+ return mpfi_is_strictly_inside(a.backend().data(), b.backend().data()) != 0;
1457
+ }
1458
+
1459
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1460
+ inline bool empty(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a)
1461
+ {
1462
+ return mpfi_is_empty(a.backend().data()) != 0;
1463
+ }
1464
+
1465
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1466
+ inline bool singleton(const number<mpfi_float_backend<Digits10>, ExpressionTemplates>& a)
1467
+ {
1468
+ return mpfr_cmp(a.backend().left_data(), a.backend().right_data()) == 0;
1469
+ }
1470
+
1471
+ //
1472
+ // Again with debug_adaptor:
1473
+ //
1474
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1475
+ inline number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> lower(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1476
+ {
1477
+ boost::multiprecision::detail::scoped_default_precision<number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1478
+ number<debug_adaptor<mpfr_float_backend<Digits10> > > result;
1479
+ mpfr_set(result.backend().value().data(), val.backend().value().left_data(), GMP_RNDN);
1480
+ return result;
1481
+ }
1482
+
1483
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1484
+ inline number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> upper(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1485
+ {
1486
+ boost::multiprecision::detail::scoped_default_precision<number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1487
+ number<debug_adaptor<mpfr_float_backend<Digits10> > > result;
1488
+ mpfr_set(result.backend().value().data(), val.backend().value().right_data(), GMP_RNDN);
1489
+ return result;
1490
+ }
1491
+
1492
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1493
+ inline number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> median(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1494
+ {
1495
+ boost::multiprecision::detail::scoped_default_precision<number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1496
+ number<debug_adaptor<mpfr_float_backend<Digits10> > > result;
1497
+ mpfi_mid(result.backend().value().data(), val.backend().value().data());
1498
+ return result;
1499
+ }
1500
+
1501
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1502
+ inline number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> width(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1503
+ {
1504
+ boost::multiprecision::detail::scoped_default_precision<number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1505
+ number<debug_adaptor<mpfr_float_backend<Digits10> > > result;
1506
+ mpfi_diam_abs(result.backend().value().data(), val.backend().value().data());
1507
+ return result;
1508
+ }
1509
+
1510
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1511
+ inline number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> intersect(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1512
+ {
1513
+ boost::multiprecision::detail::scoped_default_precision<number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(a, b);
1514
+ number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1515
+ mpfi_intersect(result.backend().value().data(), a.backend().value().data(), b.backend().value().data());
1516
+ return result;
1517
+ }
1518
+
1519
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1520
+ inline number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> hull(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1521
+ {
1522
+ boost::multiprecision::detail::scoped_default_precision<number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(a, b);
1523
+ number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1524
+ mpfi_union(result.backend().value().data(), a.backend().value().data(), b.backend().value().data());
1525
+ return result;
1526
+ }
1527
+
1528
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1529
+ inline bool overlap(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1530
+ {
1531
+ return (lower(a) <= lower(b) && lower(b) <= upper(a)) ||
1532
+ (lower(b) <= lower(a) && lower(a) <= upper(b));
1533
+ }
1534
+
1535
+ template <unsigned Digits10, expression_template_option ExpressionTemplates1, expression_template_option ExpressionTemplates2>
1536
+ inline bool in(const number<debug_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates1>& a, const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates2>& b)
1537
+ {
1538
+ return mpfi_is_inside_fr(a.backend().value().data(), b.backend().value().data()) != 0;
1539
+ }
1540
+
1541
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1542
+ inline bool zero_in(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a)
1543
+ {
1544
+ return mpfi_has_zero(a.backend().value().data()) != 0;
1545
+ }
1546
+
1547
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1548
+ inline bool subset(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1549
+ {
1550
+ return mpfi_is_inside(a.backend().value().data(), b.backend().value().data()) != 0;
1551
+ }
1552
+
1553
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1554
+ inline bool proper_subset(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1555
+ {
1556
+ return mpfi_is_strictly_inside(a.backend().value().data(), b.backend().value().data()) != 0;
1557
+ }
1558
+
1559
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1560
+ inline bool empty(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a)
1561
+ {
1562
+ return mpfi_is_empty(a.backend().value().data()) != 0;
1563
+ }
1564
+
1565
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1566
+ inline bool singleton(const number<debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a)
1567
+ {
1568
+ return mpfr_cmp(a.backend().value().left_data(), a.backend().value().right_data()) == 0;
1569
+ }
1570
+ //
1571
+ // Again with logged_adaptor:
1572
+ //
1573
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1574
+ inline number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> lower(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1575
+ {
1576
+ boost::multiprecision::detail::scoped_default_precision<number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1577
+ number<logged_adaptor<mpfr_float_backend<Digits10> > > result;
1578
+ mpfr_set(result.backend().value().data(), val.backend().value().left_data(), GMP_RNDN);
1579
+ return result;
1580
+ }
1581
+
1582
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1583
+ inline number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> upper(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1584
+ {
1585
+ boost::multiprecision::detail::scoped_default_precision<number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1586
+ number<logged_adaptor<mpfr_float_backend<Digits10> > > result;
1587
+ mpfr_set(result.backend().value().data(), val.backend().value().right_data(), GMP_RNDN);
1588
+ return result;
1589
+ }
1590
+
1591
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1592
+ inline number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> median(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1593
+ {
1594
+ boost::multiprecision::detail::scoped_default_precision<number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1595
+ number<logged_adaptor<mpfr_float_backend<Digits10> > > result;
1596
+ mpfi_mid(result.backend().value().data(), val.backend().value().data());
1597
+ return result;
1598
+ }
1599
+
1600
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1601
+ inline number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> width(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& val)
1602
+ {
1603
+ boost::multiprecision::detail::scoped_default_precision<number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(val);
1604
+ number<logged_adaptor<mpfr_float_backend<Digits10> > > result;
1605
+ mpfi_diam_abs(result.backend().value().data(), val.backend().value().data());
1606
+ return result;
1607
+ }
1608
+
1609
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1610
+ inline number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> intersect(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1611
+ {
1612
+ boost::multiprecision::detail::scoped_default_precision<number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(a, b);
1613
+ number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1614
+ mpfi_intersect(result.backend().value().data(), a.backend().value().data(), b.backend().value().data());
1615
+ return result;
1616
+ }
1617
+
1618
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1619
+ inline number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> hull(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1620
+ {
1621
+ boost::multiprecision::detail::scoped_default_precision<number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(a, b);
1622
+ number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1623
+ mpfi_union(result.backend().value().data(), a.backend().value().data(), b.backend().value().data());
1624
+ return result;
1625
+ }
1626
+
1627
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1628
+ inline bool overlap(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1629
+ {
1630
+ return (lower(a) <= lower(b) && lower(b) <= upper(a)) ||
1631
+ (lower(b) <= lower(a) && lower(a) <= upper(b));
1632
+ }
1633
+
1634
+ template <unsigned Digits10, expression_template_option ExpressionTemplates1, expression_template_option ExpressionTemplates2>
1635
+ inline bool in(const number<logged_adaptor<mpfr_float_backend<Digits10> >, ExpressionTemplates1>& a, const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates2>& b)
1636
+ {
1637
+ return mpfi_is_inside_fr(a.backend().value().data(), b.backend().value().data()) != 0;
1638
+ }
1639
+
1640
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1641
+ inline bool zero_in(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a)
1642
+ {
1643
+ return mpfi_has_zero(a.backend().value().data()) != 0;
1644
+ }
1645
+
1646
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1647
+ inline bool subset(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1648
+ {
1649
+ return mpfi_is_inside(a.backend().value().data(), b.backend().value().data()) != 0;
1650
+ }
1651
+
1652
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1653
+ inline bool proper_subset(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a, const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& b)
1654
+ {
1655
+ return mpfi_is_strictly_inside(a.backend().value().data(), b.backend().value().data()) != 0;
1656
+ }
1657
+
1658
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1659
+ inline bool empty(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a)
1660
+ {
1661
+ return mpfi_is_empty(a.backend().value().data()) != 0;
1662
+ }
1663
+
1664
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1665
+ inline bool singleton(const number<logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates>& a)
1666
+ {
1667
+ return mpfr_cmp(a.backend().value().left_data(), a.backend().value().right_data()) == 0;
1668
+ }
1669
+ //
1670
+ // component_type specialization:
1671
+ //
1672
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1673
+ struct component_type<number<mpfi_float_backend<Digits10>, ExpressionTemplates> >
1674
+ {
1675
+ using type = number<mpfr_float_backend<Digits10>, ExpressionTemplates>;
1676
+ };
1677
+
1678
+ //
1679
+ // Overloaded special functions which call native mpfr routines:
1680
+ //
1681
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1682
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> asinh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>& arg)
1683
+ {
1684
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(arg);
1685
+
1686
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1687
+ mpfi_asinh(result.backend().data(), arg.backend().data());
1688
+ return result;
1689
+ }
1690
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1691
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> acosh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>& arg)
1692
+ {
1693
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(arg);
1694
+
1695
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1696
+ mpfi_acosh(result.backend().data(), arg.backend().data());
1697
+ return result;
1698
+ }
1699
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1700
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> atanh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>& arg)
1701
+ {
1702
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(arg);
1703
+
1704
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1705
+ mpfi_atanh(result.backend().data(), arg.backend().data());
1706
+ return result;
1707
+ }
1708
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1709
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> cbrt BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>& arg)
1710
+ {
1711
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(arg);
1712
+
1713
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1714
+ mpfi_cbrt(result.backend().data(), arg.backend().data());
1715
+ return result;
1716
+ }
1717
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1718
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> expm1 BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>& arg)
1719
+ {
1720
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(arg);
1721
+
1722
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1723
+ mpfi_expm1(result.backend().data(), arg.backend().data());
1724
+ return result;
1725
+ }
1726
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1727
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> log1p BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>& arg)
1728
+ {
1729
+ boost::multiprecision::detail::scoped_default_precision<number<mpfi_float_backend<Digits10>, ExpressionTemplates> > precision_guard(arg);
1730
+
1731
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> result;
1732
+ mpfi_log1p(result.backend().data(), arg.backend().data());
1733
+ return result;
1734
+ }
1735
+
1736
+ //
1737
+ // And again with debug_adaptor:
1738
+ //
1739
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1740
+ inline boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> asinh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1741
+ {
1742
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1743
+
1744
+ boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1745
+ mpfi_asinh(result.backend().value().data(), arg.backend().value().data());
1746
+ return result;
1747
+ }
1748
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1749
+ inline boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> acosh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1750
+ {
1751
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1752
+
1753
+ boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1754
+ mpfi_acosh(result.backend().value().data(), arg.backend().value().data());
1755
+ return result;
1756
+ }
1757
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1758
+ inline boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> atanh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1759
+ {
1760
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1761
+
1762
+ boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1763
+ mpfi_atanh(result.backend().value().data(), arg.backend().value().data());
1764
+ return result;
1765
+ }
1766
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1767
+ inline boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> cbrt BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1768
+ {
1769
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1770
+
1771
+ boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1772
+ mpfi_cbrt(result.backend().value().data(), arg.backend().value().data());
1773
+ return result;
1774
+ }
1775
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1776
+ inline boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> expm1 BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1777
+ {
1778
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1779
+
1780
+ boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1781
+ mpfi_expm1(result.backend().value().data(), arg.backend().value().data());
1782
+ return result;
1783
+ }
1784
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1785
+ inline boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> log1p BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1786
+ {
1787
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::debug_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1788
+
1789
+ boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1790
+ mpfi_log1p(result.backend().value().data(), arg.backend().value().data());
1791
+ return result;
1792
+ }
1793
+
1794
+ //
1795
+ // And again with logged_adaptor:
1796
+ //
1797
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1798
+ inline boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> asinh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1799
+ {
1800
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1801
+
1802
+ boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1803
+ mpfi_asinh(result.backend().value().data(), arg.backend().value().data());
1804
+ return result;
1805
+ }
1806
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1807
+ inline boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> acosh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1808
+ {
1809
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1810
+
1811
+ boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1812
+ mpfi_acosh(result.backend().value().data(), arg.backend().value().data());
1813
+ return result;
1814
+ }
1815
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1816
+ inline boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> atanh BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1817
+ {
1818
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1819
+
1820
+ boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1821
+ mpfi_atanh(result.backend().value().data(), arg.backend().value().data());
1822
+ return result;
1823
+ }
1824
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1825
+ inline boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> cbrt BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1826
+ {
1827
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1828
+
1829
+ boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1830
+ mpfi_cbrt(result.backend().value().data(), arg.backend().value().data());
1831
+ return result;
1832
+ }
1833
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1834
+ inline boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> expm1 BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1835
+ {
1836
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1837
+
1838
+ boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1839
+ mpfi_expm1(result.backend().value().data(), arg.backend().value().data());
1840
+ return result;
1841
+ }
1842
+ template <unsigned Digits10, expression_template_option ExpressionTemplates>
1843
+ inline boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> log1p BOOST_PREVENT_MACRO_SUBSTITUTION(const boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>& arg)
1844
+ {
1845
+ boost::multiprecision::detail::scoped_default_precision<number<boost::multiprecision::backends::logged_adaptor<mpfi_float_backend<Digits10> >, ExpressionTemplates> > precision_guard(arg);
1846
+
1847
+ boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> result;
1848
+ mpfi_log1p(result.backend().value().data(), arg.backend().value().data());
1849
+ return result;
1850
+ }
1851
+
1852
+ } // namespace multiprecision
1853
+
1854
+ namespace math {
1855
+
1856
+ namespace tools {
1857
+
1858
+ inline void set_output_precision(const boost::multiprecision::mpfi_float& val, std::ostream& os)
1859
+ {
1860
+ os << std::setprecision(val.precision());
1861
+ }
1862
+
1863
+ template <>
1864
+ inline int digits<boost::multiprecision::mpfi_float>()
1865
+ #ifdef BOOST_MATH_NOEXCEPT
1866
+ noexcept
1867
+ #endif
1868
+ {
1869
+ return multiprecision::detail::digits10_2_2(boost::multiprecision::mpfi_float::thread_default_precision());
1870
+ }
1871
+ template <>
1872
+ inline int digits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, boost::multiprecision::et_off> >()
1873
+ #ifdef BOOST_MATH_NOEXCEPT
1874
+ noexcept
1875
+ #endif
1876
+ {
1877
+ return multiprecision::detail::digits10_2_2(boost::multiprecision::mpfi_float::thread_default_precision());
1878
+ }
1879
+
1880
+ template <>
1881
+ inline boost::multiprecision::mpfi_float
1882
+ max_value<boost::multiprecision::mpfi_float>()
1883
+ {
1884
+ boost::multiprecision::mpfi_float result(0.5);
1885
+ mpfi_mul_2exp(result.backend().data(), result.backend().data(), mpfr_get_emax());
1886
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1887
+ return result;
1888
+ }
1889
+
1890
+ template <>
1891
+ inline boost::multiprecision::mpfi_float
1892
+ min_value<boost::multiprecision::mpfi_float>()
1893
+ {
1894
+ boost::multiprecision::mpfi_float result(0.5);
1895
+ mpfi_div_2exp(result.backend().data(), result.backend().data(), -mpfr_get_emin());
1896
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1897
+ return result;
1898
+ }
1899
+
1900
+ template <>
1901
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, boost::multiprecision::et_off>
1902
+ max_value<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, boost::multiprecision::et_off> >()
1903
+ {
1904
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, boost::multiprecision::et_off> result(0.5);
1905
+ mpfi_mul_2exp(result.backend().data(), result.backend().data(), mpfr_get_emax());
1906
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1907
+ return result;
1908
+ }
1909
+
1910
+ template <>
1911
+ inline boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, boost::multiprecision::et_off>
1912
+ min_value<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, boost::multiprecision::et_off> >()
1913
+ {
1914
+ boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, boost::multiprecision::et_off> result(0.5);
1915
+ mpfi_div_2exp(result.backend().data(), result.backend().data(), -mpfr_get_emin());
1916
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1917
+ return result;
1918
+ }
1919
+
1920
+ // mpfi gets used with logged_adaptor fairly often, so specialize for that use case as well:
1921
+ using logged_type1 = boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float::backend_type>, boost::multiprecision::et_on> ;
1922
+ using logged_type2 = boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float::backend_type>, boost::multiprecision::et_off>;
1923
+
1924
+ template <>
1925
+ inline int digits<logged_type1>()
1926
+ #ifdef BOOST_MATH_NOEXCEPT
1927
+ noexcept
1928
+ #endif
1929
+ {
1930
+ return multiprecision::detail::digits10_2_2(logged_type1::thread_default_precision());
1931
+ }
1932
+ template <>
1933
+ inline int digits<logged_type2>()
1934
+ #ifdef BOOST_MATH_NOEXCEPT
1935
+ noexcept
1936
+ #endif
1937
+ {
1938
+ return multiprecision::detail::digits10_2_2(logged_type1::thread_default_precision());
1939
+ }
1940
+
1941
+ template <>
1942
+ inline logged_type1
1943
+ max_value<logged_type1>()
1944
+ {
1945
+ logged_type1 result(0.5);
1946
+ mpfi_mul_2exp(result.backend().value().data(), result.backend().value().data(), mpfr_get_emax());
1947
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1948
+ return result;
1949
+ }
1950
+
1951
+ template <>
1952
+ inline logged_type1
1953
+ min_value<logged_type1>()
1954
+ {
1955
+ logged_type1 result(0.5);
1956
+ mpfi_div_2exp(result.backend().value().data(), result.backend().value().data(), -mpfr_get_emin());
1957
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1958
+ return result;
1959
+ }
1960
+
1961
+ template <>
1962
+ inline logged_type2
1963
+ max_value<logged_type2>()
1964
+ {
1965
+ logged_type2 result(0.5);
1966
+ mpfi_mul_2exp(result.backend().value().data(), result.backend().value().data(), mpfr_get_emax());
1967
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1968
+ return result;
1969
+ }
1970
+
1971
+ template <>
1972
+ inline logged_type2
1973
+ min_value<logged_type2>()
1974
+ {
1975
+ logged_type2 result(0.5);
1976
+ mpfi_div_2exp(result.backend().value().data(), result.backend().value().data(), -mpfr_get_emin());
1977
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
1978
+ return result;
1979
+ }
1980
+ // mpfi gets used with debug_adaptor fairly often, so specialize for that use case as well:
1981
+ using debug_type1 = boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float::backend_type>, boost::multiprecision::et_on> ;
1982
+ using debug_type2 = boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float::backend_type>, boost::multiprecision::et_off>;
1983
+
1984
+ template <>
1985
+ inline int digits<debug_type1>()
1986
+ #ifdef BOOST_MATH_NOEXCEPT
1987
+ noexcept
1988
+ #endif
1989
+ {
1990
+ return multiprecision::detail::digits10_2_2(debug_type1::default_precision());
1991
+ }
1992
+ template <>
1993
+ inline int digits<debug_type2>()
1994
+ #ifdef BOOST_MATH_NOEXCEPT
1995
+ noexcept
1996
+ #endif
1997
+ {
1998
+ return multiprecision::detail::digits10_2_2(debug_type1::default_precision());
1999
+ }
2000
+
2001
+ template <>
2002
+ inline debug_type1
2003
+ max_value<debug_type1>()
2004
+ {
2005
+ debug_type1 result(0.5);
2006
+ mpfi_mul_2exp(result.backend().value().data(), result.backend().value().data(), mpfr_get_emax());
2007
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
2008
+ result.backend().update_view();
2009
+ return result;
2010
+ }
2011
+
2012
+ template <>
2013
+ inline debug_type1
2014
+ min_value<debug_type1>()
2015
+ {
2016
+ debug_type1 result(0.5);
2017
+ mpfi_div_2exp(result.backend().value().data(), result.backend().value().data(), -mpfr_get_emin());
2018
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
2019
+ result.backend().update_view();
2020
+ return result;
2021
+ }
2022
+
2023
+ template <>
2024
+ inline debug_type2
2025
+ max_value<debug_type2>()
2026
+ {
2027
+ debug_type2 result(0.5);
2028
+ mpfi_mul_2exp(result.backend().value().data(), result.backend().value().data(), mpfr_get_emax());
2029
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
2030
+ result.backend().update_view();
2031
+ return result;
2032
+ }
2033
+
2034
+ template <>
2035
+ inline debug_type2
2036
+ min_value<debug_type2>()
2037
+ {
2038
+ debug_type2 result(0.5);
2039
+ mpfi_div_2exp(result.backend().value().data(), result.backend().value().data(), -mpfr_get_emin());
2040
+ //BOOST_MP_ASSERT(mpfi_number_p(result.backend().data()));
2041
+ result.backend().update_view();
2042
+ return result;
2043
+ }
2044
+
2045
+ } // namespace tools
2046
+
2047
+ namespace constants { namespace detail {
2048
+
2049
+ template <class T>
2050
+ struct constant_pi;
2051
+ template <class T>
2052
+ struct constant_ln_two;
2053
+ template <class T>
2054
+ struct constant_euler;
2055
+ template <class T>
2056
+ struct constant_catalan;
2057
+
2058
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2059
+ struct constant_pi<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >
2060
+ {
2061
+ using result_type = boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>;
2062
+ template <int N>
2063
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2064
+ {
2065
+ // Rely on C++11 thread safe initialization:
2066
+ static result_type result{get(std::integral_constant<int, 0>())};
2067
+ return result;
2068
+ }
2069
+ static inline result_type get(const std::integral_constant<int, 0>&)
2070
+ {
2071
+ result_type result;
2072
+ mpfi_const_pi(result.backend().data());
2073
+ return result;
2074
+ }
2075
+ };
2076
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2077
+ struct constant_ln_two<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >
2078
+ {
2079
+ using result_type = boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>;
2080
+ template <int N>
2081
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2082
+ {
2083
+ // Rely on C++11 thread safe initialization:
2084
+ static result_type result{get(std::integral_constant<int, 0>())};
2085
+ return result;
2086
+ }
2087
+ static inline result_type get(const std::integral_constant<int, 0>&)
2088
+ {
2089
+ result_type result;
2090
+ mpfi_const_log2(result.backend().data());
2091
+ return result;
2092
+ }
2093
+ };
2094
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2095
+ struct constant_euler<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >
2096
+ {
2097
+ using result_type = boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>;
2098
+ template <int N>
2099
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2100
+ {
2101
+ // Rely on C++11 thread safe initialization:
2102
+ static result_type result{get(std::integral_constant<int, 0>())};
2103
+ return result;
2104
+ }
2105
+ static inline result_type get(const std::integral_constant<int, 0>&)
2106
+ {
2107
+ result_type result;
2108
+ mpfi_const_euler(result.backend().data());
2109
+ return result;
2110
+ }
2111
+ };
2112
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2113
+ struct constant_catalan<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >
2114
+ {
2115
+ using result_type = boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>;
2116
+ template <int N>
2117
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2118
+ {
2119
+ // Rely on C++11 thread safe initialization:
2120
+ static result_type result{get(std::integral_constant<int, 0>())};
2121
+ return result;
2122
+ }
2123
+ static inline result_type get(const std::integral_constant<int, 0>&)
2124
+ {
2125
+ result_type result;
2126
+ mpfi_const_catalan(result.backend().data());
2127
+ return result;
2128
+ }
2129
+ };
2130
+ //
2131
+ // And again with debug_adaptor:
2132
+ //
2133
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2134
+ struct constant_pi<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2135
+ {
2136
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2137
+ template <int N>
2138
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2139
+ {
2140
+ // C++11 thread safe static initialization:
2141
+ static result_type result{get(std::integral_constant<int, 0>())};
2142
+ return result;
2143
+ }
2144
+ static inline result_type get(const std::integral_constant<int, 0>&)
2145
+ {
2146
+ result_type result;
2147
+ mpfi_const_pi(result.backend().value().data());
2148
+ result.backend().update_view();
2149
+ return result;
2150
+ }
2151
+ };
2152
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2153
+ struct constant_ln_two<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2154
+ {
2155
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2156
+ template <int N>
2157
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2158
+ {
2159
+ // C++11 thread safe static initialization:
2160
+ static result_type result{get(std::integral_constant<int, 0>())};
2161
+ return result;
2162
+ }
2163
+ static inline result_type get(const std::integral_constant<int, 0>&)
2164
+ {
2165
+ result_type result;
2166
+ mpfi_const_log2(result.backend().value().data());
2167
+ result.backend().update_view();
2168
+ return result;
2169
+ }
2170
+ };
2171
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2172
+ struct constant_euler<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2173
+ {
2174
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2175
+ template <int N>
2176
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2177
+ {
2178
+ // C++11 thread safe static initialization:
2179
+ static result_type result{get(std::integral_constant<int, 0>())};
2180
+ return result;
2181
+ }
2182
+ static inline result_type get(const std::integral_constant<int, 0>&)
2183
+ {
2184
+ result_type result;
2185
+ mpfi_const_euler(result.backend().value().data());
2186
+ result.backend().update_view();
2187
+ return result;
2188
+ }
2189
+ };
2190
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2191
+ struct constant_catalan<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2192
+ {
2193
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2194
+ template <int N>
2195
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2196
+ {
2197
+ // C++11 thread safe static initialization:
2198
+ static result_type result{get(std::integral_constant<int, 0>())};
2199
+ return result;
2200
+ }
2201
+ static inline result_type get(const std::integral_constant<int, 0>&)
2202
+ {
2203
+ result_type result;
2204
+ mpfi_const_catalan(result.backend().value().data());
2205
+ result.backend().update_view();
2206
+ return result;
2207
+ }
2208
+ };
2209
+ //
2210
+ // And again with logged_adaptor:
2211
+ //
2212
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2213
+ struct constant_pi<boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2214
+ {
2215
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2216
+ template <int N>
2217
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2218
+ {
2219
+ // C++11 thread safe static initialization:
2220
+ static result_type result{get(std::integral_constant<int, 0>())};
2221
+ return result;
2222
+ }
2223
+ static inline result_type get(const std::integral_constant<int, 0>&)
2224
+ {
2225
+ result_type result;
2226
+ mpfi_const_pi(result.backend().value().data());
2227
+ return result;
2228
+ }
2229
+ };
2230
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2231
+ struct constant_ln_two<boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2232
+ {
2233
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2234
+ template <int N>
2235
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2236
+ {
2237
+ // C++11 thread safe static initialization:
2238
+ static result_type result{get(std::integral_constant<int, 0>())};
2239
+ return result;
2240
+ }
2241
+ static inline result_type get(const std::integral_constant<int, 0>&)
2242
+ {
2243
+ result_type result;
2244
+ mpfi_const_log2(result.backend().value().data());
2245
+ return result;
2246
+ }
2247
+ };
2248
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2249
+ struct constant_euler<boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2250
+ {
2251
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2252
+ template <int N>
2253
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2254
+ {
2255
+ // C++11 thread safe static initialization:
2256
+ static result_type result{get(std::integral_constant<int, 0>())};
2257
+ return result;
2258
+ }
2259
+ static inline result_type get(const std::integral_constant<int, 0>&)
2260
+ {
2261
+ result_type result;
2262
+ mpfi_const_euler(result.backend().value().data());
2263
+ return result;
2264
+ }
2265
+ };
2266
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2267
+ struct constant_catalan<boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates> >
2268
+ {
2269
+ using result_type = boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<boost::multiprecision::mpfi_float_backend<Digits10> >, ExpressionTemplates>;
2270
+ template <int N>
2271
+ static inline const result_type& get(const std::integral_constant<int, N>&)
2272
+ {
2273
+ // C++11 thread safe static initialization:
2274
+ static result_type result{get(std::integral_constant<int, 0>())};
2275
+ return result;
2276
+ }
2277
+ static inline result_type get(const std::integral_constant<int, 0>&)
2278
+ {
2279
+ result_type result;
2280
+ mpfi_const_catalan(result.backend().value().data());
2281
+ return result;
2282
+ }
2283
+ };
2284
+
2285
+ }} // namespace constants::detail
2286
+
2287
+ } // namespace math
2288
+ } // namespace boost
2289
+
2290
+ namespace std {
2291
+
2292
+ //
2293
+ // numeric_limits [partial] specializations for the types declared in this header:
2294
+ //
2295
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2296
+ class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >
2297
+ {
2298
+ using number_type = boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates>;
2299
+ static number_type get_min()
2300
+ {
2301
+ number_type value(0.5);
2302
+ mpfi_div_2exp(value.backend().data(), value.backend().data(), -mpfr_get_emin());
2303
+ return value;
2304
+ }
2305
+ static number_type get_max()
2306
+ {
2307
+ number_type value(0.5);
2308
+ mpfi_mul_2exp(value.backend().data(), value.backend().data(), mpfr_get_emax());
2309
+ return value;
2310
+ }
2311
+ static number_type get_epsilon()
2312
+ {
2313
+ number_type value(1);
2314
+ mpfi_div_2exp(value.backend().data(), value.backend().data(), std::numeric_limits<number_type>::digits - 1);
2315
+ return value;
2316
+ }
2317
+ static number_type get_infinity()
2318
+ {
2319
+ number_type value;
2320
+ boost::multiprecision::mpfr_float_backend<Digits10> t;
2321
+ mpfr_set_inf(t.data(), 1);
2322
+ mpfi_set_fr(value.backend().data(), t.data());
2323
+ return value;
2324
+ }
2325
+ static number_type get_quiet_NaN()
2326
+ {
2327
+ number_type value;
2328
+ boost::multiprecision::mpfr_float_backend<Digits10> t;
2329
+ mpfr_set_nan(t.data());
2330
+ mpfi_set_fr(value.backend().data(), t.data());
2331
+ return value;
2332
+ }
2333
+
2334
+ public:
2335
+ static constexpr bool is_specialized = true;
2336
+ static number_type(min)()
2337
+ {
2338
+ static number_type value{get_min()};
2339
+ return value;
2340
+ }
2341
+ static number_type(max)()
2342
+ {
2343
+ static number_type value{get_max()};
2344
+ return value;
2345
+ }
2346
+ static constexpr number_type lowest()
2347
+ {
2348
+ return -(max)();
2349
+ }
2350
+ static constexpr int digits = static_cast<int>((Digits10 * 1000L) / 301L + ((Digits10 * 1000L) % 301 ? 2 : 1));
2351
+ static constexpr int digits10 = Digits10;
2352
+ // Is this really correct???
2353
+ static constexpr int max_digits10 = boost::multiprecision::detail::calc_max_digits10<digits>::value;
2354
+ static constexpr bool is_signed = true;
2355
+ static constexpr bool is_integer = false;
2356
+ static constexpr bool is_exact = false;
2357
+ static constexpr int radix = 2;
2358
+ static number_type epsilon()
2359
+ {
2360
+ static number_type value{get_epsilon()};
2361
+ return value;
2362
+ }
2363
+ // What value should this be????
2364
+ static number_type round_error()
2365
+ {
2366
+ return 0.5;
2367
+ }
2368
+ static constexpr long min_exponent = MPFR_EMIN_DEFAULT;
2369
+ static constexpr long min_exponent10 = (MPFR_EMIN_DEFAULT / 1000) * 301L;
2370
+ static constexpr long max_exponent = MPFR_EMAX_DEFAULT;
2371
+ static constexpr long max_exponent10 = (MPFR_EMAX_DEFAULT / 1000) * 301L;
2372
+ static constexpr bool has_infinity = true;
2373
+ static constexpr bool has_quiet_NaN = true;
2374
+ static constexpr bool has_signaling_NaN = false;
2375
+ #ifdef _MSC_VER
2376
+ #pragma warning(push)
2377
+ #pragma warning(disable : 4996)
2378
+ #endif
2379
+ static constexpr float_denorm_style has_denorm = denorm_absent;
2380
+ #ifdef _MSC_VER
2381
+ #pragma warning(pop)
2382
+ #endif
2383
+ static constexpr bool has_denorm_loss = false;
2384
+ static number_type infinity()
2385
+ {
2386
+ static number_type value{get_infinity()};
2387
+ return value;
2388
+ }
2389
+ static number_type quiet_NaN()
2390
+ {
2391
+ static number_type value{get_quiet_NaN()};
2392
+ return value;
2393
+ }
2394
+ static constexpr number_type signaling_NaN()
2395
+ {
2396
+ return number_type(0);
2397
+ }
2398
+ static constexpr number_type denorm_min() { return (min)(); }
2399
+ static constexpr bool is_iec559 = false;
2400
+ static constexpr bool is_bounded = true;
2401
+ static constexpr bool is_modulo = false;
2402
+ static constexpr bool traps = true;
2403
+ static constexpr bool tinyness_before = false;
2404
+ static constexpr float_round_style round_style = round_to_nearest;
2405
+ };
2406
+
2407
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2408
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::digits;
2409
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2410
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::digits10;
2411
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2412
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::max_digits10;
2413
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2414
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::is_signed;
2415
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2416
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::is_integer;
2417
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2418
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::is_exact;
2419
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2420
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::radix;
2421
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2422
+ constexpr long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::min_exponent;
2423
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2424
+ constexpr long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::min_exponent10;
2425
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2426
+ constexpr long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::max_exponent;
2427
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2428
+ constexpr long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::max_exponent10;
2429
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2430
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::has_infinity;
2431
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2432
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::has_quiet_NaN;
2433
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2434
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::has_signaling_NaN;
2435
+ #ifdef _MSC_VER
2436
+ #pragma warning(push)
2437
+ #pragma warning(disable : 4996)
2438
+ #endif
2439
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2440
+ constexpr float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::has_denorm;
2441
+ #ifdef _MSC_VER
2442
+ #pragma warning(pop)
2443
+ #endif
2444
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2445
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::has_denorm_loss;
2446
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2447
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::is_iec559;
2448
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2449
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::is_bounded;
2450
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2451
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::is_modulo;
2452
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2453
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::traps;
2454
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2455
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::tinyness_before;
2456
+ template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
2457
+ constexpr float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<Digits10>, ExpressionTemplates> >::round_style;
2458
+
2459
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2460
+ class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >
2461
+ {
2462
+ using number_type = boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates>;
2463
+
2464
+ public:
2465
+ static constexpr bool is_specialized = false;
2466
+ static number_type(min)() { return number_type(0); }
2467
+ static number_type(max)() { return number_type(0); }
2468
+ static number_type lowest() { return number_type(0); }
2469
+ static constexpr int digits = 0;
2470
+ static constexpr int digits10 = 0;
2471
+ static constexpr int max_digits10 = 0;
2472
+ static constexpr bool is_signed = false;
2473
+ static constexpr bool is_integer = false;
2474
+ static constexpr bool is_exact = false;
2475
+ static constexpr int radix = 0;
2476
+ static number_type epsilon() { return number_type(0); }
2477
+ static number_type round_error() { return number_type(0); }
2478
+ static constexpr int min_exponent = 0;
2479
+ static constexpr int min_exponent10 = 0;
2480
+ static constexpr int max_exponent = 0;
2481
+ static constexpr int max_exponent10 = 0;
2482
+ static constexpr bool has_infinity = false;
2483
+ static constexpr bool has_quiet_NaN = false;
2484
+ static constexpr bool has_signaling_NaN = false;
2485
+ #ifdef _MSC_VER
2486
+ #pragma warning(push)
2487
+ #pragma warning(disable : 4996)
2488
+ #endif
2489
+ static constexpr float_denorm_style has_denorm = denorm_absent;
2490
+ #ifdef _MSC_VER
2491
+ #pragma warning(pop)
2492
+ #endif
2493
+ static constexpr bool has_denorm_loss = false;
2494
+ static number_type infinity() { return number_type(0); }
2495
+ static number_type quiet_NaN() { return number_type(0); }
2496
+ static number_type signaling_NaN() { return number_type(0); }
2497
+ static number_type denorm_min() { return number_type(0); }
2498
+ static constexpr bool is_iec559 = false;
2499
+ static constexpr bool is_bounded = false;
2500
+ static constexpr bool is_modulo = false;
2501
+ static constexpr bool traps = false;
2502
+ static constexpr bool tinyness_before = false;
2503
+ static constexpr float_round_style round_style = round_toward_zero;
2504
+ };
2505
+
2506
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2507
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::digits;
2508
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2509
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::digits10;
2510
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2511
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::max_digits10;
2512
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2513
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::is_signed;
2514
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2515
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::is_integer;
2516
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2517
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::is_exact;
2518
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2519
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::radix;
2520
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2521
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::min_exponent;
2522
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2523
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::min_exponent10;
2524
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2525
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::max_exponent;
2526
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2527
+ constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::max_exponent10;
2528
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2529
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::has_infinity;
2530
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2531
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::has_quiet_NaN;
2532
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2533
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::has_signaling_NaN;
2534
+ #ifdef _MSC_VER
2535
+ #pragma warning(push)
2536
+ #pragma warning(disable : 4996)
2537
+ #endif
2538
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2539
+ constexpr float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::has_denorm;
2540
+ #ifdef _MSC_VER
2541
+ #pragma warning(pop)
2542
+ #endif
2543
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2544
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::has_denorm_loss;
2545
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2546
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::is_iec559;
2547
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2548
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::is_bounded;
2549
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2550
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::is_modulo;
2551
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2552
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::traps;
2553
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2554
+ constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::tinyness_before;
2555
+ template <boost::multiprecision::expression_template_option ExpressionTemplates>
2556
+ constexpr float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_float_backend<0>, ExpressionTemplates> >::round_style;
2557
+
2558
+ } // namespace std
2559
+ #endif