winhugs crashes on C stack overflow
Jan Reineke
jan@sokofun.de
Wed, 12 Feb 2003 20:12:18 +0100
This is a multi-part message in MIME format.
--------------070108070207050105050805
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I am new to Haskell and functional programming in general, but I think
that I have found a bug in Winhugs.
When I call "wurzel 5" in the "dos-mode"-hugs after loading the attached
file I get "ERROR - C stack overflow", which is ok. Winhugs crashes in
the same situation. In my German Win2k version it says "winhugs.exe hat
Fehler verursacht und wird geschlossen. Starten Sie das Programm neu.
Ein Fehlerprotokoll wird erstellt." which means something like
"winhugs.exe has created an error and is going to be closed. Restart the
program."
Is this a known issue?
Regards,
Jan Reineke
--------------070108070207050105050805
Content-Type: text/plain;
name="bug.hs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="bug.hs"
absolutevalue :: (Double -> Double)
absolutevalue x = if (x < 0)
then -x
else x
newtoniteration :: (Double -> Double) -> (Double -> Double) -> Double -> Double
newtoniteration g gprime x = if (absolutevalue(g x/gprime x) < 0.01)
then x
else newtoniteration g gprime x-(g x/gprime x)
wurzel a = newtoniteration (\x -> (x*x-a)) (\x -> x*x) 2
f a x = x*x-a
fprime x = x*x
wurzelalternative a = newtoniteration (f a) fprime 2
--------------070108070207050105050805--