Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for ToNearestEven (0.26 sec)

  1. src/math/big/floatexample_test.go

    func ExampleRoundingMode() {
    	operands := []float64{2.6, 2.5, 2.1, -2.1, -2.5, -2.6}
    
    	fmt.Print("   x")
    	for mode := big.ToNearestEven; mode <= big.ToPositiveInf; mode++ {
    		fmt.Printf("  %s", mode)
    	}
    	fmt.Println()
    
    	for _, f64 := range operands {
    		fmt.Printf("%4g", f64)
    		for mode := big.ToNearestEven; mode <= big.ToPositiveInf; mode++ {
    			// sample operands above require 2 bits to represent mantissa
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 15:46:54 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  2. src/math/big/float_test.go

    		{4, ToNearestEven, '*', "1", "0x.8p2147483647", "0x.8p+2147483647", Exact},
    		{4, ToNearestEven, '*', "2", "0x.8p2147483647", "+Inf", Above},  // exponent overflow in *
    		{4, ToNearestEven, '*', "-2", "0x.8p2147483647", "-Inf", Below}, // exponent overflow in *
    
    		{4, ToNearestEven, '/', "0.5", "0x.8p2147483647", "0x.8p-2147483646", Exact},
    		{4, ToNearestEven, '/', "0x.8p+0", "0x.8p2147483647", "0x.8p-2147483646", Exact},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 20:22:45 UTC 2024
    - 51.9K bytes
    - Viewed (0)
  3. src/math/big/roundingmode_string.go

    package big
    
    import "strconv"
    
    func _() {
    	// An "invalid array index" compiler error signifies that the constant values have changed.
    	// Re-run the stringer command to generate them again.
    	var x [1]struct{}
    	_ = x[ToNearestEven-0]
    	_ = x[ToNearestAway-1]
    	_ = x[ToZero-2]
    	_ = x[AwayFromZero-3]
    	_ = x[ToNegativeInf-4]
    	_ = x[ToPositiveInf-5]
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 11 20:24:07 UTC 2023
    - 819 bytes
    - Viewed (0)
  4. src/math/big/floatconv_test.go

    		{"-8191.53125", ToPositiveInf, 53, 'x', 4, "-0x1.fff8p+12"},
    
    		// issue 34343
    		{"0x.8p-2147483648", ToNearestEven, 4, 'p', -1, "0x.8p-2147483648"},
    		{"0x.8p-2147483648", ToNearestEven, 4, 'x', -1, "0x1p-2147483649"},
    	} {
    		f, _, err := ParseFloat(test.x, 0, test.prec, ToNearestEven)
    		if err != nil {
    			t.Errorf("%v: %s", test, err)
    			continue
    		}
    		if test.round != defaultRound {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 24.3K bytes
    - Viewed (0)
  5. src/math/big/floatmarsh_test.go

    	dec := gob.NewDecoder(&medium)
    	for _, test := range floatVals {
    		for _, sign := range []string{"", "+", "-"} {
    			for _, prec := range []uint{0, 1, 2, 10, 53, 64, 100, 1000} {
    				for _, mode := range []RoundingMode{ToNearestEven, ToNearestAway, ToZero, AwayFromZero, ToNegativeInf, ToPositiveInf} {
    					medium.Reset() // empty buffer for each test case (in case of failures)
    					x := sign + test
    
    					var tx Float
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 23 18:18:05 UTC 2023
    - 4.5K bytes
    - Viewed (0)
  6. src/math/big/bits_test.go

    			if b == r+1 {
    				bit0 = 1
    			}
    			z = append(z, b)
    		}
    	}
    
    	// round
    	f := z.Float() // rounded to zero
    	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
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5.1K bytes
    - Viewed (0)
  7. src/math/big/float.go

    // precision set to a reasonable value determined by the operands, and
    // their mode is the zero value for RoundingMode (ToNearestEven).
    //
    // By setting the desired precision to 24 or 53 and using matching rounding
    // mode (typically [ToNearestEven]), Float operations produce the same results
    // as the corresponding float32 or float64 IEEE 754 arithmetic for operands
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 15:46:54 UTC 2024
    - 44.5K bytes
    - Viewed (0)
  8. src/math/big/ftoa.go

    	// 3) Compute upper bound by adding 1/2 ulp.
    	var upper decimal
    	upper.init(tmp.add(mant, natOne), exp)
    
    	// The upper and lower bounds are possible outputs only if
    	// the original mantissa is even, so that ToNearestEven rounding
    	// would round to the original mantissa and not the neighbors.
    	inclusive := mant[0]&2 == 0 // test bit 1 since original mantissa was shifted by 1
    
    	// Now we can figure out the minimum number of digits required.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 13.5K bytes
    - Viewed (0)
  9. api/go1.5.txt

    pkg math/big, const MinExp = -2147483648
    pkg math/big, const MinExp ideal-int
    pkg math/big, const ToNearestAway = 1
    pkg math/big, const ToNearestAway RoundingMode
    pkg math/big, const ToNearestEven = 0
    pkg math/big, const ToNearestEven RoundingMode
    pkg math/big, const ToNegativeInf = 4
    pkg math/big, const ToNegativeInf RoundingMode
    pkg math/big, const ToPositiveInf = 5
    pkg math/big, const ToPositiveInf RoundingMode
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 30 21:14:09 UTC 2015
    - 46.6K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"NewFloat", Func, 5},
    		{"NewInt", Func, 0},
    		{"NewRat", Func, 0},
    		{"ParseFloat", Func, 5},
    		{"Rat", Type, 0},
    		{"RoundingMode", Type, 5},
    		{"ToNearestAway", Const, 5},
    		{"ToNearestEven", Const, 5},
    		{"ToNegativeInf", Const, 5},
    		{"ToPositiveInf", Const, 5},
    		{"ToZero", Const, 5},
    		{"Word", Type, 0},
    	},
    	"math/bits": {
    		{"Add", Func, 12},
    		{"Add32", Func, 12},
    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