Diff for /parser3/src/classes/math.C between versions 1.40 and 1.41

version 1.40, 2005/08/09 08:14:48 version 1.41, 2005/08/26 11:12:45
Line 164  static inline int _random(uint top) { Line 164  static inline int _random(uint top) {
 }  }
   
 static void _random(Request& r, MethodParams& params) {  static void _random(Request& r, MethodParams& params) {
         Value& range=params.as_junction(0, "range must be expression");          double top=params.as_double(0, "range must be expression", r);
         double top=r.process_to_value(range).as_double();  
         if(top<=0 || top>MAX_UINT)          if(top<=0 || top>MAX_UINT)
                 throw Exception("parser.runtime",                  throw Exception("parser.runtime",
                         0,                          0,
Line 181  static double degrees(double param) { re Line 180  static double degrees(double param) { re
 static double radians(double param) { return param /180 *PI; }  static double radians(double param) { return param /180 *PI; }
   
 static void math1(Request& r, MethodParams& params, math1_func_ptr func) {  static void math1(Request& r, MethodParams& params, math1_func_ptr func) {
         Value& param=params.as_junction(0, "parameter must be expression");          double param=params.as_double(0, "parameter must be expression", r);
           double result=func(param);
         double result=func(r.process_to_value(param).as_double());  
         r.write_no_lang(*new VDouble(result));          r.write_no_lang(*new VDouble(result));
 }  }
   
Line 208  MATH1(sqrt); Line 206  MATH1(sqrt);
   
 typedef double (*math2_func_ptr)(double, double);  typedef double (*math2_func_ptr)(double, double);
 static void math2(Request& r, MethodParams& params, math2_func_ptr func) {  static void math2(Request& r, MethodParams& params, math2_func_ptr func) {
         Value& a=params.as_junction(0, "parameter must be expression");          double a=params.as_double(0, "parameter must be expression", r);
         Value& b=params.as_junction(1, "parameter must be expression");          double b=params.as_double(1, "parameter must be expression", r);
           double result=func(a, b);
         double result=func(  
                 r.process_to_value(a).as_double(),  
                 r.process_to_value(b).as_double());  
         r.write_no_lang(*new VDouble(result));          r.write_no_lang(*new VDouble(result));
 }  }
   

Removed from v.1.40  
changed lines
  Added in v.1.41


E-mail: