Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for mulByLog10Log2 (0.15 sec)

  1. src/strconv/ftoaryu_test.go

    		}
    	}
    }
    
    func TestMulByLog10Log2(t *testing.T) {
    	for x := -500; x <= +500; x++ {
    		iMath := MulByLog10Log2(x)
    		fMath := int(math.Floor(float64(x) * math.Ln10 / math.Ln2))
    		if iMath != fMath {
    			t.Errorf("mulByLog10Log2(%d) failed: %d vs %d\n", x, iMath, fMath)
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 15 08:44:21 UTC 2021
    - 759 bytes
    - Viewed (0)
  2. src/strconv/internal_test.go

    }
    
    func ParseFloatPrefix(s string, bitSize int) (float64, int, error) {
    	return parseFloatPrefix(s, bitSize)
    }
    
    func MulByLog2Log10(x int) int {
    	return mulByLog2Log10(x)
    }
    
    func MulByLog10Log2(x int) int {
    	return mulByLog10Log2(x)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 15 08:44:21 UTC 2021
    - 618 bytes
    - Viewed (0)
  3. 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