possibly-wrong/precision

From string

Closed this issue · 5 comments

Sometimes the numbers I have to store won't fit in an int, for example I wanted to store 0.06161151953125 so I had to do some weird tricks:

(math::Rational(22532213, 256000000) * 7) / 10

I don't even know if this will turn out to be the number that I want.

Is there any way to convert a string to a rational?

Nevermind...

Rational(const std::string& s) :

image
image
???

Thanks for finding this, most recent commit fixes this. The unsigned and signed integer stream I/O is relatively old and has actually seen some use, but the rational I/O was new and hadn't seen as much testing.

Ty! I'll test and close if the issue disappears

Works fine with both std::string("###") (where ### is any int) and std::string("###/###")