- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 312 for newRat (0.16 sec)
-
src/math/big/rat_test.go
func TestIssue820(t *testing.T) { x := NewRat(3, 1) y := NewRat(2, 1) z := y.Quo(x, y) q := NewRat(3, 2) if z.Cmp(q) != 0 { t.Errorf("got %s want %s", z, q) } y = NewRat(3, 1) x = NewRat(2, 1) z = y.Quo(x, y) q = NewRat(2, 3) if z.Cmp(q) != 0 { t.Errorf("got %s want %s", z, q) } x = NewRat(3, 1) z = x.Quo(x, x) q = NewRat(3, 3) if z.Cmp(q) != 0 {
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/hilbert_test.go
a := newMatrix(n, n) for i := 0; i < n; i++ { for j := 0; j < n; j++ { x := NewRat(0, 1) if i == j { x.SetInt64(1) } a.set(i, j, x) } } return a } func newHilbert(n int) *matrix { a := newMatrix(n, n) for i := 0; i < n; i++ { for j := 0; j < n; j++ { a.set(i, j, NewRat(1, int64(i+j+1))) } } return a } func newInverseHilbert(n int) *matrix {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 08 04:08:51 UTC 2014 - 2.9K bytes - Viewed (0) -
src/go/constant/value.go
if !is63bit(a) || !is63bit(b) { return makeInt(newInt().Add(big.NewInt(a), big.NewInt(b))) } c = a + b case token.SUB: if !is63bit(a) || !is63bit(b) { return makeInt(newInt().Sub(big.NewInt(a), big.NewInt(b))) } c = a - b case token.MUL: if !is32bit(a) || !is32bit(b) { return makeInt(newInt().Mul(big.NewInt(a), big.NewInt(b))) } c = a * b case token.QUO:
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 12:02:03 UTC 2023 - 34K bytes - Viewed (0) -
src/math/big/decimal_test.go
d.init(natOne, shift) sink = d.String() } } } func BenchmarkFloatString(b *testing.B) { x := new(Float) for _, prec := range []uint{1e2, 1e3, 1e4, 1e5} { x.SetPrec(prec).SetRat(NewRat(1, 3)) b.Run(fmt.Sprintf("%v", prec), func(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { sink = x.String() } }) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 18 05:54:35 UTC 2016 - 3.3K bytes - Viewed (0) -
test/abi/idata.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Apr 05 20:11:08 UTC 2021 - 2.1K bytes - Viewed (0) -
src/math/big/ratmarsh_test.go
} } } func TestRatGobDecodeShortBuffer(t *testing.T) { for _, tc := range [][]byte{ []byte{0x2}, []byte{0x2, 0x0, 0x0, 0x0, 0xff}, []byte{0x2, 0xff, 0xff, 0xff, 0xff}, } { err := NewRat(1, 2).GobDecode(tc) if err == nil { t.Error("expected GobDecode to return error for malformed input") } }
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/crypto/internal/mlkem768/mlkem768_test.go
} func TestZetas(t *testing.T) { ζ := big.NewInt(17) q := big.NewInt(q) for k, zeta := range zetas { // ζ^BitRev7(k) mod q exp := new(big.Int).Exp(ζ, big.NewInt(int64(BitRev7(uint8(k)))), q) if big.NewInt(int64(zeta)).Cmp(exp) != 0 { t.Errorf("zetas[%d] = %v, expected %v", k, zeta, exp) } } } func TestGammas(t *testing.T) { ζ := big.NewInt(17) q := big.NewInt(q)
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/doc.go
y := new(Float) // y is a *Float of value 0 Alternatively, new values can be allocated and initialized with factory functions of the form: func NewT(v V) *T For instance, [NewInt](x) returns an *[Int] set to the value of the int64 argument x, [NewRat](a, b) returns a *[Rat] set to the fraction a/b where a and b are int64 values, and [NewFloat](f) returns a *[Float] initialized
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/rat.go
// is made), such uninitialized denominators are set to 1. // a.neg determines the sign of the Rat, b.neg is ignored. a, b Int } // NewRat creates a new [Rat] with numerator a and denominator b. func NewRat(a, b int64) *Rat { return new(Rat).SetFrac64(a, b) } // SetFloat64 sets z to exactly f and returns z. // If f is not finite, SetFloat returns nil.
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/math/big/float_test.go
} func BenchmarkFloatAdd(b *testing.B) { x := new(Float) y := new(Float) z := new(Float) for _, prec := range []uint{10, 1e2, 1e3, 1e4, 1e5} { x.SetPrec(prec).SetRat(NewRat(1, 3)) y.SetPrec(prec).SetRat(NewRat(1, 6)) z.SetPrec(prec) b.Run(fmt.Sprintf("%v", prec), func(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { z.Add(x, y) } }) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Apr 11 20:22:45 UTC 2024 - 51.9K bytes - Viewed (0)