ID:1305354
 
Resolved
Constant math expressions for several functions are now optimized by calculating them at compile-time.
Applies to:DM Language
Status: Resolved (499.1197)

This issue has been resolved.
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
I'm working on the compiler as it happens, and I think this is pretty darn doable.

[edit]
I've added such optimization for sqrt(), abs(), sin(), cos(), arcsin(), arccos(), log(), and pow().
In response to Lummox JR
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 floor() and ceil(), though those aren't imperative as the others.
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?
In response to Super Saiyan X
lol searching for potential redbook material.
In response to Super Saiyan X
Super Saiyan X wrote:
Lummox - by pow() you mean the internal pow therefore the ** operator, not some secret undocumented procedure, right?

Aye. The runtime error message still refers to it as pow(), but it is the ** operator.