10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
* 'double' and 'mp_int' types.
*
* Copyright (c) 2005 by Kevin B. Kenny. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclStrToD.c,v 1.48 2010/11/29 02:27:11 kennykb Exp $
*
*----------------------------------------------------------------------
*/
#include "tclInt.h"
#include "tommath.h"
#include <math.h>
|
|
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
* 'double' and 'mp_int' types.
*
* Copyright (c) 2005 by Kevin B. Kenny. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclStrToD.c,v 1.49 2010/12/01 09:58:51 nijtmans Exp $
*
*----------------------------------------------------------------------
*/
#include "tclInt.h"
#include "tommath.h"
#include <math.h>
|
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
|
ShouldBankerRoundUpPowD(mp_int* b,
/* Numerator of the fraction */
int sd, /* Denominator is 2**(sd*DIGIT_BIT) */
int isodd)
/* 1 if the digit is odd, 0 if even */
{
int i;
const static mp_digit topbit = (1<<(DIGIT_BIT-1));
if (b->used < sd || (b->dp[sd-1] & topbit) == 0) {
return 0;
}
if (b->dp[sd-1] != topbit) {
return 1;
}
for (i = sd-2; i >= 0; --i) {
|
|
|
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
|
ShouldBankerRoundUpPowD(mp_int* b,
/* Numerator of the fraction */
int sd, /* Denominator is 2**(sd*DIGIT_BIT) */
int isodd)
/* 1 if the digit is odd, 0 if even */
{
int i;
static const mp_digit topbit = (1<<(DIGIT_BIT-1));
if (b->used < sd || (b->dp[sd-1] & topbit) == 0) {
return 0;
}
if (b->dp[sd-1] != topbit) {
return 1;
}
for (i = sd-2; i >= 0; --i) {
|