Welcome, Guest

SQL pow() function
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: SQL pow() function

SQL pow() function 1 year ago #1728

  • jcarlstrom
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
I have created quite a few custom variables that are calculating CAGR using the pow() function. This week the functions stopped returning values other than 0. I tracked the problem down to the pow() function particularly when the second argument is anything other than an integer. Here is a test case
POW( (totalstockholderequitya/totalstockholderequitya2), .33333)

This always returns 0. If i use an integer instead of a fraction, it works. SQL allows fractions for the second parameter. I tried using FLOAT, REAL, and DOUBLE to force the first variable to be a real number but it didn't recognize FLOAT, REAL, or DOUBLE.

However, if I use a real number for the first parameter, it works. Example below works.
POW( (6, .33333)

What changed in the last two weeks?
John

Re: SQL pow() function 1 year ago #1730

  • admin
  • OFFLINE
  • Administrator
  • Posts: 160
  • Karma: 5
We migrated from an old version of MySQL to a newer version of MariaDB (a drop-in replacement). There may be small idiosyncrasies like this between the two versions. The migration was necessary because CentOS 5 (the prior OS) is going end-of-life early next year and we needed to upgrade the entire system for security reasons.

To be honest, I do not understand your use of the POW function for this purpose. The growth condition could be refactored as:

((totalstockholderequitya / totalstockholderequitya2) > [number equal to growth rate squared])

as two years elapsed between those values.

I apologize for the problems caused by the change, but this upgrade was, unfortunately, unavoidable.
  • Page:
  • 1
Time to create page: 0.10 seconds