Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for FloatString (0.49 sec)

  1. src/crypto/internal/mlkem768/mlkem768_test.go

    		panic("d out of range")
    	}
    
    	precise := big.NewRat((1<<d)*int64(x), q) // (2ᵈ / q) * x == (2ᵈ * x) / q
    
    	// FloatString rounds halves away from 0, and our result should always be positive,
    	// so it should work as we expect. (There's no direct way to round a Rat.)
    	rounded, err := strconv.ParseInt(precise.FloatString(0), 10, 64)
    	if err != nil {
    		panic(err)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 06 15:27:18 UTC 2024
    - 10.3K bytes
    - Viewed (0)
  2. src/math/big/ratconv_test.go

    	{".55", -1, "1"},
    }
    
    func TestFloatString(t *testing.T) {
    	for i, test := range floatStringTests {
    		x, _ := new(Rat).SetString(test.in)
    
    		if x.FloatString(test.prec) != test.out {
    			t.Errorf("#%d got %s want %s", i, x.FloatString(test.prec), test.out)
    		}
    	}
    }
    
    // Test inputs to Rat.SetString. The prefix "long:" causes the test
    // to be skipped except in -long mode.  (The threshold is about 500us.)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 15 22:16:34 UTC 2023
    - 19.3K bytes
    - Viewed (0)
  3. src/math/big/ratconv.go

    	if x.IsInt() {
    		return x.a.String()
    	}
    	return x.String()
    }
    
    // FloatString returns a string representation of x in decimal form with prec
    // digits of precision after the radix point. The last digit is rounded to
    // nearest, with halves rounded away from zero.
    func (x *Rat) FloatString(prec int) string {
    	var buf []byte
    
    	if x.IsInt() {
    		buf = x.a.Append(buf, 10)
    		if prec > 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 15 22:16:34 UTC 2023
    - 12.3K bytes
    - Viewed (0)
  4. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"(*Rat).Add", Method, 0},
    		{"(*Rat).Cmp", Method, 0},
    		{"(*Rat).Denom", Method, 0},
    		{"(*Rat).Float32", Method, 4},
    		{"(*Rat).Float64", Method, 1},
    		{"(*Rat).FloatPrec", Method, 22},
    		{"(*Rat).FloatString", Method, 0},
    		{"(*Rat).GobDecode", Method, 0},
    		{"(*Rat).GobEncode", Method, 0},
    		{"(*Rat).Inv", Method, 0},
    		{"(*Rat).IsInt", Method, 0},
    		{"(*Rat).MarshalText", Method, 3},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top