- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for FloatString (0.33 sec)
-
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) -
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) -
src/math/big/example_rat_test.go
// Print r both as a fraction and as a floating-point number. // Since big.Rat implements fmt.Formatter, we can use %-13s to // get a left-aligned string representation of the fraction. fmt.Printf("%-13s = %s\n", r, r.FloatString(8)) } // Output: // 2/1 = 2.00000000 // 3/1 = 3.00000000 // 8/3 = 2.66666667 // 11/4 = 2.75000000 // 19/7 = 2.71428571 // 87/32 = 2.71875000
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Apr 11 16:34:30 UTC 2022 - 1.7K bytes - Viewed (0) -
src/math/big/example_test.go
package big_test import ( "fmt" "log" "math" "math/big" ) func ExampleRat_SetString() { r := new(big.Rat) r.SetString("355/113") fmt.Println(r.FloatString(3)) // Output: 3.142 } func ExampleInt_SetString() { i := new(big.Int) i.SetString("644", 8) // octal fmt.Println(i) // Output: 420 } func ExampleFloat_SetString() { f := new(big.Float)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Aug 26 16:15:32 UTC 2020 - 4K bytes - Viewed (0) -
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) -
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) -
api/go1.txt
pkg math/big, method (*Rat) Abs(*Rat) *Rat pkg math/big, method (*Rat) Add(*Rat, *Rat) *Rat pkg math/big, method (*Rat) Cmp(*Rat) int pkg math/big, method (*Rat) Denom() *Int pkg math/big, method (*Rat) FloatString(int) string pkg math/big, method (*Rat) GobDecode([]uint8) error pkg math/big, method (*Rat) GobEncode() ([]uint8, error) pkg math/big, method (*Rat) Inv(*Rat) *Rat pkg math/big, method (*Rat) IsInt() bool
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Aug 14 18:58:28 UTC 2013 - 1.7M bytes - Viewed (0)