2 scalar.cc -- implement Scalar
4 source file of the Flower Library
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
12 #include "rational.hh"
14 Scalar::Scalar (Rational r)
19 Scalar::operator Rational ()
21 int p = index_i ('/');
25 String s2 = right_str (length_i ()-p-1);
26 String s1 = left_str (p);
28 return Rational (s1.value_i (), s2.value_i ());
32 Scalar::isnum_b () const
38 conv = sscanf (strh_.ch_C (), "%ld", &l);
40 return length_i () && conv;
43 Scalar::operator Real()
49 Scalar::operator int()
59 Scalar::operator bool () const
66 if (u.upper_str () == "FALSE")