- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 46 for rat (0.02 sec)
-
src/math/big/rat.go
import ( "fmt" "math" ) // A Rat represents a quotient a/b of arbitrary precision. // The zero value for a Rat represents the value 0. // // Operations always take pointer arguments (*Rat) rather // than Rat values, and each unique Rat value requires // its own unique *Rat pointer. To "copy" a Rat value, // an existing (or newly allocated) Rat must be set to // a new value using the [Rat.Set] method; shallow copies
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 11:59:09 UTC 2023 - 13.5K bytes - Viewed (0) -
test/chan/powser2.go
func i2tor(u, v int64) *rat { g := gcd(u, v) r := new(rat) if v > 0 { r.num = u / g r.den = v / g } else { r.num = -u / g r.den = -v / g } return r } func itor(u int64) *rat { return i2tor(u, 1) } var zero *rat var one *rat // End mark and end test var finis *rat func end(u *rat) int64 { if u.den == 0 { return 1
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Mar 25 22:22:20 UTC 2020 - 13.3K bytes - Viewed (0) -
src/math/big/rat_test.go
// when simply accessing the Rat value. func TestIssue34919(t *testing.T) { for _, acc := range []struct { name string f func(*Rat) }{ {"Float32", func(x *Rat) { x.Float32() }}, {"Float64", func(x *Rat) { x.Float64() }}, {"Inv", func(x *Rat) { new(Rat).Inv(x) }}, {"Sign", func(x *Rat) { x.Sign() }}, {"IsInt", func(x *Rat) { x.IsInt() }}, {"Num", func(x *Rat) { x.Num() }},
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Jan 07 00:15:59 UTC 2022 - 18.9K bytes - Viewed (0) -
src/math/big/doc.go
The following numeric types are supported: Int signed integers Rat rational numbers Float floating-point numbers The zero value for an [Int], [Rat], or [Float] correspond to 0. Thus, new values can be declared in the usual ways and denote 0 without further initialization: var x Int // &x is an *Int of value 0 var r = &Rat{} // r is a *Rat of value 0 y := new(Float) // y is a *Float of value 0
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 11:59:09 UTC 2023 - 3.8K bytes - Viewed (0) -
src/math/big/hilbert_test.go
func newInverseHilbert(n int) *matrix { a := newMatrix(n, n) for i := 0; i < n; i++ { for j := 0; j < n; j++ { x1 := new(Rat).SetInt64(int64(i + j + 1)) x2 := new(Rat).SetInt(new(Int).Binomial(int64(n+i), int64(n-j-1))) x3 := new(Rat).SetInt(new(Int).Binomial(int64(n+j), int64(n-i-1))) x4 := new(Rat).SetInt(new(Int).Binomial(int64(i+j), int64(i))) x1.Mul(x1, x2) x1.Mul(x1, x3) x1.Mul(x1, x4) x1.Mul(x1, x4)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 08 04:08:51 UTC 2014 - 2.9K bytes - Viewed (0) -
test/chan/powser1.go
func i2tor(u, v int64) rat { g := gcd(u, v) var r rat if v > 0 { r.num = u / g r.den = v / g } else { r.num = -u / g r.den = -v / g } return r } func itor(u int64) rat { return i2tor(u, 1) } var zero rat var one rat // End mark and end test var finis rat func end(u rat) int64 { if u.den == 0 { return 1 }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Mar 25 22:22:20 UTC 2020 - 12.7K bytes - Viewed (0) -
src/math/big/ratmarsh.go
} // GobDecode implements the [encoding/gob.GobDecoder] interface. func (z *Rat) GobDecode(buf []byte) error { if len(buf) == 0 { // Other side sent a nil or default value. *z = Rat{} return nil } if len(buf) < 5 { return errors.New("Rat.GobDecode: buffer too small") } b := buf[0] if b>>1 != ratGobVersion { return fmt.Errorf("Rat.GobDecode: encoding version %d not supported", b>>1) } const j = 1 + 4
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 13 21:31:58 UTC 2024 - 2.2K bytes - Viewed (0) -
src/math/big/ratmarsh_test.go
for _, test := range encodingTests { medium.Reset() // empty buffer for each test case (in case of failures) var tx Rat tx.SetString(test + ".14159265") if err := enc.Encode(&tx); err != nil { t.Errorf("encoding of %s failed: %s", &tx, err) continue } var rx Rat if err := dec.Decode(&rx); err != nil { t.Errorf("decoding of %s failed: %s", &tx, err) continue } if rx.Cmp(&tx) != 0 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 11 20:20:16 UTC 2022 - 3.3K bytes - Viewed (0) -
src/math/big/example_rat_test.go
// (n-1)/3 * 2 if n mod 3 == 1 func recur(n, lim int64) *big.Rat { term := new(big.Rat) if n%3 != 1 { term.SetInt64(1) } else { term.SetInt64((n - 1) / 3 * 2) } if n > lim { return term } // Directly initialize frac as the fractional // inverse of the result of recur. frac := new(big.Rat).Inv(recur(n+1, lim)) return term.Add(term, frac) }
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/ratconv_test.go
} } } } func TestRatSetStringZero(t *testing.T) { got, _ := new(Rat).SetString("0") want := new(Rat).SetInt64(0) if !reflect.DeepEqual(got, want) { t.Errorf("got %#+v, want %#+v", got, want) } } func TestRatScan(t *testing.T) { var buf bytes.Buffer for i, test := range setStringTests { x := new(Rat) buf.Reset() buf.WriteString(test.in) _, err := fmt.Fscanf(&buf, "%v", x)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Nov 15 22:16:34 UTC 2023 - 19.3K bytes - Viewed (0)