normcdf is not supported using MSVC for use_dll
normcdf has a one line implementation using standard library functions (included in MSVC), namely:
double normcdf(double value)
{
return 0.5 * erfc(-value * M_SQRT1_2);
}
It seems a little unnecessary for this not to be supported with MSVC.
Designs
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Author
Implementation taken from: https://stackoverflow.com/questions/2328258/cumulative-normal-distribution-function-in-c-c
- Developer
@houtanb Could we get this into
4.5
? We already have a check for MSVC like#ifdef _MSC_VER # define nearbyint(x) (fabs((x)-floor(x)) < fabs((x)-ceil(x)) ? floor(x) : ceil(x)) #endif
in the
use_dll_static
anduse_dll_dynamic
-files so adding this might be not that much work. - Developer
@houtanb While we are at it, we should try to lift the restriction on
acosh, asinh, atanh
. MSVC is supporting them sinceMSVC 2012
, i.e._MSC_VER
bigger than1600
. See http://stackoverflow.com/questions/15539116/atanh-arc-hyperbolic-tangent-function-missing-in-ms-visual-c - Contributor
allowing
acosh, asinh, atanh, normcdf
with MSVC >= 11.0 in 4255be00 - Contributor
@JohannesPfeifer @tholden I only find
erfc
support bymsvc
going back to 2012. Was this supported before? https://msdn.microsoft.com/en-us/library/hh308292(v=vs.110).aspx - Developer
@houtanb It seems I was wrong.
erfc
was introduced inMSVC
together with the other functions likeacosh
. So d7d2e4fd was wrong and should be reverted, while https://github.com/DynareTeam/dynare/commit/4255be00b8a10226470c4cc1bc5a514ce37041bc was ok. - Contributor
@JohannesPfeifer we can implement the solution here for MSVC < 2012
- Developer
@houtanb We could. But given that MSVC 2015 is free and #1227 (closed) seems to mandate that version as well in master, we should probably not devote resources to this.
- Developer
What is still missing to function correctly with
normcdf
is a#ifdef _MSC_VER #define _USE_MATH_DEFINES #endif
Before
#include <math.h>
in the
_dynamics.c
and_static.c
files to define the mathematical constants. See https://msdn.microsoft.com/library/4hwaceh6.aspx