Login  Register

Null<double> and arithmetics

Posted by Vadim Ogranovich-3 on May 07, 2002; 1:18pm
URL: http://quantlib.414.s1.nabble.com/Null-double-and-arithmetics-tp2054.html

Life may be more simple than I thought, it seems like comipilers have
support for NaN and Inf numbers. Below is a VC++ help page that makes me
think this is the case

_finite
Determines whether given double-precision floating point value is finite.

int _finite( double x );

Function Required Header Compatibility
_finite <float.h> Win 95, Win NT


For additional compatibility information, see Compatibility in the
Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version


Return Value

_finite returns a nonzero value (TRUE) if its argument x is not infinite,
that is, if -INF < x < +INF. It returns 0 (FALSE) if the argument is
infinite or a NaN.

Parameter

x

Double-precision floating-point value

Floating-Point Support Routines

See Also   _isnan, _fpclass


----------------------------------------------------------------------------
----
Send feedback to MSDN.Look here for MSDN Online resources.


Hi,

Just want to make a suggestion. Currently
double x = Null<double>() * 0.01;
produces a valid double, which is confusing (I ran into it when I read
interest rates in %% and then converted to non-percent numbers).

I heard that there is a IEEE standard + libraries for things like NaN, Inf,
etc. It would be nice if  Null<numeric> conform to that standard.
Another option is to use Rmath library (a standalone byproduct of R-project)
which seems to handle NaN-s properly, but I don't have first-hand experience
with it.

Thanks, Vadim

--------------------------------------------------
DISCLAIMER
This e-mail, and any attachments thereto, is intended only for use by the
addressee(s) named herein and may contain legally privileged and/or
confidential information.  If you are not the intended recipient of this
e-mail, you are hereby notified that any dissemination, distribution or
copying of this e-mail, and any attachments thereto, is strictly prohibited.
If you have received this e-mail in error, please immediately notify me and
permanently delete the original and any copy of any e-mail and any printout
thereof.

E-mail transmission cannot be guaranteed to be secure or error-free.  The
sender therefore does not accept liability for any errors or omissions in
the contents of this message which arise as a result of e-mail transmission.

NOTICE REGARDING PRIVACY AND CONFIDENTIALITY

Knight Trading Group may, at its discretion, monitor and review the content
of all e-mail communications.