* circle * fix another example * fix bad comment * toPoint fix * cargo fmt * resolve most of the tests * fix last test * missed circle in bracket * remove console error * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * trigger ci * remove three dot menu for circle * make sure circle can be extruded * fix up after merge * add extrude test for circle * clean up * typo * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)" This reverts commit03f8eeb542
. * update docs again * cmd bar test serialisation improvements * tiny clean up * fix after: Replace kittycad crate with kittycad-modeling-cmds * fmt * rename fix * Update src/lib/toolbar.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * add another error to list * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * image updates * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)" This reverts commit505bb20bea
. * update markdown * skip un reproducable windows test failure * rust review * leave issue todo comment --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
44 lines
118 KiB
Markdown
44 lines
118 KiB
Markdown
---
|
|
title: "int"
|
|
excerpt: "Convert a number to an integer."
|
|
layout: manual
|
|
---
|
|
|
|
Convert a number to an integer.
|
|
|
|
Callers should use floor(), ceil(), or other rounding function first if they care about how numbers with fractional parts are converted. If the number has a fractional part, it's truncated, moving the number towards zero.
|
|
If the number is NaN or has a magnitude, either positive or negative, that is too large to fit into the internal integer representation, the result is a runtime error.
|
|
|
|
```js
|
|
int(num: number) -> i64
|
|
```
|
|
|
|
### Tags
|
|
|
|
* `convert`
|
|
|
|
### Examples
|
|
|
|
```js
|
|
const sketch001 = startSketchOn('XZ')
|
|
|> circle({ center: [0, 0], radius: 2 }, %)
|
|
const extrude001 = extrude(5, sketch001)
|
|
|
|
const pattern01 = patternTransform(int(ceil(5 / 2)), (id) => {
|
|
return { translate: [4 * id, 0, 0] }
|
|
}, extrude001)
|
|
```
|
|
|
|

|
|
|
|
### Arguments
|
|
|
|
* `num`: `number` (REQUIRED)
|
|
|
|
### Returns
|
|
|
|
`i64`
|
|
|
|
|
|
|