[PATCH] centralised definition for surface pressure

Jan Schubert Jan.Schubert at GMX.li
Mon Jan 14 13:27:09 PST 2013

On 01/14/13 21:45, Linus Torvalds wrote:
> On Mon, Jan 14, 2013 at 9:52 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>>> +#define O2_IN_AIR        0.20942
>>> +#define AIR_PERMILLE     O2_IN_AIR * 1000
>> Now this is interesting. I'm not sure this will bite us anywhere in the
>> code, but if you think about it, the old definition of 209 was an int,
>> but 0.20942 * 1000 is actually a float. So this could change calculations.
>> So while I like the intent of making this simpler, I think I'd feel
>> better if AIR_PERMILLE was defined to be 209 in stead of 0.20942 * 1000
> I have a more fundamental disagreement with the patch.
> Which is that the precision of the constant is overengineered to begin
> with. We're not trying to estimate the weight of all the oxygen in the
> atmosphere to the nearest ton.

OK, the purpose of the patch is not to get more precision but just to
centralise things done redundantly at several places in the code. In
fact there is already some "overengineered" precision in the code:

profile.c:      gc->topy = 1.5 * (maxdepth + 10000) / 10000.0 * 1.01325;

Personally I'm a fan of such "overengineered" stuff, but anyway,
switching to full permille should be fine.


More information about the subsurface mailing list