| 3 | #include <cfloat> |
| 4 | |
| 5 | float ratio(float a, float b) |
| 6 | { |
| 7 | if (a < 0) |
| 8 | throw 1; |
| 9 | if (b < 0) |
| 10 | throw 2; |
| 11 | if (fabs(a + b) < FLT_EPSILON) |
| 12 | throw "The sum of the two arguments is close to zero."; |
| 13 | |
| 14 | return (a - b) / (a + b); |
| 15 | } |
| 16 | |
| 17 | float ratio_wrapper(float a, float b) |
| 18 | { |