Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37939

Misleading warning message "Division by 0" - no context of causing function e.g. 'Log'

    XMLWordPrintable

Details

    Description

      Requesting message text improvement.

      Since below code makes werid warning message.

      SELECT sum(LOG(GREATEST(1 + -2270.053/100, 1e-10)));
      SHOW WARNINGS;

      "Level;Code;Message
      Warning;1365;Division by 0"

      Literally, meaning is correct, nothing wrong,
      but with huge quries, cannot find the division 0 issue by searching '/' or somthing
      since the log logic internally do division like below code sample.
      So, make the message "Division by 0 in the Log function or something" to make db developer's life easier.

      double my_log(double x) {
          if (x <= 0) return NAN;
       
          double y = x - 1;
          for (int i = 0; i < 50; i++) {
              double exp_y = exp(y);
              y = y - (exp_y - x) / exp_y; <<<---- HERE
          }
          return y;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            npdmailing@gmail.com Mitchell Lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: