[OpenSCAD] boolean logic in openscad

chrysn chrysn at fsfe.org
Wed Oct 26 19:50:09 CEST 2011


On Wed, Oct 26, 2011 at 01:36:10PM +0000, William Adams wrote:
> I am wanting to implement a function that has the following pattern
> func(x) = (x<<13) & 0x7fffffff[...]?

are you aware that this is just the same as func(x) = (x*8192) % 2147483648;
(that is, in more readable but non-openscad notation, x*(2^13) % 0x80000000)?

(at least, if you expect x to behave like an integer -- i couldn't
correlate your sniplet to the source code i found when quickly looking
it up[1].)

regards
chrysn

[1] http://mrl.nyu.edu/~perlin/doc/oscar.html#noise

-- 
To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://rocklinux.net/pipermail/openscad/attachments/20111026/7523afc8/attachment.bin


More information about the OpenSCAD mailing list