473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Using math functions in PHP 4.3.5

I have upgraded PHP on our server (a RedHat 7.2 box) to version 4.3.5.
However,
now code I wrote in PHP before fails to work correctly. I have some
code that invokes the math function atan2 in connection with
converting rectangular to polar coordinates in a Web page. This used
to work in PHP 4.x (earlier version) but failed with 4.3.4 and now
with 4.3.5. I haven't found anything in the README files about this
-- any thoughts on how to make atan2 work?
Jul 17 '05 #1
3 2893
On 8 Apr 2004 17:22:48 -0700, bs********@ucok.edu (Bill Stockwell) wrote:
I have upgraded PHP on our server (a RedHat 7.2 box) to version 4.3.5.
However,
now code I wrote in PHP before fails to work correctly. I have some
code that invokes the math function atan2 in connection with
converting rectangular to polar coordinates in a Web page. This used
to work in PHP 4.x (earlier version) but failed with 4.3.4 and now
with 4.3.5. I haven't found anything in the README files about this
-- any thoughts on how to make atan2 work?


Failed in what way?

atan2 works fine for me on PHP 4.3.5, and I've not specified anything special
with regards to maths modules.

Configure Command
'./configure' '--prefix=/usr' '--with-apxs2=/usr/apache2/bin/apxs'
'--with-config-file-path=/etc/apache2' '--enable-trans-sid' '--with-gd'
'--with-mysql=/usr/mysql' '--with-zlib-dir=/usr' '--with-jpeg'
'--with-jpeg-dir=/usr'

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #2
Andy Hassall <an**@andyh.co.uk> wrote in message news:<71********************************@4ax.com>. ..
On 8 Apr 2004 17:22:48 -0700, bs********@ucok.edu (Bill Stockwell) wrote:
I have upgraded PHP on our server (a RedHat 7.2 box) to version 4.3.5.
However,
now code I wrote in PHP before fails to work correctly. I have some
code that invokes the math function atan2 in connection with
converting rectangular to polar coordinates in a Web page. This used
to work in PHP 4.x (earlier version) but failed with 4.3.4 and now
with 4.3.5. I haven't found anything in the README files about this
-- any thoughts on how to make atan2 work?


Failed in what way?

atan2 works fine for me on PHP 4.3.5, and I've not specified anything special
with regards to maths modules.

Configure Command
'./configure' '--prefix=/usr' '--with-apxs2=/usr/apache2/bin/apxs'
'--with-config-file-path=/etc/apache2' '--enable-trans-sid' '--with-gd'
'--with-mysql=/usr/mysql' '--with-zlib-dir=/usr' '--with-jpeg'
'--with-jpeg-dir=/usr'

It fails in that no matter what (x,y) point I give it, I get 0 back
for the angle. This did NOT happen with PHP 4.0.6 -- it worked just
fine then.
Jul 17 '05 #3
On 9 Apr 2004 06:57:15 -0700, bs********@ucok.edu (Bill Stockwell) wrote:
Andy Hassall <an**@andyh.co.uk> wrote in message news:<71********************************@4ax.com>. ..
On 8 Apr 2004 17:22:48 -0700, bs********@ucok.edu (Bill Stockwell) wrote:
>I have upgraded PHP on our server (a RedHat 7.2 box) to version 4.3.5.
> However,
>now code I wrote in PHP before fails to work correctly. I have some
>code that invokes the math function atan2 in connection with
>converting rectangular to polar coordinates in a Web page. This used
>to work in PHP 4.x (earlier version) but failed with 4.3.4 and now
>with 4.3.5. I haven't found anything in the README files about this
>-- any thoughts on how to make atan2 work?


Failed in what way?

atan2 works fine for me on PHP 4.3.5, and I've not specified anything special
with regards to maths modules.

Configure Command
'./configure' '--prefix=/usr' '--with-apxs2=/usr/apache2/bin/apxs'
'--with-config-file-path=/etc/apache2' '--enable-trans-sid' '--with-gd'
'--with-mysql=/usr/mysql' '--with-zlib-dir=/usr' '--with-jpeg'
'--with-jpeg-dir=/usr'


It fails in that no matter what (x,y) point I give it, I get 0 back
for the angle. This did NOT happen with PHP 4.0.6 -- it worked just
fine then.


Output of this script on PHP 4.3.5:

<pre>
<?php
$xrange = 3;
$yrange = 3;

print " ";
for ($x=-$xrange; $x<=$xrange; $x++)
printf(" %-6d", $x);

echo "\n";

for ($y=-$yrange; $y<=$yrange; $y++)
{
printf(" %-6d ", $y);

for ($x=-$xrange; $x<=$xrange; $x++)
{
printf(" %-3.3f", atan2($x, $y));
}
echo "\n";
}

?>
</pre>

Is:
-3 -2 -1 0 1 2 3
-3 -2.356 -2.554 -2.820 3.142 2.820 2.554 2.356
-2 -2.159 -2.356 -2.678 3.142 2.678 2.356 2.159
-1 -1.893 -2.034 -2.356 3.142 2.356 2.034 1.893
0 -1.571 -1.571 -1.571 0.000 1.571 1.571 1.571
1 -1.249 -1.107 -0.785 0.000 0.785 1.107 1.249
2 -0.983 -0.785 -0.464 0.000 0.464 0.785 0.983
3 -0.785 -0.588 -0.322 0.000 0.322 0.588 0.785

Which looks right to me.

So does this give all zeroes on your setup?

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Brian Richmond | last post by:
I'm trying to use a regular expression to match a hidden html tag and replace it with the results of a mysql query. The query is based off a part of the hidden tag. For example: The article...
1
by: Robert Mark Bram | last post by:
Howdy All! I am trying to write a very brief comparison of the Date and Math objects in terms of instance v static objects. What I have below is my best so far. Any criticisms or suggestions are...
17
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels...
11
by: srinivas | last post by:
Hi all, I have one requirement.Is there any way to create a line graph using javascript.If it is please send me the sample code.But the thing is it should work in all browsers. Thanks,...
8
by: Sensei | last post by:
I have a quick question about the math library included in the standard C90 (and 99). The gcc, xlc and possibly other compilers/linkers on some unix platforms cannot use any math functions in...
5
by: Ark | last post by:
Hi everyone, Does anyone know if Direct3D overloads System.Math functions? Also is it possible to access the base functions of the overloaded function (in other words restore original of the...
110
by: Gregory Pietsch | last post by:
I'm writing a portable implementation of the C standard library for http://www.clc-wiki.net and I was wondering if someone could check the functions in math.h for sanity/portability/whatever. I'm...
7
by: Mark Healey | last post by:
Do the trig functions in math.h work in degrees, radians or what? For some reason it doesn't say which in "man math.h" IIRC the arctan of a slope gives the angle. So, shouldn't atanf((float)1)...
0
by: schizoid_man | last post by:
Hi, I've written the class below and compiled it with the 'Register for COM Interop' option set to true and I can see the resulting .dll file. However, I can not successfully pull it into the...
7
by: neha_chhatre | last post by:
hello im writing a c program in ubuntu, im using the function log2f(float) float stands for a float value.... im getting the following error neha@neha:~/midi$ gcc twinkle_formula.c...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.