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

Function ratio

week14/examples/error2.cpp:5–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <cfloat>
4
5bool ratio(float a, float b, float & c)
6{
7 if (fabs(a + b) < FLT_EPSILON)
8 {
9 std::cerr << "The sum of the two arguments is close to zero." << std::endl;
10 return false;
11 }
12 c = (a - b) / (a + b);
13 return true;
14}
15
16int main()
17{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected