2 scalar.cc -- implement Scalar
4 source file of the Flower Library
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "rational.hh"
15 Scalar::Scalar (Rational r)
20 Scalar::operator Rational ()
26 Scalar::to_rat () const
28 int p = index_i ('/');
32 String s2 = right_str (length_i ()-p-1);
33 String s1 = left_str (p);
35 return Rational (s1.value_i (), s2.value_i ());
39 Scalar::isnum_b () const
45 conv = sscanf (strh_.ch_C (), "%ld", &l);
47 return length_i () && conv;
50 Scalar::operator Real()
62 Scalar::operator int ()
77 Scalar::operator bool () const
83 Scalar::to_bool () const
90 if (u.upper_str () == "FALSE")
95 Scalar::Scalar(Matrix const &m)
100 Scalar::Scalar (Vector const &v)