Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Sep 19th, 2018 78 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3.  
  4. double fisr(double number);
  5.  
  6. int main(void) {
  7.     double a = 2;
  8.     //scanf("%lf", &a);
  9.     printf("%lfn", fisr(a));
  10.    
  11.     system("pause");
  12.     return 0;
  13. }
  14.  
  15. double fisr(double number) {
  16.     long i;
  17.     float x2, y;
  18.     const float threehalfs = 1.5F;
  19.  
  20.     x2 = number * 0.5F;
  21.     y  = number;
  22.     i  = * ( long * ) &y;                       // evil floating point bit level hacking
  23.     i  = 0x5f3759df - ( i >> 1 );               // what the fuck?
  24.     y  = * ( float * ) &i;
  25.     y  = y * ( threehalfs + ( x2 * y * y ) );   // 1st iteration
  26. //  y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed
  27.  
  28.     return y;
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top