Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 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/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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. src/math/big/rat.go

    				// Complete rollover 11...1 => 100...0, so shift is safe
    				mantissa >>= 1
    				exp++
    			}
    		}
    	}
    	mantissa >>= 1 // discard rounding bit.  Mantissa now scaled by 1<<Msize1.
    
    	f = float32(math.Ldexp(float64(mantissa), exp-Msize1))
    	if math.IsInf(float64(f), 0) {
    		exact = false
    	}
    	return
    }
    
    // quotToFloat64 returns the non-negative float64 value
    // nearest to the quotient a/b, using round-to-even in
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 13.5K bytes
    - Viewed (0)
  10. src/fmt/scan.go

    		}
    		m, err := strconv.Atoi(str[p+1:])
    		if err != nil {
    			// Put full string into error.
    			if e, ok := err.(*strconv.NumError); ok {
    				e.Num = str
    			}
    			s.error(err)
    		}
    		return math.Ldexp(f, m)
    	}
    	f, err := strconv.ParseFloat(str, n)
    	if err != nil {
    		s.error(err)
    	}
    	return f
    }
    
    // scanComplex converts the next token to a complex128 value.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:56:20 UTC 2024
    - 31.9K bytes
    - Viewed (0)
Back to top