파일:Log by aliasing to int.svg

문서 내용이 다른 언어로는 지원되지 않습니다.
위키백과, 우리 모두의 백과사전.

원본 파일(SVG 파일, 실제 크기 640 × 480 픽셀, 파일 크기: 13 KB)

파일 설명

설명
English: Aliasing a positive IEEE-754 floating point number x to an integer Ix (like in C: float x = ...; int32_t i = * (int32_t *) &x;) yields a scaled and shifted approximation of its base-2 logarithm. This is the basis of the fast inverse square root algorithm.
Français : Si un nombre positif x représenté en virgule flottante au format IEEE 754 est interprété comme un entier Ix (comme en C : float x = ...; int32_t i = * (int32_t *) &x;) cela produit, à une transformation linéaire près, une approximation de son logarithme en base 2. Cette approximation est le fondement de l'algorithme de racine carrée inverse rapide.
날짜
출처 자작
저자 Edgar Bonet
 
이 W3C-불확실 벡터 그림Gnuplot(으)로 제작되었습니다.

Gnuplot source

Warning: This source contains non-ASCII characters in label 3, in the title of the first curve and in comments.

#!/usr/bin/gnuplot

# Aliasing a float32 to an int32 yields an approximation of its base-2
# logarithm.

# Parameters for IEEE-754 single-precision floats
L = 2**23   # mantissa scaling factor
B = 127     # exponent bias

# For m ∈ [0, 1), log₂(1 + m) ≈ 1 + σ
sigma = 0.0430357

# Assume x is a positive normal float32.
# Compute I(x): the int32 aliased to x.
log_of_2 = log(2)
log2(x) = log(x) / log_of_2
round(x) = floor(x + 0.5)
e(x) = floor(log2(x))               # exponent
m(x, e_x) = x / 2**e_x - 1          # mantissa, without the leading 1
M(x, e_x) = round(m(x, e_x) * L)    # scaled and rounded mantissa
I2(x, e_x) = (e_x + B) * L + M(x, e_x)
I(x) = I2(x, e(x))

# Best fit to a logarithm
scaled_log(x) = L * log2(x) + L * (B - sigma)

# Do the plot
set terminal svg size 640, 480 enhanced
set output 'Log_by_aliasing_to_int.svg'
set xrange [0:10]
set yrange [0x3d800000:]
set format y "0x%x"
set ytics L
set key top left Left reverse invert spacing 1.4
set samples 200
set style line 1 lw 3 lc rgb "gray80"
set style line 2 lw 1 lc rgb "blue"
set style increment user
set label 1 "L = 2^{23}"    at 6, 0x3fc00000
set label 2 "B = 127"       at 6, 0x3f600000
set label 3 "σ = 0.0430357" at 6, 0x3f000000
plot scaled_log(x) title "L log_2(x) + L (B − σ)", \
     I(x) title 'I_x' lt 3

라이선스

나는 아래 작품의 저작권자로서, 이 저작물을 다음과 같은 라이선스로 배포합니다:
w:ko:크리에이티브 커먼즈
저작자표시 동일조건변경허락
이용자는 다음의 권리를 갖습니다:
  • 공유 및 이용 – 저작물의 복제, 배포, 전시, 공연 및 공중송신
  • 재창작 – 저작물의 개작, 수정, 2차적저작물 창작
다음과 같은 조건을 따라야 합니다:
  • 저작자표시 – 적절한 저작자 표시를 제공하고, 라이센스에 대한 링크를 제공하고, 변경사항이 있는지를 표시해야 합니다. 당신은 합리적인 방식으로 표시할 수 있지만, 어떤 방식으로든 사용권 허가자가 당신 또는 당신의 사용을 지지하는 방식으로 표시할 수 없습니다.
  • 동일조건변경허락 – 만약 당신이 이 저작물을 리믹스 또는 변형하거나 이 저작물을 기반으로 제작하는 경우, 당신은 당신의 기여물을 원저작물과 동일하거나 호환 가능한 라이선스에 따라 배포하여야 합니다.

설명

이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다

이 파일에 묘사된 항목

다음을 묘사함

image/svg+xml

파일 역사

날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.

날짜/시간섬네일크기사용자설명
현재2014년 7월 25일 (금) 20:202014년 7월 25일 (금) 20:20 판의 섬네일640 × 480 (13 KB)Edgar.bonetUser created page with UploadWizard

다음 문서 1개가 이 파일을 사용하고 있습니다:

이 파일을 사용하고 있는 모든 위키의 문서 목록

다음 위키에서 이 파일을 사용하고 있습니다:

메타데이터