[racket] Rusty Math

From: Thomas Chust (chust at web.de)
Date: Sun Dec 26 09:04:42 EST 2010

2010/12/26 Sayth Renshaw <flebber.crue at gmail.com>:
> [...]
> However I don't think any value could test true therefore my function would
> always be false. I do need to double check though as my math is rusty. But
> you cannot square a number and have it retun negative can you?
> [...]

Hello Sayth,

whether that is possible depends on the domain of the function. Real
numbers never produce negative results when squared, complex numbers
may do so, though. More precisely, every negative real number has an
imaginary square root.

> [...]
> ;;; equation : number --> boolean
> ;;; to determine whether n is true for the equation (2 - n(squared) = 102)
> (define (forn x)
>   (= (- 2 (* x x) ) 102))
> [...]

Try evaluating (forn 0+10i).


When C++ is your hammer, every problem looks like your thumb.

Posted on the users mailing list.