Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 72 for Float64frombits (0.42 sec)

  1. src/math/floor.go

    		// must be either an integer, infinity, or NaN.
    		const half = 1 << (shift - 1)
    		e -= bias
    		bits += half >> e
    		bits &^= fracMask >> e
    	}
    	return Float64frombits(bits)
    }
    
    // RoundToEven returns the nearest integer, rounding ties to even.
    //
    // Special cases are:
    //
    //	RoundToEven(±0) = ±0
    //	RoundToEven(±Inf) = ±Inf
    //	RoundToEven(NaN) = NaN
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 3.3K bytes
    - Viewed (0)
  2. src/math/abs.go

    package math
    
    // Abs returns the absolute value of x.
    //
    // Special cases are:
    //
    //	Abs(±Inf) = +Inf
    //	Abs(NaN) = NaN
    func Abs(x float64) float64 {
    	return Float64frombits(Float64bits(x) &^ (1 << 63))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 366 bytes
    - Viewed (0)
  3. src/math/copysign.go

    // license that can be found in the LICENSE file.
    
    package math
    
    // Copysign returns a value with the magnitude of f
    // and the sign of sign.
    func Copysign(f, sign float64) float64 {
    	const signBit = 1 << 63
    	return Float64frombits(Float64bits(f)&^signBit | Float64bits(sign)&signBit)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 14 17:42:53 UTC 2022
    - 396 bytes
    - Viewed (0)
  4. src/math/modf.go

    		}
    		return 0, f
    	}
    
    	x := Float64bits(f)
    	e := uint(x>>shift)&mask - bias
    
    	// Keep the top 12+e bits, the integer part; clear the rest.
    	if e < 64-12 {
    		x &^= 1<<(64-12-e) - 1
    	}
    	int = Float64frombits(x)
    	frac = f - int
    	return
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 913 bytes
    - Viewed (0)
  5. src/math/frexp.go

    	case IsInf(f, 0) || IsNaN(f):
    		return f, 0
    	}
    	f, exp = normalize(f)
    	x := Float64bits(f)
    	exp += int((x>>shift)&mask) - bias + 1
    	x &^= mask << shift
    	x |= (-1 + bias) << shift
    	frac = Float64frombits(x)
    	return
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 929 bytes
    - Viewed (0)
  6. src/internal/fuzz/encoding.go

    	case "float64-bits":
    		if kind != token.FLOAT && kind != token.INT {
    			return nil, fmt.Errorf("integer literal required for math.Float64frombits type")
    		}
    		bits, err := parseUint(val, "uint64")
    		if err != nil {
    			return nil, err
    		}
    		return math.Float64frombits(bits.(uint64)), nil
    	default:
    		return nil, fmt.Errorf("expected []byte or primitive type")
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 30 16:39:12 UTC 2022
    - 11K bytes
    - Viewed (0)
  7. src/math/ldexp.go

    		}
    		return Inf(1)
    	}
    	var m float64 = 1
    	if exp < -1022 { // denormal
    		exp += 53
    		m = 1.0 / (1 << 53) // 2**-53
    	}
    	x &^= mask << shift
    	x |= uint64(exp+bias) << shift
    	return m * Float64frombits(x)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  8. test/float_lit2.go

    }
    
    var bugged = false
    
    func bug() {
    	if !bugged {
    		bugged = true
    		fmt.Println("BUG")
    	}
    }
    
    func main() {
    	u64 := math.Float64frombits(0x7fefffffffffffff) - math.Float64frombits(0x7feffffffffffffe)
    	if ulp64 != u64 {
    		bug()
    		fmt.Printf("ulp64=%g, want %g", ulp64, u64)
    	}
    
    	u32 := math.Float32frombits(0x7f7fffff) - math.Float32frombits(0x7f7ffffe)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 14 16:39:47 UTC 2016
    - 7.9K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/test/float_test.go

    	x32 := math.Float32bits(f32)
    	y32 := math.Float32bits(g32)
    	if x32 != y32 {
    		t.Errorf("got %x, want %x (diff=%x)", x32, y32, x32^y32)
    	}
    
    	f64 := math.Float64frombits(snan64bits)
    	g64 := math.Float64frombits(snan64bitsVar)
    	x64 := math.Float64bits(f64)
    	y64 := math.Float64bits(g64)
    	if x64 != y64 {
    		t.Errorf("got %x, want %x (diff=%x)", x64, y64, x64^y64)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 17:54:15 UTC 2022
    - 12.5K bytes
    - Viewed (0)
  10. src/expvar/expvar.go

    type Float struct {
    	f atomic.Uint64
    }
    
    func (v *Float) Value() float64 {
    	return math.Float64frombits(v.f.Load())
    }
    
    func (v *Float) String() string {
    	return string(v.appendJSON(nil))
    }
    
    func (v *Float) appendJSON(b []byte) []byte {
    	return strconv.AppendFloat(b, math.Float64frombits(v.f.Load()), 'g', -1, 64)
    }
    
    // Add adds delta to v.
    func (v *Float) Add(delta float64) {
    	for {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 21:32:11 UTC 2024
    - 9.1K bytes
    - Viewed (0)
Back to top