bi
An arbitrary precision integer library for C++.
Loading...
Searching...
No Matches
bi_exceptions.hpp
1/*
2Copyright 2024 Owain Davies
3SPDX-License-Identifier: Apache-2.0
4*/
5
6#ifndef BI_INCLUDE_BI_EXCEPTIONS_HPP_
7#define BI_INCLUDE_BI_EXCEPTIONS_HPP_
8
9#include <version>
10#ifdef __cpp_lib_source_location
11#include <source_location>
12#endif
13#include <stdexcept>
14#include <string>
15
16namespace bi {
17
18class exception : public std::runtime_error {
19 public:
20#ifdef __cpp_lib_source_location
21 exception(const std::string& message, const std::source_location& location =
22 std::source_location::current());
23#else
24 explicit exception(const std::string& message);
25#endif
26};
27
28class overflow_error : public exception {
29 public:
30 using exception::exception;
31};
32
34 public:
35 using exception::exception;
36};
37
38class from_float : public exception {
39 public:
40 using exception::exception;
41};
42
43} // namespace bi
44
45#endif // BI_INCLUDE_BI_EXCEPTIONS_HPP_
Throws if a division by zero attempt is detected.
Definition bi_exceptions.hpp:33
Base exception class for the bi library.
Definition bi_exceptions.hpp:18
Throws when attempting to convert a NaN or infinity to a bi_t.
Definition bi_exceptions.hpp:38
Throws if an operation expects the result to require a digit vector with size() exceeding max_size()....
Definition bi_exceptions.hpp:28