winhugs crashes on C stack overflow
Sigbjorn Finne
sof@galois.com
Fri, 14 Feb 2003 16:01:51 -0800
Hi there,
thanks for the bug report. No, this wasn't a known one, WinHugs'
evaluator thread didn't have an exception filter set up to catch
the stack overflow. It does now, making the behaviour uniform
across both versions of Hugs.
--sigbjorn
----- Original Message -----
From: "Jan Reineke" <jan@sokofun.de>
To: <hugs-bugs@haskell.org>
Sent: Wednesday, February 12, 2003 11:12
Subject: winhugs crashes on C stack overflow
> 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
>
----------------------------------------------------------------------------
----
> 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