cos, sin, tan

This commit is contained in:
Tony Garnock-Jones 2023-02-14 14:51:57 +01:00
parent 6fd5e65376
commit a2124faebc
1 changed files with 4 additions and 0 deletions

View File

@ -242,6 +242,10 @@ export const Primitives: Environment<any> = {
'%'(a, b) { return [(a as number) % (b as number)]; },
'neg'(v) { return [-(v as number)]; },
'cos'(n) { return [Math.cos(n as number)]; },
'sin'(n) { return [Math.sin(n as number)]; },
'tan'(n) { return [Math.tan(n as number)]; },
'to'() {
const n_or_ns = this.nextToken('to', (v: any): v is (symbol | symbol[]) =>
typeof v === 'symbol' || (Array.isArray(v) && v.every(w => typeof w === 'symbol')));