comparison liboctave/Range.cc @ 1555:6935e817fd25

[project @ 1995-10-11 05:49:55 by jwe]
author jwe
date Wed, 11 Oct 1995 05:49:55 +0000
parents 3c89376f951f
children 1281a23a34dd
comparison
equal deleted inserted replaced
1554:b1ba1894bccc 1555:6935e817fd25
192 t1 = (ct / q) * (t1 < 0.0 ? -t1 : t1); 192 t1 = (ct / q) * (t1 < 0.0 ? -t1 : t1);
193 t1 = rmax < t1 ? rmax : t1; 193 t1 = rmax < t1 ? rmax : t1;
194 t1 = ct > t1 ? ct : t1; 194 t1 = ct > t1 ? ct : t1;
195 t1 = floor (x + t1); 195 t1 = floor (x + t1);
196 196
197 if (x <= 0.0 || t1 - x < rmax) 197 if (x <= 0.0 || (t1 - x) < rmax)
198 return t1; 198 return t1;
199 else 199 else
200 return t1 - 1.0; 200 return t1 - 1.0;
201 } 201 }
202 202
215 int 215 int
216 Range::nelem_internal (void) const 216 Range::nelem_internal (void) const
217 { 217 {
218 double ct = 3.0 * DBL_EPSILON; 218 double ct = 3.0 * DBL_EPSILON;
219 219
220 double tmp = round ((rng_limit - rng_base + rng_inc) / rng_inc, ct); 220 double tmp = tfloor ((rng_limit - rng_base + rng_inc) / rng_inc, ct);
221 221
222 int n_intervals = (int) (tmp > 0.0 ? tmp : 0); 222 int n_intervals = (int) (tmp > 0.0 ? tmp : 0);
223 223
224 return (n_intervals >= INT_MAX - 1) ? -1 : n_intervals; 224 return (n_intervals >= INT_MAX - 1) ? -1 : n_intervals;
225 } 225 }