Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for mulByLog10Log2 (0.12 sec)

  1. src/strconv/ftoaryu.go

    	return (x * 78913) >> 18
    }
    
    // mulByLog10Log2 returns math.Floor(x * log(10)/log(2)) for an integer x in
    // the range -500 <= x && x <= +500.
    //
    // The range restriction lets us work in faster integer arithmetic instead of
    // slower floating point arithmetic. Correctness is verified by unit tests.
    func mulByLog10Log2(x int) int {
    	// log(10)/log(2) ≈ 3.32192809489 ≈ 108853 / 2^15
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 09 00:28:56 UTC 2022
    - 15.7K bytes
    - Viewed (0)
Back to top