Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for roundDown (0.33 sec)

  1. 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)
  2. 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)
  3. 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)
Back to top