Need help to translate C code to Flowcode

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times

Need help to translate C code to Flowcode

Post by Mathy »

Hello,

Im trying to translate C code ( or C++? ) to Flowcode but I don't understand one part :

Code: Select all

float invSqrt(float number) {
  volatile long i;
  volatile float x, y;
  volatile const float f = 1.5F;

  x = number * 0.5F;
  y = number;
  i = * ( long * ) &y;
  i = 0x5f375a86 - ( i >> 1 );
  y = * ( float * ) &i;
  y = y * ( f - ( x * y * y ) );
  return y;
}
What do this line mean :

Code: Select all

i = * ( long * ) &y;
??
How to translate this into flowcode ?

Thank you for your help :)

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: Need help to translate C code to Flowcode

Post by dazz »

Hi Mathy
not too good with c still learning but i will try to help, but i did find this have a read im sure it will help http://blog.quenta.org/2012/09/0x5f3759df.html

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times

Re: Need help to translate C code to Flowcode

Post by Mantas »

Hi Mathy,

I have already done this last year. Have a look at this post: http://www.matrixmultimedia.com/mmforum ... 48&t=11633

BR,
Mantas
Science is my true religion.

Post Reply