Home | History | Annotate | Download | only in big

Lines Matching defs:decimal

5 // This file implements multi-precision decimal numbers.
6 // The implementation is for float to decimal conversion only;
9 // decimal and rounding.
12 // strconv/decimal.go: conversion of binary fractional values can be done
13 // precisely in multi-precision decimal because 2 divides 10 (required for
14 // >> of mantissa); but conversion of decimal floating-point values cannot
17 // In contrast to strconv/decimal.go, only right shift is implemented in
18 // decimal format - left shift can be done precisely in binary format.
22 // A decimal represents an unsigned floating-point number in decimal representation.
23 // The value of a non-zero decimal d is d.mant * 10**d.exp with 0.1 <= d.mant < 1,
24 // with the most-significant mantissa digit at index 0. For the zero decimal, the
26 // The zero value for decimal represents a ready-to-use 0.0.
27 type decimal struct {
33 func (d *decimal) at(i int) byte {
44 // TODO(gri) Since we know the desired decimal precision when converting
45 // a floating-point number, we may be able to limit the number of decimal
53 // Init initializes x to the decimal representation of m << shift (for
55 func (x *decimal) init(m nat, shift int) {
65 // decimal format (since that is likely slower).
82 // Convert mantissa into decimal representation.
87 // the decimal point independent of the number of digits.
93 // Do any (remaining) shift right in decimal representation.
104 func shr(x *decimal, s uint) {
160 func (x *decimal) String() string {
199 func shouldRoundUp(x *decimal, n int) bool {
211 func (x *decimal) round(n int) {
223 func (x *decimal) roundUp(n int) {
248 func (x *decimal) roundDown(n int) {
258 func trim(x *decimal) {