Logo Search packages:      
Sourcecode: afnix version File versions

Real.cpp

// ---------------------------------------------------------------------------
// - Real.cpp                                                                -
// - standard object library - real class implementation                     -
// ---------------------------------------------------------------------------
// - This program is free software;  you can redistribute it  and/or  modify -
// - it provided that this copyright notice is kept intact.                  -
// -                                                                         -
// - This program  is  distributed in  the hope  that it will be useful, but -
// - without  any  warranty;  without  even   the   implied    warranty   of -
// - merchantability or fitness for a particular purpose.  In no event shall -
// - the copyright holder be liable for any  direct, indirect, incidental or -
// - special damages arising in any way out of the use of this software.     -
// ---------------------------------------------------------------------------
// - copyright (c) 1999-2007 amaury darsch                                   -
// ---------------------------------------------------------------------------

#include "Real.hpp"
#include "Stdsid.hxx"
#include "Vector.hpp"
#include "Recycle.hpp"
#include "Boolean.hpp"
#include "Runnable.hpp"
#include "Character.hpp"
#include "QuarkZone.hpp"
#include "Exception.hpp"
#include "cmth.hpp"
#include "ccnv.hpp"

namespace afnix {

  // -------------------------------------------------------------------------
  // - memory section                                                        -
  // -------------------------------------------------------------------------

  // the real recycler
  static Recycle recycler;

  // allocate a new real
  void* Real::operator new (const t_size size) {
    return recycler.pop (size);
  }

  // delete a real
  void Real::operator delete (void* handle) {
    recycler.push (handle);
  }

  // -------------------------------------------------------------------------
  // - private section                                                       -
  // -------------------------------------------------------------------------

  // the default precision
  t_real Real::d_eps = 0.00001;

  // -------------------------------------------------------------------------
  // - class section                                                         -
  // -------------------------------------------------------------------------

  // create a new default real

00061   Real::Real (void) {
    d_value = 0.0;
  }

  // create a new real from a native real

00067   Real::Real (const t_real value) {
    d_value = value;
  }

  // create a new real from an Integer

00073   Real::Real (const Integer& value) {
    d_value = value.tointeger ();
  }

  // create a new real from a string

00079   Real::Real (const String& value) {
    bool status = false;
    const char* data = value.tochar ();
    d_value = c_atod (data, status);
    delete [] data;
    if (status == false) {
      throw Exception ("literal-error", "illegal string real number", value);
    }
  }
  
  // copy constructor for this real

00091   Real::Real (const Real& that) {
    that.rdlock ();
    d_value = that.d_value;
    that.unlock ();
  }

  // return the class name

00099   String Real::repr (void) const {
    return "Real";
  }

  // return a literal representation of this real

00105   String Real::toliteral (void) const {
    return tostring ();
  }

  // return a string representation of this real

00111   String Real::tostring (void) const {
    rdlock ();
    char* buffer = c_dtoa (d_value);
    unlock ();
    String result (buffer);
    delete [] buffer;
    return result;
  }

  // return a clone of this real

00122   Object* Real::clone (void) const {
    return new Real (*this);
  }

  // return the real serial code

00128   t_byte Real::serialid (void) const {
    return SERIAL_REAL_ID;
  }

  // serialize this real

00134   void Real::wrstream (Output& os) const {
    rdlock ();
    String sval = tostring ();
    sval.wrstream (os);
    unlock ();
  }

  // deserialize this real

00143   void Real::rdstream (Input& is) {
    wrlock ();
    String sval;
    sval.rdstream (is);
    *this = sval;
    unlock ();
  }

  // return a format string of this real

00153   String Real::format (const long precision) const {
    if (precision < 0) {
      throw Exception ("real-error", "invalid precision with real format");
    }
    rdlock ();
    char* buffer = c_dtoap (d_value, precision);
    unlock ();
    String result (buffer);
    delete [] buffer;
    return result;
  }

  // return the double representation

00167   t_real Real::toreal (void) const {
    rdlock ();
    t_real result = d_value;
    unlock ();
    return result;
  }

  // get an integer from this real
  
00176   t_long Real::tointeger (void) const {
    rdlock ();
    t_long result = (t_long) d_value;
    unlock ();
    return result;
  }
  
