Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALWAYS SLOWER THAN STD.LUT
- This should only really be used if you absolutely must use std.Expr
- import math
- from functools import partial
- def trig_expr(acc=7, func='sin'):
- a = list(range(5, acc+1, 2))
- f = [math.factorial(x) for x in a]
- pm = {0: '+', 1: '-'}
- ds = {False: 'dup1', True: 'swap'}
- e = ' {} dup dup 3 pow 6 / - '.format('' if func=='sin' else ' {} 2 / + '.format(math.pi))
- for i in range(acc//2 - 1):
- e += ' {} {} pow {} / {} '.format(ds[i == acc//2 - 2], a[i], f[i], pm[i%2])
- return e
- sin, cos = [partial(trig_expr, func=f) for f in ('sin', 'cos')]
- """
- expr = 'x sin'.replace('sin', sin(7) )
- core.std.Expr(clip32, expr)
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement