Right now, something like 5*5 gets optimized to 25, but if you do 5*abs(5), it does not, since this optimization does not work for math functions
Support for this would be pretty nice
ID:1305354
![]() Jun 27 2013, 10:20 pm
|
|||||||
Resolved
| |||||||
While you're at it, it would be nice if you could add additional trig functions as well, such as tan(), atan2(), atan(), and possibly even
|
Can't you make every one of those functions yourself? ceil() especially, which is just round(num,1).
|
Yes, you can. All of the aforementioned trig functions are dependent of one another, in one way or another; however, there's no excuse as to why they aren't built-in.
|
tan is just sin(a)/cos(a), which the compiler can optimize now anyways
Not sure about atan(2) though |
What does this mean, anyway?
The compiler performs arithmetic and simplifies constants while compiling? |
Nadrew wrote:
Can't you make every one of those functions yourself? ceil() especially, which is just round(num,1). ceil(x) is not round(x,1). round(x,1) rounds to the nearest whole number. ceil(x) is -round(-x), since round(x) is floor(x). |
Lummox JR resolved issue with message:
Constant math expressions for several functions are now optimized by calculating them at compile-time. |
Lummox - by pow() you mean the internal pow therefore the ** operator, not some secret undocumented procedure, right?
|
[edit]
I've added such optimization for sqrt(), abs(), sin(), cos(), arcsin(), arccos(), log(), and pow().