in reply to Re^5: NaNs are true
in thread NaNs are true

Correct, which is why uninitialised needs to be distinct from NaN

In C, the creation of an mpfr_t variable is done as follows:
mpfr_t x; /* declaration */ x = mpfr_init(); /* initializes x with a value of NaN */
x cannot be used for anything until it has been initialized - and once initialized, x remains NaN until some other value gets assigned to it.
"Math::MPFR->new();" wraps those 2 steps. Maybe it should stop short of calling the mpfr_init() ... I'd have to play about with it before I could get my head around the usefulness (or otherwise) of doing so.

Cheers,
Rob

Replies are listed 'Best First'.
Re^7: NaNs are true
by ikegami (Patriarch) on Mar 01, 2011 at 05:12 UTC

    Possibilities include

    • Using an external state (e.g. NULL pointer to the mpfr_t for uninitialised).
    • Setting the value to zero on creation.
    • Setting the value to a specific NaN that's unlikely to occur by other means on creation.