github.com/goplus/gox@v1.14.13-0.20240308130321-6ff7f61cfae8/internal/builtin/_big.gop (about) 1 /* 2 Copyright 2021 The GoPlus Authors (goplus.org) 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 http://www.apache.org/licenses/LICENSE-2.0 7 Unless required by applicable law or agreed to in writing, software 8 distributed under the License is distributed on an "AS IS" BASIS, 9 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 See the License for the specific language governing permissions and 11 limitations under the License. 12 */ 13 14 // +build ignore 15 16 package _ 17 18 import ( 19 "math/big" 20 ) 21 22 // ----------------------------------------------------------------------------- 23 // type bigint 24 25 // A bigint represents a signed multi-precision integer. 26 // The zero value for a bigint represents nil. 27 type bigint struct { 28 *big.Int 29 } 30 31 func (a bigint) + (b bigint) bigint 32 func (a bigint) - (b bigint) bigint 33 func (a bigint) * (b bigint) bigint 34 func (a bigint) / (b bigint) bigint 35 func (a bigint) % (b bigint) bigint 36 37 func (a bigint) | (b bigint) bigint 38 func (a bigint) ^ (b bigint) bigint 39 func (a bigint) & (b bigint) bigint 40 func (a bigint) &^ (b bigint) bigint 41 42 func (a bigint) << (n untyped_uint) bigint 43 func (a bigint) >> (n untyped_uint) bigint 44 func (a bigint) < (b bigint) bool 45 func (a bigint) <= (b bigint) bool 46 func (a bigint) > (b bigint) bool 47 func (a bigint) >= (b bigint) bool 48 func (a bigint) == (b bigint) bool 49 func (a bigint) != (b bigint) bool 50 51 func +(a bigint) bigint 52 func -(a bigint) bigint 53 func ^(a bigint) bigint 54 55 func (a bigint) += (b bigint) 56 func (a bigint) -= (b bigint) 57 func (a bigint) *= (b bigint) 58 func (a bigint) /= (b bigint) 59 func (a bigint) %= (b bigint) 60 61 func (a bigint) |= (b bigint) 62 func (a bigint) ^= (b bigint) 63 func (a bigint) &= (b bigint) 64 func (a bigint) &^= (b bigint) 65 66 func (a bigint) <<= (n untyped_uint) 67 func (a bigint) >>= (n untyped_uint) 68 69 func bigint() bigint 70 func bigint(x int64) bigint 71 72 // ----------------------------------------------------------------------------- 73 // type bigrat 74 75 // A bigrat represents a quotient a/b of arbitrary precision. 76 // The zero value for a bigrat represents nil. 77 type bigrat struct { 78 *big.Rat 79 } 80 81 func (a bigrat) + (b bigrat) bigrat 82 func (a bigrat) - (b bigrat) bigrat 83 func (a bigrat) * (b bigrat) bigrat 84 func (a bigrat) / (b bigrat) bigrat 85 86 func (a bigrat) < (b bigrat) bool 87 func (a bigrat) <= (b bigrat) bool 88 func (a bigrat) > (b bigrat) bool 89 func (a bigrat) >= (b bigrat) bool 90 func (a bigrat) == (b bigrat) bool 91 func (a bigrat) != (b bigrat) bool 92 93 func +(a bigrat) bigrat 94 func -(a bigrat) bigrat 95 func /(a bigrat) bigrat 96 97 func (a bigrat) += (b bigrat) 98 func (a bigrat) -= (b bigrat) 99 func (a bigrat) *= (b bigrat) 100 func (a bigrat) /= (b bigrat) 101 102 func bigrat() bigrat 103 func bigrat(a bigint) bigrat 104 func bigrat(a, b int64) bigrat 105 106 // ----------------------------------------------------------------------------- 107 // type bigfloat 108 109 // A bigfloat represents a multi-precision floating point number. 110 // The zero value for a bigfloat represents nil. 111 type bigfloat struct { 112 *big.Float 113 } 114 115 // -----------------------------------------------------------------------------