Hello!
i am rewriting a hinge lib, and to be sure to have a valid setup, i wanted
to check if the imputed value is uneven (??)
that's when i noted, there doesn't seem to be typecasting in openscad?
how do i achieve: x - 2*int(x/2) != 0 ?
i searched in the archives, but i only found on how to find out what type
is in the var, but not how to cast it....
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr
There is no type casting because their is only one number type in OpenSCAD.
You could use floor(x/2) as that will be an integer value held in a
floating point type. The is also ceil() and round().
On Sun, 12 Apr 2020 at 10:41, Bruno Boettcher bboett@gmail.com wrote:
Hello!
i am rewriting a hinge lib, and to be sure to have a valid setup, i wanted
to check if the imputed value is uneven (??)
that's when i noted, there doesn't seem to be typecasting in openscad?
how do i achieve: x - 2*int(x/2) != 0 ?
i searched in the archives, but i only found on how to find out what type
is in the var, but not how to cast it....
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
To test oddness x % 2 is useful.
On Sun, 12 Apr 2020 at 10:52, nop head nop.head@gmail.com wrote:
There is no type casting because their is only one number type in
OpenSCAD. You could use floor(x/2) as that will be an integer value held in
a floating point type. The is also ceil() and round().
On Sun, 12 Apr 2020 at 10:41, Bruno Boettcher bboett@gmail.com wrote:
Hello!
i am rewriting a hinge lib, and to be sure to have a valid setup, i
wanted to check if the imputed value is uneven (??)
that's when i noted, there doesn't seem to be typecasting in openscad?
how do i achieve: x - 2*int(x/2) != 0 ?
i searched in the archives, but i only found on how to find out what type
is in the var, but not how to cast it....
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ahh modulo! yes, nice one thanks!
that did it!
Am So., 12. Apr. 2020 um 11:54 Uhr schrieb nop head nop.head@gmail.com:
To test oddness x % 2 is useful.
On Sun, 12 Apr 2020 at 10:52, nop head nop.head@gmail.com wrote:
There is no type casting because their is only one number type in
OpenSCAD. You could use floor(x/2) as that will be an integer value held in
a floating point type. The is also ceil() and round().
On Sun, 12 Apr 2020 at 10:41, Bruno Boettcher bboett@gmail.com wrote:
Hello!
i am rewriting a hinge lib, and to be sure to have a valid setup, i
wanted to check if the imputed value is uneven (??)
that's when i noted, there doesn't seem to be typecasting in openscad?
how do i achieve: x - 2*int(x/2) != 0 ?
i searched in the archives, but i only found on how to find out what
type is in the var, but not how to cast it....
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr