Navigation Menu

Skip to content

Commit

Permalink
Move NVSIZE>8 warning to Core.xs BOOT
Browse files Browse the repository at this point in the history
This gives a one time warning that precision will be lost
converting from perl NV to PDL_Doubles.  Removed careful
but useless logic and croak from pdl_whichdatatype_double().
  • Loading branch information
devel-chm committed Oct 4, 2015
1 parent 56a98b9 commit 3efe3fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Basic/Core/Core.xs
Expand Up @@ -881,6 +881,10 @@ set_c(x,position,value)
pdl_changed( x , PDL_PARENTDATACHANGED , 0 );

BOOT:
{
#if NVSIZE > 8
fprintf(stderr, "Your perl NV has more precision than PDL_Double. There will be loss of floating point precision!\n");
#endif

/* Initialize structure of pointers to core C routines */

Expand Down Expand Up @@ -951,6 +955,7 @@ BOOT:
by other modules
*/
sv_setiv(get_sv("PDL::SHARE",TRUE|GV_ADDMULTI), PTR2IV(&PDL));
}

# make piddle belonging to 'class' and of type 'type'
# from avref 'array_ref' which is checked for being
Expand Down
7 changes: 1 addition & 6 deletions Basic/Core/pdlcore.c.PL
Expand Up @@ -301,13 +301,8 @@ int pdl_whichdatatype_double (NV nv) {
TESTTYPE(PDL_F,PDL_Float)
TESTTYPE(PDL_D,PDL_Double)
if( !finite(nv) ) { return PDL_D; }
#if NVSIZE > 8
warn("Precision loss due to 'long double' to 'PDL_D' conversion!");
/* Default return type PDL_Double */
return PDL_D;
#else
croak("Something's gone wrong: %lf cannot be converted by whichdatatype_double", nv);
#endif
}
Expand Down

0 comments on commit 3efe3fd

Please sign in to comment.