Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Binary arithmetic/operators in featurescript?
mark_sherriff693
Member Posts: 2 EDU
Hi,
I'm looking to be able to do things like XOR, bit shifting and bit masking inside a function in FeatureScript, as part of a generative algorithm to draw a pseudo Hilbert curve.
Unfortunately, this looks like it's not possible, as FS gives no binary operators or binary types - is there a known way to do these sorts of things in the community?
The closest I can get to anything resembling it in decimal is representing a right shift as "floor(value / 2)" - but this is only one part of the algorithm.
Thanks
I'm looking to be able to do things like XOR, bit shifting and bit masking inside a function in FeatureScript, as part of a generative algorithm to draw a pseudo Hilbert curve.
Unfortunately, this looks like it's not possible, as FS gives no binary operators or binary types - is there a known way to do these sorts of things in the community?
The closest I can get to anything resembling it in decimal is representing a right shift as "floor(value / 2)" - but this is only one part of the algorithm.
Thanks
0
Comments
There is no binary operators in FeatureScript. You will have to do your own functions for that. Also, all numbers in FeatureScript are represented as double-precision floats, so you will lose some precision as soon as you go above ~53 bits.
IR for AS/NZS 1100