Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c

What is floorl() in C?

Muhammad Ashir

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

floorl() computes the largest integer value not greater than the given argument.

Prototype

long double floorl( long double arg );

Parameters

arg:

  • The floating-point number of type long double

Returns

  • If no errors occur, then the largest integer value less than arg is returned as a long double.

Example Code

The following code shows how the floorl() function can be used with different arguments:

#include<stdio.h>
#include<math.h>
int main() {
printf("Arg = %Lf\n", floorl(-2021.2020));
printf("Arg = %Lf\n", floorl(+2021.2020));
printf("Arg = %Lf\n", floorl(INFINITY));
printf("Arg = %Lf\n", floorl(-INFINITY));
printf("Arg = %Lf\n", floorl(-0.0));
return 0;
}

RELATED TAGS

c

CONTRIBUTOR

Muhammad Ashir
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring