Discussion:
Deprecated math operator ^ ?
(too old to reply)
Verr?ckter
2009-04-03 13:56:18 UTC
Permalink
I was using Cold Fusion MX7, and now I'm on CF8.

This week someone told me that I had a problem with one of my calculation, it
use to be giving the good result but now it is not giving good result. The only
thing I can see is that the math operator ^ is deprecated in CF8, is there
something that replace it???

<cfset mtp = #rem# * 100 * ( (1 - ((1+ (#tme#/100))^-#duree#) ) ) / #tme#>
Adam Cameron
2009-04-03 15:07:47 UTC
Permalink
Post by Verr?ckter
the math operator ^ is deprecated in CF8,
Cite?

It certainly doesn't say anything like that in the docs:
http://livedocs.adobe.com/coldfusion/8/htmldocs/Expressions_03.html

{quote}
^

Exponentiation: Return the result of a number raised to a power (exponent).
Use the caret character (^) to separate the number from the power; for
example, 2^3 is 8. Real and negative numbers are allowed for both the base
and the exponent. However, any expression that equates to an imaginary
number, such -1^.5 results in the string "-1.#IND. ColdFusion does not
support imaginary or complex numbers.
{quote}

But anyway, if something is deprecated, it still works same as it ever did,
it's simply flagged for obsolescence. So even if the ^ operator was
deprecated, there'd be no difference in how it worked before and after
deprecation.

CF seldom deprecates things, and even when deprecated, things are seldom
actually obsoleted. A good example is the parameterExists() function: it's
be deprecated since (at least) CF5. It's still there and functional in CF8
though.
Post by Verr?ckter
<cfset mtp = #rem# * 100 * ( (1 - ((1+ (#tme#/100))^-#duree#) ) ) / #tme#>
Well you don't need those pound signs in there, but having them just makes
your code look untidy, it doesn't actually impact anything.

What kind of differences in results are you seeing?
--
Adam
Verr?ckter
2009-04-03 16:47:55 UTC
Permalink
Hi Adam,

I did not meant to say that the ^ was depreciated, what I should've wrote is "is the math operator ^ is deprecated in CF8?" I'm french so my english is sometime off a bit :-)
Adam Cameron
2009-04-04 07:49:15 UTC
Permalink
Post by Verr?ckter
Hi Adam,
I did not meant to say that the ^ was depreciated, what I should've wrote is "is the math operator ^ is deprecated in CF8?" I'm french so my english is sometime off a bit :-)
Ah right. Well your English is at least as good as a lot of native English
speakers I know, so don't apologise for that.

So, to answer your question: no, the ^ operator is not deprecated.
Post by Verr?ckter
Post by Adam Cameron
What kind of differences in results are you seeing?
IE: what's an exact of a difference in the result on CFMX7 compared to CF8?
Can you provide some example values I can try in my own environment?
--
Adam
Loading...