A quadratic formula solver

Small, short code snippets that other people may find useful. Do you have a good regex that you would like to share? Share it! Even better, the code can be commented on, and improved.

Moderator: General Moderators

Post Reply
Daisy Cutter
Forum Commoner
Posts: 75
Joined: Sun Aug 01, 2004 9:51 am

A quadratic formula solver

Post by Daisy Cutter »

The first PHP script I've written I feel is decent enough to share. It solves the quadratic formula. For a demo, go to http://www.kafene.org/index.php?url=htt ... script.php

Feedback? Improvements?

All working towards a blog script, and later, a forum script.[/url]
User avatar
Sema
Forum Commoner
Posts: 34
Joined: Fri Sep 03, 2004 12:43 pm
Location: Aalborg, Denmark

Hmmm not working

Post by Sema »

It is not working...I get this error:

Code: Select all

Warning: main(http://kafene.org/http://kafene.org/2004/08/quadratic-formula-script.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/.halleck/mcovey/kafene.org/index.php on line 90

Warning: main(): Failed opening 'http://kafene.org/http://kafene.org/2004/08/quadratic-formula-script.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/.halleck/mcovey/kafene.org/index.php on line 90
EDIT
hmmm, now i can see the problem, the url is wrong... http://www.kafene.org/2004/08/quadratic ... script.php
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

it's still open for some serious improvements:

as soon as a == 0 -> division by zero error.

also, there are cases when there are only 0 or 1 solutions... and then it's silly to echo + and - solution :)
Post Reply