home *** CD-ROM | disk | FTP | other *** search
-
- /* (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- f4double.c
- */
-
- /* f4double
-
- Returns the value of the corresponding field as a double.
- Only defined for 'Numeric' fields and 'Character' fields
- containing numeric data.
- */
-
- #include "d4base.h"
- #include "string.h"
- #include "p4misc.h"
-
- extern int v4cur_base ;
- extern BASE *v4base ;
-
- double f4double( long f_ref )
- {
- if ( f4type(f_ref) == 'D' )
- {
- double d ;
-
- c4dt_julian( f4ptr(f_ref), &d) ;
- return( d ) ;
- }
-
- /* Convert the field data into a 'double' */
- return( c4atod( f4ptr(f_ref), f4width(f_ref)) ) ;
- }
-
- void f4r_double( long f_ref, double d_value )
- {
- char *ptr ;
-
- if ( f4type(f_ref) == 'D' )
- {
- c4dt_str( f4ptr(f_ref), &d_value ) ;
- }
- else
- {
- /* Convert the 'double' to ASCII and then copy it into the record buffer. */
- ptr = c4dtoa( d_value, f4width(f_ref), f4decimals(f_ref) ) ;
- memcpy( f4ptr(f_ref), ptr, (size_t) f4width(f_ref) ) ;
- }
-
- if ( v4base[v4cur_base].eof == 0 ) d4ptr()->buffer_changed = 1 ;
- }
-
- double f4value( long f_ref)
- {
- return( f4double(f_ref) ) ;
- }
-
-