57     if (as.
nelem() == 1) {
    58       nom = strtol(s.c_str(), &endptr, 10);
    59       if (endptr != s.c_str() + s.nelem())
    60         throw std::runtime_error(
"Error parsing rational number");
    62     } 
else if (as.
nelem() == 2) {
    63       nom = strtol(as[0].c_str(), &endptr, 10);
    64       if (endptr != as[0].c_str() + as[0].
nelem())
    65         throw std::runtime_error(
"Error parsing rational number nominator");
    66       denom = strtol(as[1].c_str(), &endptr, 10);
    67       if (endptr != as[1].c_str() + as[1].
nelem())
    68         throw std::runtime_error(
"Error parsing rational number denominator");
    71       throw std::runtime_error(
"Error parsing rational number");
    72   } 
catch (
const std::runtime_error& e) {
    74     os << 
"Error parsing rational number: " << s << std::endl;
    76     throw std::runtime_error(os.str());
    85   auto len = s.length();
    88     auto dot_pos = s.find(
".");
    89     auto slash_pos = s.find(
"/");
    92     } 
else if (len > slash_pos) {
    93       *
this = 
Rational(std::stoi(s.substr(0, slash_pos)),
    94                        std::stoi(s.substr(slash_pos + 1, len)));
 INDEX Index
The type to use for all integer numbers and indices. 
 
#define RATIONAL_UNDEFINED
 
Index nelem() const
Number of elements. 
 
constexpr Index Nom() const
Nominator. 
 
constexpr Rational(const Index nom=0, const Index denom=1)
Initialization call. 
 
constexpr Rational reduce_by_gcd(const Rational a)
Returns the rational reduced by the greates. 
 
constexpr Rational & fixSign()
Makes the sign of mdenom positive. 
 
std::istream & operator>>(std::istream &is, Rational &a)
Input operator. 
 
Implements rational numbers to work with other ARTS types. 
 
constexpr Index Denom() const
Denominator. 
 
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
 
This can be used to make arrays out of anything. 
 
constexpr Rational numeric2rational(Numeric x, size_t maxdec=4)
Rational from Numeric. 
 
Index nelem(const Lines &l)
Number of lines. 
 
Contains the rational class definition. 
 
void simplify_in_place()
Simplify by reducing the values locally. 
 
std::ostream & operator<<(std::ostream &os, const Rational &a)
Output operator. 
 
This file contains the definition of String, the ARTS string class.