GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/* __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 the GNU Lesser General Public License as published by8the Free Software Foundation; either version 2.1 of the License, or (at your9option) any later version.1011The GNU MP Library is distributed in the hope that it will be useful, but12WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY13or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public14License for more details.1516You should have received a copy of the GNU Lesser General Public License17along with the GNU MP Library; see the file COPYING.LIB. If not, write to18the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,19MA 02110-1301, USA. */2021#include <cctype>22#include <iostream>23#include <string>24#include "gmp.h"25#include "gmp-impl.h"2627using namespace std;282930// For g++ libstdc++ parsing see num_get<chartype,initer>::_M_extract_int in31// include/bits/locale_facets.tcc.3233istream &34__gmpz_operator_in_nowhite (istream &i, mpz_ptr z, char c)35{36int base;37string s;38bool ok = false, zero, showbase;3940if (c == '-' || c == '+') // sign41{42if (c == '-') // mpz_set_str doesn't accept '+'43s = "-";44i.get(c);45}4647base = __gmp_istream_set_base(i, c, zero, showbase); // select the base48__gmp_istream_set_digits(s, i, c, ok, base); // read the number4950if (i.good()) // last character read was non-numeric51i.putback(c);52else if (i.eof() && (ok || zero)) // stopped just before eof53i.clear();5455if (ok)56ASSERT_NOCARRY (mpz_set_str (z, s.c_str(), base)); // extract the number57else if (zero)58mpz_set_ui(z, 0);59else60i.setstate(ios::failbit); // read failed6162return i;63}646566