The `floorToDouble` method returns the greatest integer double value no greater than the given double.
The syntax of double.floorToDouble() method is:
double floorToDouble()
This floorToDouble() method of double returns the greatest integer double value no greater than this
.
double.floorToDouble() returns value of type double
.
In this example,
num
with a value of 3.14
.floorToDouble()
method on num
to find its floor value.void main() {
double num = 3.14;
double floorValue = num.floorToDouble();
print('Floor value of 3.14: $floorValue');
}
Floor value of 3.14: 3
In this example,
num
with a value of -5.6
.floorToDouble()
method on num
to find its floor value.void main() {
double num = -5.6;
double floorValue = num.floorToDouble();
print('Floor value of -5.6: $floorValue');
}
Floor value of -5.6: -6
In this example,
num
with a value of 10.0
.floorToDouble()
method on num
to find its floor value.void main() {
double num = 10.0;
double floorValue = num.floorToDouble();
print('Floor value of 10.0: $floorValue');
}
Floor value of 10.0: 10
In this Dart tutorial, we learned about floorToDouble() method of double: the syntax and few working examples with output and detailed explanation for each example.