- Sort Score
- Result 10 results
- Languages All
Results 1 - 6 of 6 for SetPrec (0.11 sec)
-
src/math/big/floatexample_test.go
// Operate on numbers of different precision. var x, y, z big.Float x.SetInt64(1000) // x is automatically set to 64bit precision y.SetFloat64(2.718281828) // y is automatically set to 53bit precision z.SetPrec(32) z.Add(&x, &y) fmt.Printf("x = %.10g (%s, prec = %d, acc = %s)\n", &x, x.Text('p', 0), x.Prec(), x.Acc()) fmt.Printf("y = %.10g (%s, prec = %d, acc = %s)\n", &y, y.Text('p', 0), y.Prec(), y.Acc())
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jun 06 15:46:54 UTC 2024 - 4.1K bytes - Viewed (0) -
src/math/big/floatmarsh_test.go
x := sign + test var tx Float _, _, err := tx.SetPrec(prec).SetMode(mode).Parse(x, 0) if err != nil { t.Errorf("parsing of %s (%dbits, %v) failed (invalid test case): %v", x, prec, mode, err) continue } // If tx was set to prec == 0, tx.Parse(x, 0) assumes precision 64. Correct it. if prec == 0 { tx.SetPrec(0) } if err := enc.Encode(&tx); err != nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Jan 23 18:18:05 UTC 2023 - 4.5K bytes - Viewed (0) -
src/math/big/floatconv.go
err = fmt.Errorf("exponent overflow") return } if exp5 == 0 { // no decimal exponent contribution z.round(0) return } // exp5 != 0 // apply 5**exp5 p := new(Float).SetPrec(z.Prec() + 64) // use more bits for p -- TODO(gri) what is the right number? if exp5 < 0 { z.Quo(z, p.pow5(uint64(-exp5))) } else { z.Mul(z, p.pow5(uint64(exp5))) } return }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 11:59:09 UTC 2023 - 8.3K bytes - Viewed (0) -
src/math/big/floatmarsh.go
return errors.New("Float.GobDecode: buffer too small for finite form float") } z.exp = int32(byteorder.BeUint32(buf[6:])) z.mant = z.mant.setBytes(buf[10:]) } if oldPrec != 0 { z.mode = oldMode z.SetPrec(uint(oldPrec)) } if msg := z.validate0(); msg != "" { return errors.New("Float.GobDecode: " + msg) } return nil } // MarshalText implements the [encoding.TextMarshaler] interface.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 13 21:31:58 UTC 2024 - 3.6K bytes - Viewed (0) -
src/cmd/compile/internal/ir/const.go
const ( // Maximum size in bits for big.Ints before signaling // overflow and also mantissa precision for big.Floats. ConstPrec = 512 ) func BigFloat(v constant.Value) *big.Float { f := new(big.Float) f.SetPrec(ConstPrec) switch u := constant.Val(v).(type) { case int64: f.SetInt64(u) case *big.Int: f.SetInt(u) case *big.Float: f.Set(u) case *big.Rat: f.SetRat(u) default:
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 12 18:53:26 UTC 2023 - 4K bytes - Viewed (0) -
src/math/big/bits_test.go
if mode == ToNearestAway { panic("not yet implemented") } if mode == ToNearestEven && rbit == 1 && (sbit == 1 || sbit == 0 && bit0 != 0) || mode == AwayFromZero { // round away from zero f.SetMode(ToZero).SetPrec(prec) f.Add(f, Bits{int(r) + 1}.Float()) } return f } // Float returns the *Float z of the smallest possible precision such that // z = sum(2**bits[i]), with i = range bits. If multiple bits[i] are equal,
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 5.1K bytes - Viewed (0)