[FFmpeg-devel] [FFmpeg-devel-irc] IRC log for 2010-04-14

Måns Rullgård mans
Fri Apr 23 20:46:27 CEST 2010


Michael Niedermayer <michaelni at gmx.at> writes:

> On Thu, Apr 15, 2010 at 01:00:40AM +0100, irc at mansr.com wrote:
> [...]
>
>> [21:56:17] <mru> don't remember what 1/-0 is defined as
>> [21:58:02] <BastyCDGS> intuitively I would say -inf
>> [21:58:09] <BastyCDGS> -1/-0 = +inf
>> [21:58:23] <mru> negative zeros are evil anyway
>> [21:58:32] <Dark_Shikari> it makes if( x == 0 ) hard
>> [21:58:38] <Dark_Shikari> or at least annoying
>> [21:58:48] <mru> bitmask
>> [21:58:49] <BastyCDGS> yes I haven't ever heard of somebody really using this
>> [21:58:53] <Dark_Shikari> Yeah, bitmask works
>> [21:58:56] <Dark_Shikari> just more immediate bits
>> [21:59:03] <BastyCDGS> or fabs(x) == 0.0
>> [21:59:07] <mru> ugh
>> [21:59:10] <BastyCDGS> :D
>> [21:59:21] <mru> shift left one and test for zero
>> [21:59:21] <BastyCDGS> but looks really lame i know
>> [21:59:25] <Dark_Shikari> fabs *is* faster than abs ;)
>> [21:59:36] <Dark_Shikari> clearly we should use one's complement for all data
>> [21:59:39] <mru> if shift also sets flags
>> [22:00:51] <BastyCDGS> luckily I doesn't happen that often that you have to divide some value by george w. bush's IQ :D
>> [22:01:19] <mru> well, suppose you need to calculate wars/iq
>> [22:01:49] <Dark_Shikari> how about pretzels/iq
>> [22:02:01] <mru> wars/pretzel
>> [22:02:46] <BastyCDGS> oh yeah you're right, for dividing by bush's IQ we have to introduce complex numbers
>> [22:02:57] <BastyCDGS> oops dragging sqrt
>> [22:05:59] <BastyCDGS> what about if ( x == 0.0 || x == -0.0 )?
>
> 0.0 == -0.0
> if(x==0.0) is enough
>
> this fact comes from basic algebra and thus should be true in every language
> though one cant be certain these days anymore ;)

Wrong, this fact comes from IEEE754:

  Comparisons shall ignore the sign of zero (so +0 = -0).

Algebra as defined by mathematicians cannot be trusted around computers.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list