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/* gmp_errno, __gmp_exception -- exception handling and reporting.12THE FUNCTIONS IN THIS FILE, APART FROM gmp_errno, ARE FOR INTERNAL USE3ONLY. THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR4DISAPPEAR COMPLETELY IN FUTURE GNU MP RELEASES.56Copyright 2000, 2001, 2003 Free Software Foundation, Inc.78This file is part of the GNU MP Library.910The GNU MP Library is free software; you can redistribute it and/or modify11it under the terms of either:1213* the GNU Lesser General Public License as published by the Free14Software Foundation; either version 3 of the License, or (at your15option) any later version.1617or1819* the GNU General Public License as published by the Free Software20Foundation; either version 2 of the License, or (at your option) any21later version.2223or both in parallel, as here.2425The GNU MP Library is distributed in the hope that it will be useful, but26WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY27or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License28for more details.2930You should have received copies of the GNU General Public License and the31GNU Lesser General Public License along with the GNU MP Library. If not,32see https://www.gnu.org/licenses/. */3334#include <stdlib.h>35#include "gmp.h"36#include "gmp-impl.h"3738int gmp_errno = 0;394041/* The deliberate divide by zero triggers an exception on most systems. On42those where it doesn't, for example power and powerpc, use abort instead.4344Enhancement: Perhaps raise(SIGFPE) (or the same with kill()) would be45better than abort. Perhaps it'd be possible to get the BSD style46FPE_INTDIV_TRAP parameter in there too. */4748void49__gmp_exception (int error_bit)50{51gmp_errno |= error_bit;52__gmp_junk = 10 / __gmp_0;53abort ();54}555657/* These functions minimize the amount of code required in functions raising58exceptions. Since they're "noreturn" and don't take any parameters, a59test and call might even come out as a simple conditional jump. */60void61__gmp_sqrt_of_negative (void)62{63__gmp_exception (GMP_ERROR_SQRT_OF_NEGATIVE);64}65void66__gmp_divide_by_zero (void)67{68__gmp_exception (GMP_ERROR_DIVISION_BY_ZERO);69}707172