Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1024278 // unprecise_invSqrt - the infamous inverse square root approximation

JavaX fragment (include)

static float unprecise_invSqrt(float x) {
  float xhalf = 0.5f * x;
  int i = Float.floatToIntBits(x);
  i = 0x5f3759df - (i >> 1);
  x = Float.intBitsToFloat(i);
  x *= (1.5f - xhalf * x * x);
  ret x;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
1380 stefan From https://stackoverflow.com/questions/11513344/how-to-implement-the-fast-inverse-square-root-in-java 2019-07-29 11:31:54

add comment

Snippet ID: #1024278
Snippet name: unprecise_invSqrt - the infamous inverse square root approximation
Eternal ID of this version: #1024278/1
Text MD5: 9f21f44439309378799c64c01a193cbb
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-29 11:31:37
Source code size: 211 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 287 / 324
Referenced in: [show references]