Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346/* __gmpz_operator_in_nowhite -- C++-style input of mpz_t, no whitespace skip.12Copyright 2001, 2003 Free Software Foundation, Inc.34This file is part of the GNU MP Library.56The GNU MP Library is free software; you can redistribute it and/or modify7it under the terms of either:89* the GNU Lesser General Public License as published by the Free10Software Foundation; either version 3 of the License, or (at your11option) any later version.1213or1415* the GNU General Public License as published by the Free Software16Foundation; either version 2 of the License, or (at your option) any17later version.1819or both in parallel, as here.2021The GNU MP Library is distributed in the hope that it will be useful, but22WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY23or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License24for more details.2526You should have received copies of the GNU General Public License and the27GNU Lesser General Public License along with the GNU MP Library. If not,28see https://www.gnu.org/licenses/. */2930#include <cctype>31#include <iostream>32#include <string>33#include "gmp.h"34#include "gmp-impl.h"3536using namespace std;373839// For g++ libstdc++ parsing see num_get<chartype,initer>::_M_extract_int in40// include/bits/locale_facets.tcc.4142istream &43__gmpz_operator_in_nowhite (istream &i, mpz_ptr z, char c)44{45int base;46string s;47bool ok = false, zero, showbase;4849if (c == '-' || c == '+') // sign50{51if (c == '-') // mpz_set_str doesn't accept '+'52s = "-";53i.get(c);54}5556base = __gmp_istream_set_base(i, c, zero, showbase); // select the base57__gmp_istream_set_digits(s, i, c, ok, base); // read the number5859if (i.good()) // last character read was non-numeric60i.putback(c);61else if (i.eof() && (ok || zero)) // stopped just before eof62i.clear(ios::eofbit);6364if (ok)65ASSERT_NOCARRY (mpz_set_str (z, s.c_str(), base)); // extract the number66else if (zero)67mpz_set_ui(z, 0);68else69i.setstate(ios::failbit); // read failed7071return i;72}737475