public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Brian Gough <bjg@network-theory.co.uk>
To: <gsl-discuss@sources.redhat.com>
Subject: Re: possible design weekness
Date: Mon, 12 Mar 2007 21:26:00 -0000	[thread overview]
Message-ID: <87tzwqyx09.wl%bjg@network-theory.co.uk> (raw)
In-Reply-To: <1173448719.10868.3.camel@pc446.psi.ch>

At Fri, 9 Mar 2007 14:58:39 +0100,
Alxneit-Kamber Ivo wrote:
> I have recently been bitten by what seems to be a design weekness in how
> the functions (function to be minimized, or system of ODE's) are
> defined. These function do not return a status value but the function
> value. This prevents to easily notifiy the caller (iterate) of a failure
> such as e.g. a domain error of one of its arguments or a failed
> malloc().

Hello,

For a domain error the function can return NaN, and the driver routines
should handle this (if they don't we should fix them).

For those functions that return a double there is a tradeoff between
generality and convenience.  As you point out, it is more general to
always return a status value, and the functions have been written from
the point of view that it is more convenient for the user to work with
functions that return a double, as for the standard library functions
- sin(x), log(x), etc.

Most of the time the functions do not do memory allocation or need to
signal other errors, apart from domain error, and it is convenient to
be able to write y=f(x).

I don't think there is any straightforward way to handle the two
possibilities in the same framework.  What I had in mind was that NaN
be used as an error (additional information can be passed back through
the *params argument if needed) and that the routines should return
with GSL_FAILURE if they receive a NaN.

-- 
Brian Gough

      reply	other threads:[~2007-03-12 21:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-09 13:58 Alxneit-Kamber Ivo
2007-03-12 21:26 ` Brian Gough [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tzwqyx09.wl%bjg@network-theory.co.uk \
    --to=bjg@network-theory.co.uk \
    --cc=gsl-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).