[Sidefx-houdini-list] rounding off in expression

Robert D.M. Smith robert.dm.smith at gmail.com
Wed Feb 11 15:31:54 EST 2009


On Tue, Feb 10, 2009 at 3:26 PM, Mark Elendt <mark at sidefx.com> wrote:

> On Tuesday Feb 10 at 14:02, Robert D.M. Smith wrote:
> > I have a group SOP that is filtering out points based on an expression
> ...
> > something like *if($VAR > 90, 1, 0)*
> >
> > There is a point that has a value of 89.9889 but the expression is
> failing
> > on it ... treating it like it's 90 or greater. Any ideas on how to give
> it
> > more precision?
>
> % hbatch
> / -> set VAR =  89.9889
> / -> echo `$VAR>90`
> 0
> / -> echo `ifs( 89.9889>90, 'true', 'false')`
> false
> / -> echo `ifs( $VAR>90, 'true', 'false')`
> false
>
> I can't reproduce this at all...
>
> Here are the commands without prompts (for cut & paste)
> set VAR =  89.9889
> echo `$VAR>90`
> echo `ifs( 89.9889>90, 'true', 'false')`
> echo `ifs( $VAR>90, 'true', 'false')`
>
> Can you get me a command script which fails like this?  Perhaps it's
> treating $VAR as a string?  So, maybe if you used atof($VAR)?



There is AttributeCreate SOP generating a float point attribute - call it
'custom'. The next SOP is a group that uses a filter expression  if($CUSTOM
> 90, 1, 0). A point with the value of 89.9564 gets missed.

I tried if(atof($CUSTOM) > 90, 1, 0)) and if(atof($CUSTOM) > 90.0, 1, 0))
but no luck.

?

Cheers,
   Rob



More information about the Sidefx-houdini-list mailing list