Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 18 of 18 for SetPrec (0.1 sec)

  1. 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)
  2. 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)
  3. src/math/big/float.go

    //go:generate stringer -type=Accuracy
    
    // SetPrec sets z's precision to prec and returns the (possibly) rounded
    // value of z. Rounding occurs according to z's rounding mode if the mantissa
    // cannot be represented in prec bits without loss of precision.
    // SetPrec(0) maps all finite values to ±0; infinite values remain unchanged.
    // If prec > [MaxPrec], it is set to [MaxPrec].
    func (z *Float) SetPrec(prec uint) *Float {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 15:46:54 UTC 2024
    - 44.5K bytes
    - Viewed (0)
  4. src/math/big/ftoa.go

    	}
    
    	// round mantissa to n bits
    	var n uint
    	if prec < 0 {
    		n = 1 + (x.MinPrec()-1+3)/4*4 // round MinPrec up to 1 mod 4
    	} else {
    		n = 1 + 4*uint(prec)
    	}
    	// n%4 == 1
    	x = new(Float).SetPrec(n).SetMode(x.mode).Set(x)
    
    	// adjust mantissa to use exactly n bits
    	m := x.mant
    	switch w := uint(len(x.mant)) * _W; {
    	case w < n:
    		m = nat(nil).shl(m, n-w)
    	case w > n:
    		m = nat(nil).shr(m, w-n)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 13.5K bytes
    - Viewed (0)
  5. src/internal/pkgbits/decoder.go

    func (r *Decoder) bigInt() *big.Int {
    	v := new(big.Int).SetBytes([]byte(r.String()))
    	if r.Bool() {
    		v.Neg(v)
    	}
    	return v
    }
    
    func (r *Decoder) bigFloat() *big.Float {
    	v := new(big.Float).SetPrec(512)
    	assert(v.UnmarshalText([]byte(r.String())) == nil)
    	return v
    }
    
    // @@@ Helpers
    
    // TODO(mdempsky): These should probably be removed. I think they're a
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 27 20:58:46 UTC 2022
    - 13.2K bytes
    - Viewed (0)
  6. src/go/constant/value.go

    func (complexVal) implementsValue() {}
    
    func newInt() *big.Int     { return new(big.Int) }
    func newRat() *big.Rat     { return new(big.Rat) }
    func newFloat() *big.Float { return new(big.Float).SetPrec(prec) }
    
    func i64toi(x int64Val) intVal   { return intVal{newInt().SetInt64(int64(x))} }
    func i64tor(x int64Val) ratVal   { return ratVal{newRat().SetInt64(int64(x))} }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 34K bytes
    - Viewed (0)
  7. api/go1.5.txt

    pkg math/big, method (*Float) SetInt64(int64) *Float
    pkg math/big, method (*Float) SetMantExp(*Float, int) *Float
    pkg math/big, method (*Float) SetMode(RoundingMode) *Float
    pkg math/big, method (*Float) SetPrec(uint) *Float
    pkg math/big, method (*Float) SetRat(*Rat) *Float
    pkg math/big, method (*Float) SetString(string) (*Float, bool)
    pkg math/big, method (*Float) SetUint64(uint64) *Float
    pkg math/big, method (*Float) Sign() int
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 30 21:14:09 UTC 2015
    - 46.6K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"(*Float).SetInf", Method, 5},
    		{"(*Float).SetInt", Method, 5},
    		{"(*Float).SetInt64", Method, 5},
    		{"(*Float).SetMantExp", Method, 5},
    		{"(*Float).SetMode", Method, 5},
    		{"(*Float).SetPrec", Method, 5},
    		{"(*Float).SetRat", Method, 5},
    		{"(*Float).SetString", Method, 5},
    		{"(*Float).SetUint64", Method, 5},
    		{"(*Float).Sign", Method, 5},
    		{"(*Float).Signbit", Method, 5},
    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