  // set an real with a value

00185   Real& Real::operator = (const t_real value) {
    wrlock ();
    d_value = value;
    unlock ();
    return *this;
  }

  // set an real with a value

00194   Real& Real::operator = (const Real& value) {
    wrlock ();
    value.rdlock ();
    d_value = value.d_value;
    value.unlock ();
    unlock ();
    return *this;
  }

  // compute the opposite of a real

00205   Real operator - (const Real& x) {
    x.rdlock ();
    Real result = -x.d_value;
    x.unlock ();
    return result;
  }

  // add two double reals together

00214   Real operator + (const Real& x, const Real& y) {
    x.rdlock ();
    y.rdlock ();
    Real result = x.d_value + y.d_value;
    y.unlock ();
    x.unlock ();
    return result;
  }

  // subtract two double reals

00225   Real operator - (const Real& x, const Real& y) {
    x.rdlock ();
    y.rdlock ();
    Real result = x.d_value - y.d_value;
    y.unlock ();
    x.unlock ();
    return result;
  }

  // multiply two double reals

00236   Real operator * (const Real& x, const Real& y) {
    x.rdlock ();
    y.rdlock ();
    Real result = x.d_value * y.d_value;
    y.unlock ();
    x.unlock ();
    return result;
  }

  // divide two double reals 

00247   Real operator / (const Real& x, const Real& y) {
    x.rdlock ();
    y.rdlock ();
    Real result = x.d_value / y.d_value;
    y.unlock ();
    x.unlock ();
    return result;
  }

  // add a real to this one

00258   Real& Real::operator += (const Real& x) {
    wrlock   ();
    x.rdlock ();
    d_value += x.d_value;
    x.unlock ();
    unlock   ();
    return *this;
  }

  // subtract a real to this one

00269   Real& Real::operator -= (const Real& x) {
    wrlock   ();
    x.rdlock ();
    d_value -= x.d_value;
    x.unlock ();
    unlock   ();
    return *this;
  }

  // multiply a real with this one

00280   Real& Real::operator *= (const Real& x) {
    wrlock   ();
    x.rdlock ();
    d_value *= x.d_value;
    x.unlock ();
    unlock   ();
    return *this;
  }

  // multiply a real with this one

00291   Real& Real::operator /= (const Real& x) {
    wrlock   ();
    x.rdlock ();
    d_value /= x.d_value;
    x.unlock ();
    unlock   ();
    return *this;
  }

  // prefix add one to the real

00302   Real& Real::operator ++ (void) {
    wrlock ();
    ++d_value;
    unlock ();
    return *this;
  }

  // postfix add one to the real

00311   Real Real::operator ++ (int) {
    wrlock ();
    Real result = *this;
    d_value++;
    unlock ();
    return result;
  }

  // prefix sub one to the real

00321   Real& Real::operator -- (void) {
    wrlock ();
    --d_value;
    unlock ();
    return *this;
  }

  // postfix sub one to the real

00330   Real Real::operator -- (int) {
    wrlock ();
    Real result = *this;
    d_value--;
    unlock ();
    return result;
  }

  // compare an real with a native value
  
00340   bool Real::operator == (const t_long value) const {
    rdlock ();
    bool result = (d_value == (t_real) value);
    unlock ();
    return result;
  }
  
  // compare an real with a native value
  
00349   bool Real::operator != (const t_long value) const {
    rdlock ();
    bool result = (d_value != (t_real) value);
    unlock ();
    return result;
  }

  // compare an real with a double value
  
00358   bool Real::operator == (const t_real value) const {
    rdlock ();
    bool result = (d_value == value);
    unlock ();
    return result;
  }
  
  // compare an real with a native value
  
00367   bool Real::operator != (const t_real value) const {
    rdlock ();
    bool result = (d_value != value);
    unlock ();
    return result;
  }

  // compare two reals

00376   bool Real::operator == (const Real& value) const {
    rdlock ();
    value.rdlock ();
    bool result = (d_value == value.d_value);
    value.unlock ();
    unlock ();
    return result;
  }

  // compare two reals

00387   bool Real::operator != (const Real& value) const {
    rdlock ();
    value.rdlock ();
    bool result = (d_value != value.d_value);
    value.unlock ();
    unlock ();
    return result;
  }

