Jay Tee <jtrelfa@gmail.comwrites:
Quote:
I'm trying to decipher this C code and translate it into PHP (long
story). Can anyone help?
>
(xx is a float being passed into the function)
--snip--
>
temp = (x = xx - 1.0) + 5.5;
temp = (x + 0.5) * log(temp) - temp;
>
--snip--
>
My assumption was this:
x = xx - 1.0
temp = x + 5.5
then later, temp = (x + 0.5) * log(temp) - temp
Looks the same to me (except for the syntax errors from the missing
;s).
Quote:
For some reason, I don't think my assumption is correct as the wrong
values are coming out of the function. The weird use of parentheses/
assignment operators is throwing me off.
You can write exactly the same in PHP as the original. No need to
spit it up. The fact that it comes out differently suggests that
there is some issue about the *types* of the these variables, rather
than the statements that you've show here. C types behave very
differently to PHP types but you don't tell us what types x, xx and
temp are, or how you know it "comes out" differently.
--
Ben.