diff options
author | Marius Vollmer <mvo@zagadka.de> | 2004-07-23 15:43:02 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2004-07-23 15:43:02 +0000 |
commit | e11e83f3d99305ada6354cae7123fb8c0e998703 (patch) | |
tree | 23dccd2a0fd1741abb8561214acadc347036480b /libguile/random.c | |
parent | 928e0f421070bb610f3375d5808a6378d5edfa1b (diff) | |
download | guile-e11e83f3d99305ada6354cae7123fb8c0e998703.tar.gz |
* deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,
SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP
and SCM_I_INUM, respectively and adding deprecated versions to
deprecated.h and deprecated.c. Changed all uses to either use the
SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
Diffstat (limited to 'libguile/random.c')
-rw-r--r-- | libguile/random.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libguile/random.c b/libguile/random.c index a6ad9aae8..e98794ca4 100644 --- a/libguile/random.c +++ b/libguile/random.c @@ -349,11 +349,11 @@ SCM_DEFINE (scm_random, "random", 1, 1, 0, if (SCM_UNBNDP (state)) state = SCM_VARIABLE_REF (scm_var_random_state); SCM_VALIDATE_RSTATE (2, state); - if (SCM_INUMP (n)) + if (SCM_I_INUMP (n)) { - unsigned long m = SCM_INUM (n); + unsigned long m = SCM_I_INUM (n); SCM_ASSERT_RANGE (1, n, m > 0); - return SCM_I_MAKINUM (scm_c_random (SCM_RSTATE (state), m)); + return scm_from_ulong (scm_c_random (SCM_RSTATE (state), m)); } SCM_VALIDATE_NIM (1, n); if (SCM_REALP (n)) @@ -424,7 +424,7 @@ SCM_DEFINE (scm_random_normal, "random:normal", 0, 1, 0, static void vector_scale (SCM v, double c) { - int n = SCM_INUM (scm_uniform_vector_length (v)); + int n = scm_to_int (scm_uniform_vector_length (v)); if (SCM_VECTORP (v)) while (--n >= 0) SCM_REAL_VALUE (SCM_VELTS (v)[n]) *= c; @@ -437,7 +437,7 @@ static double vector_sum_squares (SCM v) { double x, sum = 0.0; - int n = SCM_INUM (scm_uniform_vector_length (v)); + int n = scm_to_int (scm_uniform_vector_length (v)); if (SCM_VECTORP (v)) while (--n >= 0) { @@ -475,7 +475,7 @@ SCM_DEFINE (scm_random_solid_sphere_x, "random:solid-sphere!", 1, 1, 0, scm_random_normal_vector_x (v, state); vector_scale (v, pow (scm_c_uniform01 (SCM_RSTATE (state)), - 1.0 / SCM_INUM (scm_uniform_vector_length (v))) + 1.0 / scm_to_int (scm_uniform_vector_length (v))) / sqrt (vector_sum_squares (v))); return SCM_UNSPECIFIED; } @@ -514,7 +514,7 @@ SCM_DEFINE (scm_random_normal_vector_x, "random:normal-vector!", 1, 1, 0, if (SCM_UNBNDP (state)) state = SCM_VARIABLE_REF (scm_var_random_state); SCM_VALIDATE_RSTATE (2, state); - n = SCM_INUM (scm_uniform_vector_length (v)); + n = scm_to_int (scm_uniform_vector_length (v)); if (SCM_VECTORP (v)) while (--n >= 0) SCM_VECTOR_SET (v, n, scm_make_real (scm_c_normal01 (SCM_RSTATE (state)))); |