  // compare two reals

00398   bool Real::operator < (const Real& value) const {
    rdlock ();
    value.rdlock ();
    bool result = (d_value < value.d_value);
    value.unlock ();
    unlock ();
    return result;
  }

  // compare two reals

00409   bool Real::operator <= (const Real& value) const {
    rdlock ();
    value.rdlock ();
    bool result = (d_value <= value.d_value);
    value.unlock ();
    unlock ();
    return result;
  }

  // compare two reals

00420   bool Real::operator > (const Real& value) const {
    rdlock ();
    value.rdlock ();
    bool result = (d_value > value.d_value);
    value.unlock ();
    unlock ();
    return result;
  }

  // compare two reals

00431   bool Real::operator >= (const Real& value) const {
    rdlock ();
    value.rdlock ();
    bool result = (d_value >= value.d_value);
    value.unlock ();
    unlock ();
    return result;
  }


  // return true if the number is 0

00443   bool Real::iszero (void) const {
    rdlock ();
    bool result = (d_value == 0.0);
    unlock ();
    return result;
  }

  // compare with a real upto to epsilon

00452   bool Real::cmp (const t_real value) const {
    rdlock ();
    t_real delta  = (d_value <= value) ? value - d_value : d_value - value;
    bool   result = (delta <= Real::d_eps);
    unlock ();
    return result;
  }

  // return true if the number is nan

00462   bool Real::isnan (void) const {
    rdlock ();
    bool result = c_isnan (d_value);
    unlock ();
    return result;
  }

  // return the ceiling of this number

00471   Real Real::ceiling (void) const {
    rdlock ();
    Real result = c_ceiling (d_value);
    unlock ();
    return result;
  }

  // return the floor of this number

00480   Real Real::floor (void) const {
    rdlock ();
    Real result = c_floor (d_value);
    unlock ();
    return result;
  }

  // return the absolute value of this number
  
00489   Real Real::abs (void) const {
    rdlock ();
    Real result = c_abs (d_value);
    unlock ();
    return result;
  }
  
  // return the remainder of this number with its argument
  
00498   Real Real::mod (const Real& x) const {
    rdlock   ();
    x.rdlock ();
    Real result = c_mod (d_value, x.d_value);
    x.unlock ();
    unlock   ();
    return result;
  }
  
  // return the square root of this real
  
00509   Real Real::sqrt (void) const {
    rdlock ();
    bool status = false;
    Real result = c_sqrt (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with sqrt call");
    }
    unlock ();
    return result;
  }
  
  // return the natural logarithm of this real
  
00523   Real Real::log (void) const {
    rdlock ();
    bool status = false;
    Real result = c_log (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with log call");
    }
    unlock ();
    return result;
  }
  
  // return the exponential of this number
  
00537   Real Real::exp (void) const {
    rdlock ();
    Real result = c_exp (d_value);
    unlock ();
    return result;
  }
  
  // return the power of this number with the argument
  
00546   Real Real::pow (const Real& x) const {
    rdlock   ();
    x.rdlock ();
    Real result = c_pow (d_value, x.d_value);
    x.unlock ();
    unlock   ();
    return result;
  }
  
  // return the sine of this number
  
00557   Real Real::sin (void) const {
    rdlock ();
    Real result = c_sin (d_value);
    unlock ();
    return result;
  }
  
  // return the cosine of this number
  
00566   Real Real::cos (void) const {
    rdlock ();
    Real result = c_cos (d_value);
    unlock ();
    return result;
  }
  
  // return the tangent of this number
  
00575   Real Real::tan (void) const {
    rdlock ();
    Real result = c_tan (d_value);
    unlock ();
    return result;
  }
  
  // return the arc sine of this number
  
00584   Real Real::asin (void) const {
    rdlock ();
    bool status = false;
    Real result = c_asin (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with asin call");
    }
    unlock ();
    return result;
  }
  
  // return the arc cosine of this number
  
00598   Real Real::acos (void) const {
    rdlock ();
    bool status = false;
    Real result = c_acos (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with acos call");
    }
    unlock ();
    return result;
  }
  
  // return the arc tangent of this number
  
00612   Real Real::atan (void) const {
    rdlock ();
    bool status = false;
    Real result = c_atan (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with atan call");
    }
    unlock ();
    return result;
  }
  
  // return the hyperbolic sine of this number
  
00626   Real Real::sinh (void) const {
    rdlock ();
    bool status = false;
    Real result = c_sinh (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with sinh call");
    }
    unlock ();
    return result;
  }
  
  // return the hyperbolic cosine of this number
  
00640   Real Real::cosh (void) const {
    rdlock ();
    bool status = false;
    Real result = c_cosh (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with cosh call");
    }
    unlock ();
    return result;
  }

  // return the hyperbolic tangent of this number

00654   Real Real::tanh (void) const {
    rdlock ();
    bool status = false;
    Real result = c_tanh (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with tanh call");
    }
    unlock ();
    return result;
  }
  
  // return the hyperbolic arc sine of this number

00668   Real Real::asinh (void) const {
    rdlock ();
    bool status = false;
    Real result = c_asinh (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with asinh call");
    }
    unlock ();
    return result;
  }
  
  // return the hyperbolic arc cosine of this number
  
00682   Real Real::acosh (void) const {
    rdlock ();
    bool status = false;
    Real result = c_acosh (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with acosh call");
    }
    unlock ();
    return result;
  }

  // return the hyperbolic arc tangent of this number
  
00696   Real Real::atanh (void) const {
    rdlock ();
    bool status = false;
    Real result = c_atanh (d_value,status);
    if (status == false) {
      unlock ();
      throw Exception ("real-error", "math error with atanh call");
    }
    unlock ();
    return result;
  }

  // -------------------------------------------------------------------------
  // - object section                                                        -
  // -------------------------------------------------------------------------

  // the quark zone
  static const long QUARK_ZONE_LENGTH = 38;
  static QuarkZone  zone (QUARK_ZONE_LENGTH);

  // the object supported quarks
  static const long QUARK_OPP      = zone.intern ("++");
  static const long QUARK_OMM      = zone.intern ("--");
  static const long QUARK_ADD      = zone.intern ("+");
  static const long QUARK_SUB      = zone.intern ("-");
  static const long QUARK_MUL      = zone.intern ("*");
  static const long QUARK_DIV      = zone.intern ("/");
  static const long QUARK_EQL      = zone.intern ("==");
  static const long QUARK_NEQ      = zone.intern ("!=");
  static const long QUARK_LTH      = zone.intern ("<");
  static const long QUARK_LEQ      = zone.intern ("<=");
  static const long QUARK_GTH      = zone.intern (">");
  static const long QUARK_GEQ      = zone.intern (">=");
  static const long QUARK_AEQ      = zone.intern ("+=");
  static const long QUARK_SEQ      = zone.intern ("-=");
  static const long QUARK_MEQ      = zone.intern ("*=");
  static const long QUARK_DEQ      = zone.intern ("/=");
  static const long QUARK_QEQ      = zone.intern ("?=");
  static const long QUARK_ABS      = zone.intern ("abs");
  static const long QUARK_LOG      = zone.intern ("log");
  static const long QUARK_EXP      = zone.intern ("exp");
  static const long QUARK_SIN      = zone.intern ("sin");
  static const long QUARK_COS      = zone.intern ("cos");
  static const long QUARK_TAN      = zone.intern ("tan");
  static const long QUARK_SQRT     = zone.intern ("sqrt");
  static const long QUARK_NANP     = zone.intern ("nan-p");
  static const long QUARK_ASIN     = zone.intern ("asin");
  static const long QUARK_ACOS     = zone.intern ("acos");
  static const long QUARK_ATAN     = zone.intern ("atan");
  static const long QUARK_SINH     = zone.intern ("sinh");
  static const long QUARK_COSH     = zone.intern ("cosh");
  static const long QUARK_TANH     = zone.intern ("tanh");
  static const long QUARK_ASINH    = zone.intern ("asinh");
  static const long QUARK_ACOSH    = zone.intern ("acosh");
  static const long QUARK_ATANH    = zone.intern ("atanh");
  static const long QUARK_FLOOR    = zone.intern ("floor");
  static const long QUARK_ZEROP    = zone.intern ("zero-p");
  static const long QUARK_FORMAT   = zone.intern ("format");
  static const long QUARK_CEILING  = zone.intern ("ceiling");

