Marcel van Lohuizen | b5dc192 | 2018-12-11 11:49:57 +0100 | [diff] [blame] | 1 | // Copyright 2018 The CUE Authors |
| 2 | // |
| 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 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // Copyright 2018 The Go Authors. All rights reserved. |
| 16 | // Use of this source code is governed by a BSD-style |
| 17 | // license that can be found in the LICENSE file. |
| 18 | |
| 19 | //go:generate qgo -exclude= extract math/big |
| 20 | |
| 21 | package math |
| 22 | |
| 23 | import "math/big" |
| 24 | |
| 25 | // Exponent and precision limits. |
| 26 | const ( |
| 27 | MaxExp = 2147483647 // largest supported exponent |
| 28 | MinExp = -2147483648 // smallest supported exponent |
| 29 | MaxPrec = 4294967295 // largest (theoretically) supported precision; likely memory-limited |
| 30 | ) |
| 31 | |
| 32 | // These constants define supported rounding modes. |
| 33 | const ( |
| 34 | ToNearestEven = 0 // == IEEE 754-2008 roundTiesToEven |
| 35 | ToNearestAway = 1 // == IEEE 754-2008 roundTiesToAway |
| 36 | ToZero = 2 // == IEEE 754-2008 roundTowardZero |
| 37 | AwayFromZero = 3 // no IEEE 754-2008 equivalent |
| 38 | ToNegativeInf = 4 // == IEEE 754-2008 roundTowardNegative |
| 39 | ToPositiveInf = 5 // == IEEE 754-2008 roundTowardPositive |
| 40 | ) |
| 41 | |
| 42 | // Constants describing the Accuracy of a Float. |
| 43 | const ( |
| 44 | Below = -1 |
| 45 | Exact = 0 |
| 46 | Above = 1 |
| 47 | ) |
| 48 | |
| 49 | // Jacobi returns the Jacobi symbol (x/y), either +1, -1, or 0. |
| 50 | // The y argument must be an odd integer. |
| 51 | func Jacobi(x, y *big.Int) int { |
| 52 | return big.Jacobi(x, y) |
| 53 | } |
| 54 | |
| 55 | // MaxBase is the largest number base accepted for string conversions. |
| 56 | const MaxBase = 62 |