The R Project SVN R

Rev

Rev 59167 | Rev 64656 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59167 Rev 59170
Line 1... Line 1...
1
/*
1
/*
2
 *  Mathlib : A C Library of Special Functions
2
 *  Mathlib : A C Library of Special Functions
3
 *  Copyright (C) 1998 Ross Ihaka
3
 *  Copyright (C) 1998 Ross Ihaka
4
 *  Copyright (C) 2000-11 The R Core Team
4
 *  Copyright (C) 2000-12 The R Core Team
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 69... Line 69...
69
double fprec(double x, double digits)
69
double fprec(double x, double digits)
70
{
70
{
71
    double l10, pow10, sgn, p10, P10;
71
    double l10, pow10, sgn, p10, P10;
72
    int e10, e2, do_round, dig;
72
    int e10, e2, do_round, dig;
73
    /* Max.expon. of 10 (=308.2547) */
73
    /* Max.expon. of 10 (=308.2547) */
74
    const static int max10e = DBL_MAX_EXP * M_LOG10_2;
74
    const static int max10e = (int) (DBL_MAX_EXP * M_LOG10_2);
75
 
75
 
76
    if (ISNAN(x) || ISNAN(digits))
76
    if (ISNAN(x) || ISNAN(digits))
77
	return x + digits;
77
	return x + digits;
78
    if (!R_FINITE(x)) return x;
78
    if (!R_FINITE(x)) return x;
79
    if (!R_FINITE(digits)) {
79
    if (!R_FINITE(digits)) {