  // evaluate an object to a real value

00758   t_real Real::evalto (Runnable* robj, Nameset* nset, Object* object) {
    Object* obj = (object == nilp) ? nilp : object->eval (robj, nset);
    Real*   val = dynamic_cast <Real*> (obj);
    if (val == nilp) throw Exception ("type-error", "nil object to evaluate");
    return val->toreal ();
  }

  // create a new real in a generic way

00767   Object* Real::mknew (Vector* argv) {
    if ((argv == nilp) || (argv->length () == 0)) return new Real;
    if (argv->length () != 1) 
      throw Exception ("argument-error", 
                   "too many argument with real constructor");
    // try to map the real argument
    Object* obj = argv->get (0);
    if (obj == nilp) return new Real;

    // try an integer object
    Integer* ival = dynamic_cast <Integer*> (obj);
    if (ival != nilp) return new Real (ival->tointeger ());

    // try a real object
    Real* rval = dynamic_cast <Real*> (obj);
    if (rval != nilp) return new Real (*rval);

    // try a character object
    Character* cval = dynamic_cast <Character*> (obj);
    if (cval != nilp) return new Real (cval->toquad ());

    // try a string object
    String* sval = dynamic_cast <String*> (obj);
    if (sval != nilp) return new Real (*sval);

    // illegal object
    throw Exception ("type-error", "illegal object with real constructor",
                 obj->repr ());
  }

  // return true if the given quark is defined

00799   bool Real::isquark (const long quark, const bool hflg) const {
    rdlock ();
    if (zone.exists (quark) == true) {
      unlock ();
      return true;
    }
    bool result = hflg ? Literal::isquark (quark, hflg) : false;
    unlock ();
    return result;
  }

  // operate this real with another object

00812   Object* Real::oper (t_oper type, Object* object) {
    Integer* iobj = dynamic_cast <Integer*> (object);
    Real*    dobj = dynamic_cast <Real*>    (object);
    switch (type) {
    case Object::ADD:
      if (iobj != nilp) return new Real (*this + *iobj);
      if (dobj != nilp) return new Real (*this + *dobj);
      break;
    case Object::SUB:
      if (iobj != nilp) return new Real (*this - *iobj);
      if (dobj != nilp) return new Real (*this - *dobj);
      break;
    case Object::MUL:
      if (iobj != nilp) return new Real (*this * *iobj);
      if (dobj != nilp) return new Real (*this * *dobj);
      break;
    case Object::DIV:
      if (iobj != nilp) return new Real (*this / *iobj);
      if (dobj != nilp) return new Real (*this / *dobj);
      break;
    case Object::UMN:
      return new Real (-(*this));
      break;
    case Object::EQL:
      if (iobj != nilp) return new Boolean (*this == *iobj);
      if (dobj != nilp) return new Boolean (*this == *dobj);
      break;
    case Object::NEQ:
      if (iobj != nilp) return new Boolean (*this != *iobj);
      if (dobj != nilp) return new Boolean (*this != *dobj);
      break;
    case Object::GEQ:
      if (iobj != nilp) return new Boolean (*this >= *iobj);
      if (dobj != nilp) return new Boolean (*this >= *dobj);
      break;
    case Object::GTH:
      if (iobj != nilp) return new Boolean (*this > *iobj);
      if (dobj != nilp) return new Boolean (*this > *dobj);
      break;
    case Object::LEQ:
      if (iobj != nilp) return new Boolean (*this <= *iobj);
      if (dobj != nilp) return new Boolean (*this <= *dobj);
      break;
    case Object::LTH:
      if (iobj != nilp) return new Boolean (*this < *iobj);
      if (dobj != nilp) return new Boolean (*this < *dobj);
      break;
    }
    throw Exception ("type-error", "invalid operand with real",
                 Object::repr (object));
  }

