Subject: Re: [linux-audio-dev] Converting float to int
From: Joe Pfeiffer (pfeiffer_AT_cs.nmsu.edu)
Date: Tue Oct 30 2001 - 01:27:38 EET
> Well, I was assuming that it was really +-1.0f is 0dB(internal), so >1.0
> or <-1.0 is possible, and I though that SHRT_MIN != -SHRT_MAX (though K&R
> seem to disagree, pp. 257). I guess I've forgotten how 2's complement
> works.
for 2's complement SHRT_MIN would be one larger than SHRT_MAX, but
i don't think you should depend on signed integers being 2's complement.
with
1's complement SHRT_MIN == -SHRT_MAX.
That's the minimum acceptable limit. It's actually
implementation-dependent; on Intel (quickly looking at
/usr/include/limits.h), it's -32768 and 32767 as you'd expect.
-- Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605 Department of Computer Science FAX -- (505) 646-1002 New Mexico State University http://www.cs.nmsu.edu/~pfeiffer Southwestern NM Regional Science and Engr Fair: http://www.nmsu.edu/~scifair Support Mayfield HS Band! Send me e-mail by 11/1 if you want to buy some fruit
This archive was generated by hypermail 2b28 : Tue Oct 30 2001 - 01:23:18 EET