blob: a8fd16f11b306280ea57aa1913f89cb341c84300 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <mach.h>
# CTOR -- Character to real. The number of characters converted to produce
# the output number is returned as the function value (0 is returned if the
# input cannot be interpreted as a number).
int procedure ctor (str, ip, rval)
char str[ARB] # input string to be decoded
int ip # first character to be used in string
real rval # decoded real value (output)
double dval
int nchars, expon
int ctod()
begin
nchars = ctod (str, ip, dval)
if (abs(dval) > EPSILOND)
expon = int (log10 (abs(dval)))
else
expon = 0
if (IS_INDEFD(dval))
rval = INDEFR
else if (expon > MAX_EXPONENTR)
return (0)
else
rval = dval
return (nchars)
end
|