The fdim() function takes two arguments and returns the positive difference between first and second argument.
This function returns a-b if a>b otherwise returns 0. where, a is the first argument and b
is the second argument.
double fdim(double a, double b); float fdim(float a, float b);
The fdim() function takes two arguments a and b, where, a is the first argument and b is the second argument.
This function returns a-b if a>b otherwise returns 0.
It is mandatory to give both the arguments otherwise it will give error no matching function for call to 'fdim()' like this.
Inuput : fdim(2.0, 1.0) Output : 1 Inuput : fdim(-2.0, 1.0) Output : 0
# CODE 1
fdim of (2.0, 1.0) is 1 fdim of (1.0, 2.0) is 0 fdim of (-2.0, -1.0) is 0 fdim of (-1.0, -2.0) is 1
# CODE 2
fdim of (5.0, 4.0) is 1 fdim of (4.0, 5.0) is 0 fdim of (-5.0, -4.0) is 0 fdim of (-4.0, -5.0) is 1
- cin get() in C++ with Examples
- Difference between Increment and Decrement Operators
- Map of Vectors in C++ STL with Examples
- Problem in comparing Floating point numbers and how to compare them correctly?
- exit(0) vs exit(1) in C/C++ with Examples
- Control Structures in Programming Languages
- I Can't Use Logic In Programming. What Should I Do?
- 7 Tips To Write Clean And Better Code in 2020
- C++ program to print all Even and Odd numbers from 1 to N
- Reverse the content of a file and store it in another
- I Can’t Do Computer Programming – 7 Common Myths You Must Know
- Find all the possible remainders when N is divided by all positive integers from 1 to N+1
- Minimum cells to be flipped to get a 2*2 submatrix with equal elements
- Nested Loops in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.