Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 68 for IsInf (0.09 sec)

  1. src/fmt/scan_test.go

    	}
    	if n != 3 {
    		t.Errorf("count error scanning %q: got %d", text, n)
    	}
    	sign := 1
    	if str[0] == '-' {
    		sign = -1
    	}
    	if !math.IsInf(float64(f), sign) || !math.IsInf(float64(f32), sign) || !math.IsInf(f64, sign) {
    		t.Errorf("didn't get right Infs scanning %q: got %g %g %g", text, f, f32, f64)
    	}
    }
    
    func TestInf(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 23 20:25:13 UTC 2023
    - 39.3K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/typecheck/const.go

    		if x, ok := constant.Uint64Val(v); ok && x <= unicode.MaxRune {
    			r = rune(x)
    		}
    		v = constant.MakeString(string(r))
    	}
    	return v
    }
    
    func makeFloat64(f float64) constant.Value {
    	if math.IsInf(f, 0) {
    		base.Fatalf("infinity is not a valid constant")
    	}
    	return constant.MakeFloat64(f)
    }
    
    func makeComplex(real, imag constant.Value) constant.Value {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 05 15:20:28 UTC 2023
    - 10.5K bytes
    - Viewed (0)
  3. src/math/big/ftoa.go

    		sign = " "
    	}
    
    	var padding int
    	if width, hasWidth := s.Width(); hasWidth && width > len(sign)+len(buf) {
    		padding = width - len(sign) - len(buf)
    	}
    
    	switch {
    	case s.Flag('0') && !x.IsInf():
    		// 0-padding on left
    		writeMultiple(s, sign, 1)
    		writeMultiple(s, "0", padding)
    		s.Write(buf)
    	case s.Flag('-'):
    		// padding on right
    		writeMultiple(s, sign, 1)
    		s.Write(buf)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 13.5K bytes
    - Viewed (0)
  4. src/math/big/float_test.go

    		}
    		if got := x.Sign(); got != test.sign {
    			t.Errorf("(%s).Sign() = %d; want %d", test.x, got, test.sign)
    		}
    		if got := x.IsInf(); got != test.inf {
    			t.Errorf("(%s).IsInf() = %v; want %v", test.x, got, test.inf)
    		}
    	}
    }
    
    func TestFloatIsInt(t *testing.T) {
    	for _, test := range []string{
    		"0 int",
    		"-0 int",
    		"1 int",
    		"-1 int",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 20:22:45 UTC 2024
    - 51.9K bytes
    - Viewed (0)
  5. src/math/big/float.go

    	}
    	return z
    }
    
    // Signbit reports whether x is negative or negative zero.
    func (x *Float) Signbit() bool {
    	return x.neg
    }
    
    // IsInf reports whether x is +Inf or -Inf.
    func (x *Float) IsInf() bool {
    	return x.form == inf
    }
    
    // IsInt reports whether x is an integer.
    // ±Inf values are not integers.
    func (x *Float) IsInt() bool {
    	if debugFloat {
    		x.validate()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 15:46:54 UTC 2024
    - 44.5K bytes
    - Viewed (0)
  6. src/math/big/ratconv_test.go

    	"1152921504606846977",  //   1<<60 + 1
    	"-1152921504606846977", // -(1<<60 + 1)
    
    	"1/3",
    }
    
    // isFinite reports whether f represents a finite rational value.
    // It is equivalent to !math.IsNan(f) && !math.IsInf(f, 0).
    func isFinite(f float64) bool {
    	return math.Abs(f) <= math.MaxFloat64
    }
    
    func TestFloat32SpecialCases(t *testing.T) {
    	for _, input := range float64inputs {
    		if strings.HasPrefix(input, "long:") {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 15 22:16:34 UTC 2023
    - 19.3K bytes
    - Viewed (0)
  7. tensorflow/cc/framework/cc_op_gen_util.cc

        case AttrValue::kS:
          return PrintString(attr_value.s());
        case AttrValue::kI:
          return strings::StrCat(attr_value.i());
        case AttrValue::kF: {
          const float f = attr_value.f();
          if (std::isinf(f)) {
            return strings::StrCat(f < 0.0f ? "-" : "+",
                                   "std::numeric_limits<float>::infinity()");
          } else {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Mon Feb 26 00:57:05 UTC 2024
    - 25K bytes
    - Viewed (0)
  8. src/runtime/mgcscavenge_test.go

    	if !CheckPackScavChunkData(^uint32(0), 12, 0, 0b00) {
    		t.Error("failed pack/unpack check for scavChunkData 2")
    	}
    }
    
    func FuzzPIController(f *testing.F) {
    	isNormal := func(x float64) bool {
    		return !math.IsInf(x, 0) && !math.IsNaN(x)
    	}
    	isPositive := func(x float64) bool {
    		return isNormal(x) && x > 0
    	}
    	// Seed with constants from controllers in the runtime.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 25.2K bytes
    - Viewed (0)
  9. src/runtime/mgcscavenge.go

    	// Compute the raw output value.
    	prop := c.kp * (setpoint - input)
    	rawOutput := prop + c.errIntegral
    
    	// Clamp rawOutput into output.
    	output := rawOutput
    	if isInf(output) || isNaN(output) {
    		// The input had a large enough magnitude that either it was already
    		// overflowed, or some operation with it overflowed.
    		// Set a flag and reset. That's the safest thing to do.
    		c.reset()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 17:48:45 UTC 2024
    - 52.3K bytes
    - Viewed (0)
  10. src/encoding/json/encode.go

    	b = mayAppendQuote(b, opts.quoted)
    	e.Write(b)
    }
    
    type floatEncoder int // number of bits
    
    func (bits floatEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
    	f := v.Float()
    	if math.IsInf(f, 0) || math.IsNaN(f) {
    		e.error(&UnsupportedValueError{v, strconv.FormatFloat(f, 'g', -1, int(bits))})
    	}
    
    	// Convert as if by ES6 number to string conversion.
    	// This matches most other JSON generators.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 36.2K bytes
    - Viewed (0)
Back to top