mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
changed C source to use C booleans with backward compatibility
Fix "Under source code control" date for new version.h file. Sorted the order of symbols printed by "make env". Test if <stdbool.h> exists and set HAVE_STDBOOL_H accordingly in have_stdbool.h. Added HAVE_STDBOOL_H to allow one to force this value. Added "bool.h" include file to support use of boolean symbols, true and false for pre-c99 C compilers. The "bool.h" include file defines TRUE as true, FALSE as false, and BOOL as bool: for backward compatibility. The sign in a ZVALUE is now of type SIGN, whcih is either SB32 when CALC2_COMPAT is defined, or a bool. Replaced in C source, TRUE with true, FALSE with false, and BOOL with bool.
This commit is contained in:
12
qmod.c
12
qmod.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qmod - modular arithmetic routines for normal numbers and REDC numbers
|
||||
*
|
||||
* Copyright (C) 1999-2007,2021,2022 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2021-2023 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -110,7 +110,7 @@ qmod(NUMBER *q1, NUMBER *q2, long rnd)
|
||||
* If rnd is zero, the remainder has the sign of q2
|
||||
* and the quotient is rounded towards zero.
|
||||
*
|
||||
* The function returns TRUE or FALSE according as the remainder is
|
||||
* The function returns true or false according as the remainder is
|
||||
* nonzero or zero
|
||||
*
|
||||
* Given:
|
||||
@@ -120,7 +120,7 @@ qmod(NUMBER *q1, NUMBER *q2, long rnd)
|
||||
* mod remainder
|
||||
* rnd rounding-type specifier
|
||||
*/
|
||||
BOOL
|
||||
bool
|
||||
qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd)
|
||||
{
|
||||
NUMBER *qq, *qm;
|
||||
@@ -181,9 +181,9 @@ qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd)
|
||||
|
||||
/*
|
||||
* Return whether or not two integers are congruent modulo a third integer.
|
||||
* Returns TRUE if the numbers are not congruent, and FALSE if they are.
|
||||
* Returns true if the numbers are not congruent, and false if they are.
|
||||
*/
|
||||
BOOL
|
||||
bool
|
||||
qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3)
|
||||
{
|
||||
if (qisneg(q3) || qiszero(q3))
|
||||
@@ -191,7 +191,7 @@ qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3)
|
||||
if (qisfrac(q1) || qisfrac(q2) || qisfrac(q3))
|
||||
math_error("Non-integers for qcmpmod");
|
||||
if (q1 == q2)
|
||||
return FALSE;
|
||||
return false;
|
||||
return zcmpmod(q1->num, q2->num, q3->num);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user