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 ()
22 int p = index_i ('/');
26 String s2 = right_str (length_i ()-p-1);
27 String s1 = left_str (p);
29 return Rational (s1.value_i (), s2.value_i ());
33 Scalar::isnum_b () const
39 conv = sscanf (strh_.ch_C (), "%ld", &l);
41 return length_i () && conv;
44 Scalar::operator Real()
50 Scalar::operator int()
59 Scalar::operator bool () const
65 Scalar::to_bool () const
72 if (u.upper_str () == "FALSE")
77 Scalar::Scalar(Matrix const &m)
82 Scalar::Scalar (Vector const &v)