home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1986. THINK Technologies, Inc. All rights reserved. */
-
- #include "unix.h"
- #include "sane.h"
- #include "MacTypes.h"
-
- #ifndef _math_
- #include "Math.h"
- #endif
-
- #ifdef _MC68881_
-
- #define _toDecimal() fp68k(&_decimal_,&x80,FFEXT|FOD2B)
- #define _tox96() x80tox96(&x80, &x)
-
- /* conversion from 68881 to SANE extended type */
- static void x96tox80(x96, x80)
- register Extended96 *x96;
- register Extended80 *x80;
-
- {
- (*x80).exponent = (*x96).exponent;
- (*x80).mantissa = (*x96).mantissa;
- }
-
- static void x80tox96(x80, x96)
- register Extended80 *x80;
- register Extended96 *x96;
- {
- (*x96).exponent = (*x80).exponent;
- (*x96).reserved = 0;
- (*x96).mantissa = (*x80).mantissa;
- }
-
- #else
-
- #define _toDecimal() fp68k(&_decimal_,&x,FFEXT|FOD2B)
- #define _tox96()
-
- #endif
-
- double atof(s)
- char *s;
-
- {
-
- Decimal _decimal_;
- int index=0;
- Boolean read_error;
- double x;
-
- #ifdef _MC68881_
- Extended80 x80;
- #endif
-
- CStr2Dec(s,&index,&_decimal_,&read_error);
- _toDecimal();
- _tox96();
- return(x);
- }