44 lines
		
	
	
		
			139 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			44 lines
		
	
	
		
			139 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| 
								 | 
							
								---
							 | 
						||
| 
								 | 
							
								title: "int"
							 | 
						||
| 
								 | 
							
								excerpt: "Converts a number to an integer."
							 | 
						||
| 
								 | 
							
								layout: manual
							 | 
						||
| 
								 | 
							
								---
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Converts 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([0, 0], 2, %)
							 | 
						||
| 
								 | 
							
								const extrude001 = extrude(5, sketch001)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const pattern01 = patternTransform(int(ceil(5 / 2)), (id) => {
							 | 
						||
| 
								 | 
							
								  return { translate: [4 * id, 0, 0] }
							 | 
						||
| 
								 | 
							
								}, extrude001)
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### Returns
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								`i64`
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 |