Talk:Abs

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

I was thinking that it's kinda sad that Oblivion doesn't have a simple math function like this natively. I've thrown together a small equation I use for finding absolute value in place of abs when I'm not using OBSE. A = a * ((a > 0) + ((a < 0) * -1))

--Moses 20:56, 25 April 2010 (EDT)

It is sad. I think your script is doing too much, personally, since you're making two comparisons when only one is needed. This would be more efficient (though slightly longer to write):
if ( A < 0 )
  set A to -A
else
  set A to A
endif
Ultimately, this page is more for the OBSE function Abs than how to achieve the same effect without OBSE. Achieving it without OBSE is decidedly trivial, if tedious to write, so I'm not sure if we should keep your code here or not. For now, I'm leaving it, but I may remove it; I'm going to see how the other functions handle this issue.
Finally - why would there be times when you're not using OBSE? I really cannot think of any good reason not to use OBSE.
Dragoon Wraith TALK 21:12, 25 April 2010 (EDT)
No other work-around for OBSE math functions appears on the pages for the OBSE functions, so I've removed it. Sorry.
Dragoon Wraith TALK 21:20, 25 April 2010 (EDT)