MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / ratio

Function ratio

week14/examples/error5.cpp:5–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <cfloat>
4
5float 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
17float ratio_wrapper(float a, float b)
18{

Callers 1

ratio_wrapperFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected