[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JULDAY 5.4 not same as 5.3?

pit@phys.uu.nl (Peter Suetterlin) writes:
> I'm still not sure who's to blame, me (i.e. the programmer) or
> IDL/RSI, but in general it does not make sense to take a negative of a
> unsigned number, and IMHO there should also occur an automatic type
> conversion as soon as a minus sign is involved.  Currently, you get e.g.
> IDL> x=5b
> IDL> print,-x
>  251

We can argue all day about what is correct mathematically.

However I think it is correct from a microprocessor standpoint (ie,
that's what the processor does).  Further more it satisfies certain
identities like:

 (-x) + x EQ 0

And what would you do with a number like -('ffffffff'xul), ie a number
that to begin with is too large to fit into a signed type.

Finally, you would have the people (like me) who would gripe about how
IDL changed the type of a variable without asking me first!


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response