Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for ldexp (0.04 sec)

  1. src/math/ldexp.go

    package math
    
    // Ldexp is the inverse of [Frexp].
    // It returns frac × 2**exp.
    //
    // Special cases are:
    //
    //	Ldexp(±0, exp) = ±0
    //	Ldexp(±Inf, exp) = ±Inf
    //	Ldexp(NaN, exp) = NaN
    func Ldexp(frac float64, exp int) float64 {
    	if haveArchLdexp {
    		return archLdexp(frac, exp)
    	}
    	return ldexp(frac, exp)
    }
    
    func ldexp(frac float64, exp int) float64 {
    	// special cases
    	switch {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  2. src/strconv/ftoa_test.go

    	{"64Fixed16", 1.23456e-78, 'e', 16, 64},
    	// From testdata/testfp.txt
    	{"64Fixed12Hard", math.Ldexp(6965949469487146, -249), 'e', 12, 64},
    	{"64Fixed17Hard", math.Ldexp(8887055249355788, 665), 'e', 17, 64},
    	{"64Fixed18Hard", math.Ldexp(6994187472632449, 690), 'e', 18, 64},
    
    	// Trigger slow path (see issue #15672).
    	// The shortest is: 8.034137530808823e+43
    	{"Slowpath64", 8.03413753080882349e+43, 'e', -1, 64},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 24 23:50:20 UTC 2022
    - 9.3K bytes
    - Viewed (0)
  3. src/math/mod.go

    		return NaN()
    	}
    	y = Abs(y)
    
    	yfr, yexp := Frexp(y)
    	r := x
    	if x < 0 {
    		r = -x
    	}
    
    	for r >= y {
    		rfr, rexp := Frexp(r)
    		if rfr < yfr {
    			rexp = rexp - 1
    		}
    		r = r - Ldexp(y, rexp-yexp)
    	}
    	if x < 0 {
    		r = -r
    	}
    	return r
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 903 bytes
    - Viewed (0)
  4. src/math/exp.go

    	)
    
    	r := hi - lo
    	t := r * r
    	c := r - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))))
    	y := 1 - ((lo - (r*c)/(2-c)) - hi)
    	// TODO(rsc): make sure Ldexp can handle boundary k
    	return Ldexp(y, k)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 5.4K bytes
    - Viewed (0)
  5. src/math/exp_amd64.s

    	MULSD   X1, X0
    	MOVSD   exprodata<>+16(SB), X1
    	ADDSD   X0, X1
    	MULSD   X1, X0
    	MOVSD   exprodata<>+16(SB), X1
    	ADDSD   X0, X1
    	MULSD   X1, X0
    	ADDSD exprodata<>+8(SB), X0
    	// return fr * 2**exponent
    ldexp:
    	ADDL    $0x3FF, BX // add bias
    	JLE     denormal
    	CMPL    BX, $0x7FF
    	JGE     overflow
    lastStep:
    	SHLQ    $52, BX
    	MOVQ    BX, X1
    	MULSD   X1, X0
    	MOVSD   X0, ret+8(FP)
    	RET
    notFinite:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 15 15:48:19 UTC 2021
    - 4.2K bytes
    - Viewed (0)
  6. src/math/pow.go

    			// on at least one more iteration, ae += xe is a lower bound on ae
    			// the lower bound on ae exceeds the size of a float64 exp
    			// so the final call to Ldexp will produce under/overflow (0/Inf)
    			ae += xe
    			break
    		}
    		if i&1 == 1 {
    			a1 *= x1
    			ae += xe
    		}
    		x1 *= x1
    		xe <<= 1
    		if x1 < .5 {
    			x1 += x1
    			xe--
    		}
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 24 19:10:58 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  7. src/math/exp_arm64.s

    	FSUBD	F13, F14
    	FMULD	F6, F13, F15
    	FDIVD	F14, F15	// F15 = (r*c)/(2-c)
    	FSUBD	F15, F5, F15	// lo-(r*c)/(2-c)
    	FSUBD	F4, F15, F15	// (lo-(r*c)/(2-c))-hi
    	FSUBD	F15, F1, F16	// F16 = y = 1-((lo-(r*c)/(2-c))-hi)
    	// inline Ldexp(y, k), benefit:
    	// 1, no parameter pass overhead.
    	// 2, skip unnecessary checks for Inf/NaN/Zero
    	FMOVD	F16, R0
    	AND	$FracMask, R0, R2	// fraction
    	LSR	$52, R0, R5	// exponent
    	ADD	R1, R5		// R1 = int(k)
    	CMP	$1, R5
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 15 15:48:19 UTC 2021
    - 5.4K bytes
    - Viewed (0)
  8. test/codegen/condmove.go

    	// arm64:"CSEL\tNE"
    	// ppc64x:"ISEL\t[$]2"
    	// wasm:"Select"
    	return a
    }
    
    //go:noinline
    func frexp(f float64) (frac float64, exp int) {
    	return 1.0, 4
    }
    
    //go:noinline
    func ldexp(frac float64, exp int) float64 {
    	return 1.0
    }
    
    // Generate a CMOV with a floating comparison and integer move.
    func cmovfloatint2(x, y float64) float64 {
    	yfr, yexp := 4.0, 5
    
    	r := x
    	for r >= y {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 06 20:57:33 UTC 2023
    - 6.2K bytes
    - Viewed (0)
  9. src/math/all_test.go

    }
    
    func TestLdexp(t *testing.T) {
    	for i := 0; i < len(vf); i++ {
    		if f := Ldexp(frexp[i].f, frexp[i].i); !veryclose(vf[i], f) {
    			t.Errorf("Ldexp(%g, %d) = %g, want %g", frexp[i].f, frexp[i].i, f, vf[i])
    		}
    	}
    	for i := 0; i < len(vffrexpSC); i++ {
    		if f := Ldexp(frexpSC[i].f, frexpSC[i].i); !alike(vffrexpSC[i], f) {
    			t.Errorf("Ldexp(%g, %d) = %g, want %g", frexpSC[i].f, frexpSC[i].i, f, vffrexpSC[i])
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jul 07 17:39:26 UTC 2023
    - 86.8K bytes
    - Viewed (0)
  10. src/math/big/rat_test.go

    					f, _ := r.Float32()
    
    					if !checkIsBestApprox32(t, f, r) {
    						// Append context information.
    						t.Errorf("(input was mantissa %#x, exp %d; f = %g (%b); f ~ %g; r = %v)",
    							b, exp, f, f, math.Ldexp(float64(b), exp), r)
    					}
    
    					checkNonLossyRoundtrip32(t, f)
    				}
    			}
    		}
    	}
    }
    
    func TestFloat64Distribution(t *testing.T) {
    	// Generate a distribution of (sign, mantissa, exp) values
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 07 00:15:59 UTC 2022
    - 18.9K bytes
    - Viewed (0)
Back to top