How to create a double precision parameter in VEX or by a node

   1797   6   0
User Avatar
Member
9 posts
Joined: 8月 2022
Offline
Hi, I'm new to HE
trying to convert Calendar date to Jdate
but since the number is over 7 digits,
I can't get the correct results via VEX like coding in other language,

so How can I create a double value via scripting in Houdini?
or is there a node to handle double attribute in obj Network?


Thanks in advance :[
Edited by defreestijl - 2023年3月27日 23:04:45

Attachments:
t.png (178.3 KB)

User Avatar
Member
1737 posts
Joined: 5月 2006
Offline
I investigated something similar recently:

https://www.tokeru.com/cgwiki/HoudiniVex#itoa_and_64_bit_precision_limits [www.tokeru.com]

"The fix required to swap to 64 bits, which you can do on a wrangle by going to the bindings tab, and changing 'VEX Precision' to 64-bit."
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
8526 posts
Joined: 7月 2007
Online
first thing you need to do is make sure your Spreadsheet is showing full precision (View/Full Precision)
and then you should see the correct answer (instead of rounded number) even with default 32bit single precision float

then if you still need your floats to be double precision, set Bindings/VEX Precision to 64 bit
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
9 posts
Joined: 8月 2022
Offline
mestela
I investigated something similar recently:

https://www.tokeru.com/cgwiki/HoudiniVex#itoa_and_64_bit_precision_limits [www.tokeru.com]

"The fix required to swap to 64 bits, which you can do on a wrangle by going to the bindings tab, and changing 'VEX Precision' to 64-bit."

Hi, thanks for your help,
the website is a good learning source for a newbie like me
I changed the VEX Precision to 64-bit and now it works :]
User Avatar
Member
9 posts
Joined: 8月 2022
Offline
tamte
first thing you need to do is make sure your Spreadsheet is showing full precision (View/Full Precision)
and then you should see the correct answer (instead of rounded number) even with default 32bit single precision float

then if you still need your floats to be double precision, set Bindings/VEX Precision to 64 bit

Hi, thank you for the reply
I haven't noticed I can tweak the settings in Spreadsheet views,
thanks it really help.
User Avatar
Member
4495 posts
Joined: 2月 2012
Offline
helinavsar849
Hello! As a new Houdini user myself, I definitely understand the challenge of dealing with large numeric values.

For double precision parameters in VEX, you can use the double data type. For example:

double myValue = 1.234567e8;

This will store the number with full double precision rather than truncating it to a 32-bit float.

You can also create double attributes on nodes using hou.Node.parm() and specifying the parameter type as hou.parmTemplateType.Float.

There are a couple of nodes that can handle double precision attributes as well. The Attribute Create and Attribute Wrangle nodes have options for float and double parameter types.

I hope this helps provide some options for storing and manipulating large numeric values in Houdini! Don't hesitate to ask any other questions as you continue learning. The Houdini community is really helpful for troubleshooting. Good luck!

There is no double data type in VEX. It looks like this text is generated by Chat GPT.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
284 posts
Joined:
Offline
Is there any way to tell Houdini the precision of an attribute when creating it using Python?
  • Quick Links