On 2009-06-02 at 18:01:44 [+0200], Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote: > Ingo Weinhold <ingo_weinhold@xxxxxx> wrote: > > > The position computation is only correct (even if it could be > > > simplified) if "min" is negative - which is the whole point of the > > > red > > > vs. green color, anyway. The volume currently goes from -60 to +18 > > > dB, > > > btw. > > > > The computation looks interesting nevertheless. Usually it holds: > > > > max - min - max == -min > > > > And one can just hope that the compiler doesn't actually multiply by > > 1.0f. > > I'd replace the above by: > > > > float position = (float)min / (min - max); > > I guess you mean "(float)-min" here :-) Nope, I meant what I wrote. :-) CU, Ingo