octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60169] error: call of overloaded pow is ambig


From: Michele
Subject: [Octave-bug-tracker] [bug #60169] error: call of overloaded pow is ambiguous
Date: Fri, 5 Mar 2021 14:27:59 -0500 (EST)
User-agent: Mozilla/5.0 (X11; SunOS sun4v; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #4, bug #60169 (project octave):

[comment #3 comment #3:]
> If you want to copy something here and prevent savannah from attempting to
format it, use verbatim tags (see the
https://savannah.gnu.org/bugs/?group=octave&func=additem page) or attach a
file.

Sorry about that.

> I have no idea why applying the patch failed for you.
> 
> Can you apply it by hand?  The changes were quite simple.

Maybe I did it wrong:

libgui/graphics/Table.cc:84:5: error: 'type' does not name a type; did you
mean 'wctype'?
     type ten = 10 ;
     ^~~~
     wctype
libgui/graphics/Table.cc:86:5: error: expected unqualified-id before 'if'
     if (format == 'n')                                                       
\     ^~
libgui/graphics/Table.cc:97:5: error: expected unqualified-id before 'else'
     else if (format == 'F')                                                  
\     ^~~~
libgui/graphics/Table.cc:105:5: error: expected unqualified-id before 'else'
     else if (format == 'E')                                                  
\     ^~~~
libgui/graphics/Table.cc:117:5: error: expected unqualified-id before 'else'
     else                                                                     
\     ^~~~
libgui/graphics/Table.cc: In function 'QString formatNumber(double, char,
int)':libgui/graphics/Table.cc:83:3: error: a function-definition is not
allowed here before '{' token
   {
   ^

And this is that part of the source:

#define FORMATNUMBER(type)                                                   
\
  static QString formatNumber (type d,                                       
\
                               char format = 'f',                            
\
                               int precision = 4)                            
\
  { 
    type ten = 10 ;  
                                                                              
                    
    if (format == 'n')                                                       
\
      {                                                                      
\
        if (d == floor (d))                                                  
\
          return QString::number (d, 'g', precision);                        
\
 //       else if (d <= pow ((double)10, (double)precision - 1) && d > pow
(10, 1 - precision)) 
          else if (d <= pow (ten, precision - 1)                              
 
                 && d > pow (ten, 1 - precision)) 
          return QString::number (d, 'f', precision);                        
\
        else                                                                 
\
          return QString::number (d, 'e', precision);                        
\
      }                                                                      
\
    else if (format == 'F')                                                  
\
      {                                                                      
\
        int exponent = floor (log10 (d) / 3) * 3;                            
\
        d *= pow (ten, -exponent);                                            
\
        return QString::number (d, 'f', precision) + "e" +                   
\
          (exponent < 0 ? "-" : "+") +                                       
\
          QString ("%1").arg (abs (exponent), 3, 10, QChar ('0'));           
\
      }                                                                      
\
    else if (format == 'E')                                                  
\
      {                                                                      
\
        int exponent = floor (log10 (d) / 3) * 3;                            
\
      d *=  pow (ten, -exponent); 
//        d *=  pow ((double)10, (double)-exponent);
                                          
        return QString::number (d,                                           
\
                                'f',                                         
\
                                precision - floor (log10 (d)) - 1) +         
\
               "e" + (exponent < 0 ? "-" : "+") +                            
\
               QString ("%1").arg (abs (exponent), 3, 10, QChar ('0'));      
\
      }     


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60169>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]