Server IP : 104.21.38.3 / Your IP : 162.158.108.78 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/boost/boost_1_59_0/boost/polygon/ |
Upload File : |
/* Copyright 2008 Intel Corporation Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). */ #ifndef BOOST_POLYGON_GMP_OVERRIDE_HPP #define BOOST_POLYGON_GMP_OVERRIDE_HPP #include <gmpxx.h> namespace boost { namespace polygon { class gmp_int { private: inline gmp_int(const mpq_class& input) : v_(input) {} public: inline gmp_int() {} explicit inline gmp_int(long input) : v_(input) {} inline gmp_int(const gmp_int& input) : v_(input.v_) {} inline gmp_int& operator=(const gmp_int& that) { v_ = that.v_; return (*this); } inline gmp_int& operator=(long that) { v_ = that; return (*this); } inline operator int() const { std::cout << "cast\n"; mpz_class num = v_.get_num(); mpz_class den = v_.get_den(); num /= den; return num.get_si(); } inline double get_d() const { return v_.get_d(); } inline int get_num() const { return v_.get_num().get_si(); } inline int get_den() const { return v_.get_den().get_si(); } inline bool operator==(const gmp_int& that) const { return v_ == that.v_; } inline bool operator!=(const gmp_int& that) const { return v_ != that.v_; } inline bool operator<(const gmp_int& that) const { bool retval = v_ < that.v_; return retval; } inline bool operator<=(const gmp_int& that) const { return v_ <= that.v_; } inline bool operator>(const gmp_int& that) const { return v_ > that.v_; } inline bool operator>=(const gmp_int& that) const { return v_ >= that.v_; } inline gmp_int operator+(const gmp_int& b) { return gmp_int((*this).v_ + b.v_); } inline gmp_int operator-(const gmp_int& b) { return gmp_int((*this).v_ - b.v_); } inline gmp_int operator*(const gmp_int& b) { return gmp_int((*this).v_ * b.v_); } inline gmp_int operator/(const gmp_int& b) { return gmp_int((*this).v_ / b.v_); } inline gmp_int& operator+=(const gmp_int& b) { (*this).v_ += b.v_; return (*this); } inline gmp_int& operator-=(const gmp_int& b) { (*this).v_ -= b.v_; return (*this); } inline gmp_int& operator*=(const gmp_int& b) { (*this).v_ *= b.v_; return (*this); } inline gmp_int& operator/=(const gmp_int& b) { (*this).v_ /= b.v_; return (*this); } inline gmp_int& operator++() { ++v_; return (*this); } inline gmp_int& operator--() { --v_; return (*this); } inline gmp_int operator++(int) { gmp_int retval(*this); ++(*this); return retval; } inline gmp_int operator--(int) { gmp_int retval(*this); --(*this); return retval; } private: mpq_class v_; }; template <> struct high_precision_type<int> { typedef mpq_class type; }; template <> int convert_high_precision_type<int>(const mpq_class& v) { mpz_class num = v.get_num(); mpz_class den = v.get_den(); num /= den; return num.get_si(); }; } } #endif