Category : Files from Magazines
Archive   : CUJ0894.ZIP
Filename : XSTOD.C

 
Output of file : XSTOD.C contained in archive : CUJ0894.ZIP
-------------------------- Listing x: simple _Stod function ---------

// xstod -- _Stod LIMITED SUBSTITUTE
#include
#include
#include
#include

double _Stod(const char *s, char **ep, long pten)
{ // convert text to double and scale
double x = strtod(s, ep);
if (x != 0 && pten != 0)
{ // scale the result
while (pten < 0)
x /= 10, ++ pten; // MAY MISBEHAVE
while (0 < pten)
x *= 10, --pten; // MAY MISBEHAVE
if (x == 0 || x == HUGE_VAL || x == -HUGE_VAL)
errno = ERANGE; // MAY MISBEHAVE
}
return (x);
}


  3 Responses to “Category : Files from Magazines
Archive   : CUJ0894.ZIP
Filename : XSTOD.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/