On Mon, Jan 14, 2002 at 03:46:59PM -0800, Peter Jay Salzman wrote:
> begin Rod Roark <[EMAIL PROTECTED]> 
> > It's not sqrt that is producing nonsense, but rather printf.  Printf 
> > accepts any types in its arguments, and it's your responsibility to make 
> > sure that the data types match up with what's in the format string.  The 
> > compiler can't fix it because it's a runtime issue.
> > 
> > This is generally considered a weakness in the way that printf works.
>  
> i understand printf well enough (and printf really isn't important to
> me, since i'm not really printing these values.  just calculating them).
> 
> > Regarding the math function, the compiler can cast the argument (perhaps 
> > with a warning) because it knows how sqrt is declared.
>  
> so you're saying it's fine to pass sqrt a long double, or "it could be
> fine"?

Definitely fine.  But you'll get a double back, not a long double
(except when you're using tgmath.h in C99).

You have an old copy of K&R.

Micah
_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to