~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to deps/Rmath/src/rhyper.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-02-06 17:54:29 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130206175429-13br5kqpkfjqdmre
Tags: 0.0.0+20130206.git32ff5759-1
* New upstream snapshot.
* debian/copyright: reflect upstream changes
* debian/rules: update get-orig-source to reflect upstream changes
   + Don't ship nginx
   + Adapt for new configure-random target in deps/Makefile
* Enable build of Tk wrapper.
   + debian/control: add build dependency on tk-dev
   + debian/rules: add tk rule to build-arch
* debian/julia.install: install VERSION and COMMIT files
* no-webrepl.patch: new patch
* Refresh other patches
* Add source override for config.status file under deps/random/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  Mathlib : A C Library of Special Functions
3
3
 *  Copyright (C) 1998 Ross Ihaka
4
 
 *  Copyright (C) 2000-2001 The R Development Core Team
 
4
 *  Copyright (C) 2000-2012 The R Core Team
5
5
 *  Copyright (C) 2005  The R Foundation
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
111
111
    if(!R_FINITE(nn1in) || !R_FINITE(nn2in) || !R_FINITE(kkin))
112
112
        ML_ERR_return_NAN;
113
113
 
114
 
    nn1 = floor(nn1in+0.5);
115
 
    nn2 = floor(nn2in+0.5);
116
 
    kk  = floor(kkin +0.5);
 
114
    nn1 = (int) floor(nn1in+0.5);
 
115
    nn2 = (int) floor(nn2in+0.5);
 
116
    kk  = (int) floor(kkin +0.5);
117
117
 
118
118
    if (nn1 < 0 || nn2 < 0 || kk < 0 || kk > nn1 + nn2)
119
119
        ML_ERR_return_NAN;
142
142
    if (setup2) {
143
143
        ks = kk;
144
144
        if (kk + kk >= tn) {
145
 
            k = tn - kk;
 
145
            k = (int)(tn - kk);
146
146
        } else {
147
147
            k = kk;
148
148
        }
149
149
    }
150
150
    if (setup1 || setup2) {
151
 
        m = (k + 1.0) * (n1 + 1.0) / (tn + 2.0);
 
151
        m = (int) ((k + 1.0) * (n1 + 1.0) / (tn + 2.0));
152
152
        minjx = imax2(0, k - n2);
153
153
        maxjx = imin2(n1, k);
154
154
    }
225
225
        u = unif_rand() * p3;
226
226
        v = unif_rand();
227
227
        if (u < p1) {           /* rectangular region */
228
 
            ix = xl + u;
 
228
            ix = (int) (xl + u);
229
229
        } else if (u <= p2) {   /* left tail */
230
 
            ix = xl + log(v) / lamdl;
 
230
            ix = (int) (xl + log(v) / lamdl);
231
231
            if (ix < minjx)
232
232
                goto L30;
233
233
            v = v * (u - p1) * lamdl;
234
234
        } else {                /* right tail */
235
 
            ix = xr - log(v) / lamdr;
 
235
            ix = (int) (xr - log(v) / lamdr);
236
236
            if (ix > maxjx)
237
237
                goto L30;
238
238
            v = v * (u - p2) * lamdr;