On Freitag, 15. Dezember 2017 15:04:49 CET Lubomir I. Ivanov wrote:
> On 15 December 2017 at 11:24, Berthold Stoeger
> 
> <bstoe...@mail.tuwien.ac.at> wrote:
> > On Mittwoch, 13. Dezember 2017 23:34:32 CET Dirk Hohndel wrote:
> >> > On Dec 13, 2017, at 11:31 AM, Berthold Stoeger
> > 
> > Concerning the float warning, I have a patch that turns all float
> > calculations into double calculations sitting around for a few weeks. I
> > think float is like short: only to be used in very specific
> > circumstances. But I'll let the pros decide.
> 
> i would post the patch as a PR.
> 'float' is more like 'int' (32bit), so it's good to have a small data
> type with less precision and not always rely on 'double' or (64bit
> long).

From a bit-representation point of view, this is correct. From a more abstract 
language point of view I rather get the impression that
 - short ~ float
 - int ~ double
 - long ~ long double
 - long long ~ unsupported  (is your FP algorithm numerically unstable?)
The reason being that floating point literals (e.g. 1.0) represent doubles. You 
have to actively force single-precision floating point calculations by writing 
things like "x * 1000.0f".

> as a rule of thumb on the "double vs float" topic:
> - the compiler *should* SSE-optimize a range of floats more easily
> - in terms of speed and the x87, it shouldn't matter that much
> - floats take less space in memory

Sure, but that's also arguments that apply to short vs. int. That's what I 
meant with specific circumstances.

Berthold

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to