* Generate small hexadecimal floating point constants */
| 192 | * Generate small hexadecimal floating point constants |
| 193 | */ |
| 194 | static string |
| 195 | GenerateSmallRandomFloatHexConstant(int num) |
| 196 | { |
| 197 | ostringstream oss; |
| 198 | if (num >= 0) { |
| 199 | oss << "0x"; |
| 200 | } |
| 201 | else { |
| 202 | oss << "-0x"; |
| 203 | num = -num; |
| 204 | } |
| 205 | oss << num << "." << RandomHexDigits(1) << "p"; |
| 206 | |
| 207 | if (pure_rnd_flipcoin(50)) { |
| 208 | oss << "+1"; |
| 209 | } |
| 210 | else { |
| 211 | oss << "-1"; |
| 212 | } |
| 213 | return oss.str(); |
| 214 | } |
| 215 | |
| 216 | static string |
| 217 | GenerateRandomConstantInRange(const Type* type, int bound) |
no test coverage detected