Print

Print


On Wed, 11 Jan 2006, David Berry wrote:

>   This seems to be caused by CHR_CTOI happily converting a string such
> as "123456789123" (which represents a number which is too large for a 32
> bit integer) and returning -1097262461 with CSTAT == 0.
>
> Should CHR_CTOI perform a check by  re-formatting the returned integer
> and seeing if the resulting string looks like the supplied string?
>
> A bit of a performance hit, I admit. Any other ideas?

My immediate thought was, how about just testing the length, say against, 
VAL__SZI? You could avoid the overhead of fully testing long and short 
strings that way, but that wouldn't be wonderful as you'd still need to 
test any strings around about that length (VAL__SZI and VAL__SZI-1). 
There's also the business of leading zeros messing things up, you'd need 
to remove those. Maybe it would be better if you could just tell FITSMOD 
what format to use!

Cheers,

Peter.


> On Wed, 11 Jan 2006, Tim Lister wrote:
>
>> Hi all, we're using FITSMOD to write a summed variable into a FITS/NDF
>> header from a C shell script and we're having problems. The variable is
>> a summed total of counts from a number of frames and so can get very big
>> and overflows the signed integer.
>>
>> According to the FITSMOD docs it tries to cast the passed number to int,
>> real and string in that order and stops once it succeeds. Is there any
>> to force FITSMOD to write an exponential notation REAL in the first
>> instance ? (Otherwise it's going to be plan B and cunning use of awk to
>> turn it into exponential notation beforehand)
>>
>> Cheers,
>> 	Tim
>>
>> --
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>> =                                                               =
>> = Dr. Tim Lister (Astronomer)                                   =
>> = Keele Uni. Astronomy Group (on secondment to St. Andrews)     =
>> = email: [log in to unmask]  or  [log in to unmask]            =
>> = icbm: 56 20 12 N  2 48 52.5 W  +30m                           =
>> =          /* Halley */           (Halleys' comment)            =
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>
>

-- 
Dr. Peter W. Draper, astronomy programmer, http://star-www.dur.ac.uk/~pdraper