[vtk-developers] vtkMath::Ceil() and vtkMath::Floor()

Philippe Pébay pppebay at sandia.gov
Thu Jun 2 17:09:23 EDT 2011


... a clarification of what I asked earlier...

By "different intent" I was referring to the fact that vtkMath's Floor() and Ceil() perform something which I find a 
little intriguing, namely, casting a double to an int, and then re-casting the latter to a double to perform a 
double-double equality comparison, which, I would venture to say, should be avoided whenever possible.

On the other hand, Round() does not do this double casting but directly performs double-double inequality comparison, 
and a single cast to an int at the end. This seems much better to me.

Thanks
Philippe

On 06/02/2011 02:04 PM, Philippe Pébay wrote:
> Hello,
>
> I was contemplating using vtkMath::Ceil() and vtkMath::Floor() in some
> of my code, instead of the standard ceil() and floor(). However they
> appear to be written with a slightly different intent than
> vtkMath::Round(). Can someone comment on that?
>
> Thanks
> Philippe


-- 
Philippe Pébay
Sandia National Laboratories





More information about the vtk-developers mailing list