- UID
- 581419
- 主题
- 0
- 阅读权限
- 20
- 帖子
- 31
- 精华
- 0
- 积分
- 16
- 金钱
- 208
- 荣誉
- 0
- 人气
- 0
- 在线时间
- 52 小时
- 评议
- 0
- 帖子
- 31
- 精华
- 0
- 积分
- 16
- 金钱
- 208
- 荣誉
- 0
- 人气
- 0
- 评议
- 0
|
-----Original Message-----
From: Terje Mathisen
Sent: 22 August 2005 07:49
Subject: Re: FW: Origin of fast approximated inverse square root
ryszard wrote:
> Hey Terje,
>
> This question has come up again since id released the source to Quake
> 3 Arena.
> > Are you the guy who wrote that fast implementation of inverse square root?
> If so, do you have a history of where it came from and how you came up
> with it? A whole bunch of hackers and geeks would love to know and
> since John says it wasn't him or likely Michael, was it you?
Hello Ryszard, and hello again John, it's been a few years since we last met. :-(
Thanks for giving me as a possible author, when I first saw the subject I did
indeed think it was some of my code that had been used. :-)
I wrote a very fast (pipelineable) & accurate invsqrt() 5+ years ago, to help
a Swede with a computational fluid chemistry problem.
His simulation runs used to take about a week on either Alpha or x86 systems,
with my modifications they ran in half the time, while delivering the exact
same final printed results (8-10 significant digits).
The code shown below is not the same as what I wrote, I would guess it mostly
stays within a fraction of a percent? The swede needed at least 48 sigificant
bits in his results, so I employed a much more straightforward table lookup
plus NR-iteration. Since water molecules contain three atoms it was quite
straightforward to calculate three such invsqrt() values in parallel, this was
enough to avoid almost all bubbles in the fp pipelines.
I do think I recognize the style of the Q3A code however, it looks a lot like
something you'll find in the old HAKMEM documents from MIT. :-)
Regards,
Terje |
|