Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for modfn (0.1 sec)

  1. src/math/modf.go

    package math
    
    // Modf returns integer and fractional floating-point numbers
    // that sum to f. Both values have the same sign as f.
    //
    // Special cases are:
    //
    //	Modf(±Inf) = ±Inf, NaN
    //	Modf(NaN) = NaN, NaN
    func Modf(f float64) (int float64, frac float64) {
    	if haveArchModf {
    		return archModf(f)
    	}
    	return modf(f)
    }
    
    func modf(f float64) (int float64, frac float64) {
    	if f < 1 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 913 bytes
    - Viewed (0)
  2. src/math/floor.go

    		return archFloor(x)
    	}
    	return floor(x)
    }
    
    func floor(x float64) float64 {
    	if x == 0 || IsNaN(x) || IsInf(x, 0) {
    		return x
    	}
    	if x < 0 {
    		d, fract := Modf(-x)
    		if fract != 0.0 {
    			d = d + 1
    		}
    		return -d
    	}
    	d, _ := Modf(x)
    	return d
    }
    
    // Ceil returns the least integer value greater than or equal to x.
    //
    // Special cases are:
    //
    //	Ceil(±0) = ±0
    //	Ceil(±Inf) = ±Inf
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 3.3K bytes
    - Viewed (0)
  3. src/math/example_test.go

    	fmt.Printf("%.2f\n", math.Cbrt(8))
    	fmt.Printf("%.2f\n", math.Cbrt(27))
    	// Output:
    	// 2.00
    	// 3.00
    }
    
    func ExampleModf() {
    	int, frac := math.Modf(3.14)
    	fmt.Printf("%.2f, %.2f\n", int, frac)
    
    	int, frac = math.Modf(-2.71)
    	fmt.Printf("%.2f, %.2f\n", int, frac)
    	// Output:
    	// 3.00, 0.14
    	// -2.00, -0.71
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 07 18:09:53 UTC 2021
    - 3.7K bytes
    - Viewed (0)
  4. src/math/pow.go

    		// Without this check and if x overflows int64 the int64(xi) conversion below may produce incorrect results
    		// on some architectures (and does so on arm64). See issue #57465.
    		return false
    	}
    
    	xi, xf := Modf(x)
    	return xf == 0 && int64(xi)&1 == 1
    }
    
    // Special cases taken from FreeBSD's /usr/src/lib/msun/src/e_pow.c
    // updated by IEEE Std. 754-2008 "Section 9.2.1 Special values".
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 24 19:10:58 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  5. src/internal/trace/mud.go

    	}
    
    	// Update the histogram.
    	h := &d.hist
    	lbFloat, lf := math.Modf(l * mudDegree)
    	lb := int(lbFloat)
    	if lb >= mudDegree {
    		lb, lf = mudDegree-1, 1
    	}
    	if l == r {
    		h[lb] += area
    	} else {
    		rbFloat, rf := math.Modf(r * mudDegree)
    		rb := int(rbFloat)
    		if rb >= mudDegree {
    			rb, rf = mudDegree-1, 1
    		}
    		if lb == rb {
    			h[lb] += area
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  6. src/math/gamma.go

    	return z * p / q
    
    small:
    	if x == 0 {
    		return Inf(1)
    	}
    	return z / ((1 + Euler*x) * x)
    }
    
    func isNegInt(x float64) bool {
    	if x < 0 {
    		_, xf := Modf(x)
    		return xf == 0
    	}
    	return false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 5.5K bytes
    - Viewed (0)
Back to top