|
1 | 1 | //! A generator that checks a handful of cases near infinities, zeros, asymptotes, and NaNs.
|
2 | 2 |
|
3 |
| -use libm::support::{CastInto, Float, Int}; |
| 3 | +use libm::support::{CastInto, Float, Int, MinInt}; |
4 | 4 |
|
5 | 5 | use crate::domain::get_domain;
|
6 | 6 | use crate::gen::KnownSize;
|
| 7 | +use crate::op::OpITy; |
7 | 8 | use crate::run_cfg::{check_near_count, check_point_count};
|
8 | 9 | use crate::{BaseName, CheckCtx, FloatExt, FloatTy, MathOp, test_log};
|
9 | 10 |
|
|
21 | 22 | Op: MathOp,
|
22 | 23 | {
|
23 | 24 | let mut ret = Vec::new();
|
| 25 | + let one = OpITy::<Op>::ONE; |
24 | 26 | let values = &mut ret;
|
25 | 27 | let domain = get_domain::<_, i8>(ctx.fn_ident, argnum).unwrap_float();
|
26 | 28 | let domain_start = domain.range_start();
|
|
51 | 53 | values.push(Op::FTy::NAN);
|
52 | 54 | values.extend(Op::FTy::consts().iter());
|
53 | 55 |
|
| 56 | + // Check around the maximum subnormal value |
| 57 | + let sub_max = Op::FTy::from_bits(Op::FTy::SIG_MASK); |
| 58 | + count_up(sub_max, near_points, values); |
| 59 | + count_down(sub_max, near_points, values); |
| 60 | + count_up(-sub_max, near_points, values); |
| 61 | + count_down(-sub_max, near_points, values); |
| 62 | + |
| 63 | + // Check a few values around the subnormal range |
| 64 | + for shift in (0..Op::FTy::SIG_BITS).step_by(Op::FTy::SIG_BITS as usize / 5) { |
| 65 | + let v = Op::FTy::from_bits(one << shift); |
| 66 | + count_up(v, 2, values); |
| 67 | + count_down(v, 2, values); |
| 68 | + count_up(-v, 2, values); |
| 69 | + count_down(-v, 2, values); |
| 70 | + } |
| 71 | + |
54 | 72 | // Check around asymptotes
|
55 | 73 | if let Some(f) = domain.check_points {
|
56 | 74 | let iter = f();
|
|
0 commit comments