- Sort Score
- Result 10 results
- Languages All
Results 1 - 6 of 6 for roundDown (0.12 sec)
-
src/math/big/decimal_test.go
{12999999, 4, "12990000", "13000000", "13000000"}, } { x := nat(nil).setUint64(test.x) var d decimal d.init(x, 0) d.roundDown(test.n) if got := d.String(); got != test.down { t.Errorf("roundDown(%d, %d) = %s; want %s", test.x, test.n, got, test.down) } d.init(x, 0) d.round(test.n) if got := d.String(); got != test.even {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 18 05:54:35 UTC 2016 - 3.3K bytes - Viewed (0) -
src/strconv/decimal_test.go
} func TestDecimalRound(t *testing.T) { for i := 0; i < len(roundtests); i++ { test := &roundtests[i] d := NewDecimal(test.i) d.RoundDown(test.nd) s := d.String() if s != test.down { t.Errorf("Decimal %v RoundDown %d = %v, want %v", test.i, test.nd, s, test.down) } d = NewDecimal(test.i) d.Round(test.nd) s = d.String() if s != test.round {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 08 04:08:51 UTC 2014 - 3K bytes - Viewed (0) -
src/math/big/decimal.go
// If n < 0, x remains unchanged. func (x *decimal) round(n int) { if n < 0 || n >= len(x.mant) { return // nothing to do } if shouldRoundUp(x, n) { x.roundUp(n) } else { x.roundDown(n) } } func (x *decimal) roundUp(n int) { if n < 0 || n >= len(x.mant) { return // nothing to do } // 0 <= n < len(x.mant) // find first digit < '9'
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 29 22:45:29 UTC 2020 - 6.6K bytes - Viewed (0) -
src/strconv/decimal.go
// 0.09 -> 0.1. func (a *decimal) Round(nd int) { if nd < 0 || nd >= a.nd { return } if shouldRoundUp(a, nd) { a.RoundUp(nd) } else { a.RoundDown(nd) } } // Round a down to nd digits (or fewer). func (a *decimal) RoundDown(nd int) { if nd < 0 || nd >= a.nd { return } a.nd = nd trim(a) } // Round a up to nd digits (or fewer). func (a *decimal) RoundUp(nd int) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sat Jul 15 19:41:25 UTC 2017 - 11K bytes - Viewed (0) -
src/math/big/ftoa.go
// If it's okay to do either, then round to the nearest one. // If it's okay to do only one, do it. switch { case okdown && okup: d.round(i + 1) return case okdown: d.roundDown(i + 1) return case okup: d.roundUp(i + 1) return } } } // %e: d.ddddde±dd func fmtE(buf []byte, fmt byte, prec int, d decimal) []byte { // first digit ch := byte('0')
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 11:59:09 UTC 2023 - 13.5K bytes - Viewed (0) -
src/strconv/ftoa.go
// If it's okay to do either, then round to the nearest one. // If it's okay to do only one, do it. switch { case okdown && okup: d.Round(mi + 1) return case okdown: d.RoundDown(mi + 1) return case okup: d.RoundUp(mi + 1) return } } } type decimalSlice struct { d []byte nd, dp int } // %e: -d.ddddde±dd
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Apr 04 14:21:28 UTC 2024 - 13.9K bytes - Viewed (0)