  // set an object to this real

00866   Object* Real::vdef (Runnable* robj, Nameset* nset, Object* object) {
    Integer* iobj = dynamic_cast <Integer*> (object);
    if (iobj != nilp) {
      *this = *iobj;
      return this;
    }
    Real* dobj = dynamic_cast <Real*> (object);
    if (dobj != nilp) {
      *this = *dobj;
      return this;
    }
    throw Exception ("type-error", "invalid object with real vdef",
                 Object::repr (object));
  }

  // apply this object with a set of arguments and a quark

00883   Object* Real::apply (Runnable* robj, Nameset* nset, const long quark,
                   Vector* argv) {
    // get the number of arguments
    long argc = (argv == nilp) ? 0 : argv->length ();

    // dispatch 0 argument
    if (argc == 0) {
      if (quark == QUARK_ABS)      return new Real    (abs     ());
      if (quark == QUARK_LOG)      return new Real    (log     ());
      if (quark == QUARK_EXP)      return new Real    (exp     ());
      if (quark == QUARK_SIN)      return new Real    (sin     ());
      if (quark == QUARK_COS)      return new Real    (cos     ());
      if (quark == QUARK_TAN)      return new Real    (tan     ());
      if (quark == QUARK_SINH)     return new Real    (sinh    ());
      if (quark == QUARK_COSH)     return new Real    (cosh    ());
      if (quark == QUARK_TANH)     return new Real    (tanh    ());
      if (quark == QUARK_ASIN)     return new Real    (asin    ());
      if (quark == QUARK_ACOS)     return new Real    (acos    ());
      if (quark == QUARK_ATAN)     return new Real    (atan    ());
      if (quark == QUARK_SQRT)     return new Real    (sqrt    ());
      if (quark == QUARK_NANP)     return new Real    (isnan   ());
      if (quark == QUARK_ASINH)    return new Real    (asinh   ());
      if (quark == QUARK_ACOSH)    return new Real    (acosh   ());
      if (quark == QUARK_ATANH)    return new Real    (atanh   ());
      if (quark == QUARK_FLOOR)    return new Real    (floor   ());
      if (quark == QUARK_CEILING)  return new Real    (ceiling ());
      if (quark == QUARK_ZEROP)    return new Boolean (iszero  ());

      if (quark == QUARK_OPP) {
      ++(*this);
      robj->post (this);
      return this;
      }
      if (quark == QUARK_OMM) {
      --(*this);
      robj->post (this);
      return this;
      }
    }

    if (argc == 1) {
      if (quark == QUARK_ADD) return oper (Object::ADD, argv->get (0));
      if (quark == QUARK_SUB) return oper (Object::SUB, argv->get (0)); 
      if (quark == QUARK_MUL) return oper (Object::MUL, argv->get (0)); 
      if (quark == QUARK_DIV) return oper (Object::DIV, argv->get (0)); 
      if (quark == QUARK_EQL) return oper (Object::EQL, argv->get (0)); 
      if (quark == QUARK_NEQ) return oper (Object::NEQ, argv->get (0)); 
      if (quark == QUARK_LTH) return oper (Object::LTH, argv->get (0)); 
      if (quark == QUARK_LEQ) return oper (Object::LEQ, argv->get (0)); 
      if (quark == QUARK_GTH) return oper (Object::GTH, argv->get (0)); 
      if (quark == QUARK_GEQ) return oper (Object::GEQ, argv->get (0)); 

      if (quark == QUARK_AEQ) {
      t_real val = argv->getireal (0);
      *this += val;
      robj->post (this);
      return this;
      }
      if (quark == QUARK_SEQ) {
      t_real val = argv->getireal (0);
      *this -= val;
      robj->post (this);
      return this;
      }
      if (quark == QUARK_MEQ) {
      t_real val = argv->getireal (0);
      *this *= val;
      robj->post (this);
      return this;
      }
      if (quark == QUARK_DEQ) {
      t_real val = argv->getireal (0);
      *this /= val;
      robj->post (this);
      return this;
      }
      if (quark == QUARK_QEQ) {
      t_real val = argv->getreal (0);
      return new Boolean (cmp (val));
      }
      if (quark == QUARK_FORMAT) {
      long precision = argv->getint (0);
      return new String (format (precision));
      }
    }

    // call the literal method
    return Literal::apply (robj, nset, quark, argv);
  }
}

Generated by  Doxygen 1.6.0   Back to index