The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Taking the square root of a negative number? by toysbfun 2008-07-29 14:39:01
I was working on a little program to solve quadratic equations. Unfortunately, I noticed that it doesn't work when the discriminant is negative. I started in C and then moved to Python, unable to find a way to make it work in either language. Apparently both C and Python can handle imaginary numbers when declared, but freak out when an imaginary number pops up as the answer. Help please?
[ Reply ]
  I'd check if the (b^2 + 4ac) is negative... by Divinar2008-07-29 14:44:55
    Should be (b^2 - 4ac) in subject line above (n/t) by Divinar2008-07-29 14:46:13
    Right. And my C program by toysbfun2008-07-29 14:54:38
  *bonk* and the TLP title was the string I needed by toysbfun2008-07-29 14:45:26
  The C function you're looking for is abs() (n/t) by quilting_kitty2008-07-29 19:08:37
    Thanks. I'll play with that and see if it works. (n/t) by toysbfun2008-07-29 19:23:15

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)