POV-Ray : Newsgroups : povray.unofficial.patches : Noisy thoughts : Re: Noisy thoughts Server Time
2 Sep 2024 04:13:02 EDT (-0400)
  Re: Noisy thoughts  
From: Tom Melly
Date: 29 Sep 2000 11:06:39
Message: <39d4afff$1@news.povray.org>

news:39D4ABB9.43F155FB@enst.fr...
> > So C will never use integer math on a variable declared as float, even
when
> > the value of the float is an integer?
> I don't think it will, but anyway in this case, the values were not
> integers...

Never? - I was slightly assuming that the value of x_ix changed. What I
meant was that if x_ix went through the series 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
1.1, etc. then the calculation when x_ix = 1.0 could be quicker. Of course,
it wouldn't be much of an optimisation since it would only (in the above
example) speed up one calculation out of every 10.

Actually, in the language I most commonly code in (a proprietry db lang.
based on pascal I think), the speed difference you noticed would be exactly
what I'd expect. Although a side effect would be that the result would alway
be an integer (the language does not require pre-declaration of data-types).

So: 1 + 1.5 = 2, but 1.0 + 1.5 = 2.5 since the result is data-typed to match
the data type of the first input. (therefore 1.5 + 1 = 2.5)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.