How to get the nearest smallest value greater than or equal to a number in Swift

1 Answer

0 votes
import Foundation

print(ceil(5.0));
print(ceil(-5.0));

print(ceil(1.56));
print(ceil(1.55));
print(ceil(1.54));

print(ceil(-3.56));
print(ceil(-3.55));
print(ceil(-3.54));



 
/*
run:
 
5.0
-5.0
2.0
2.0
2.0
-3.0
-3.0
-3.0

*/

 



answered Jun 14, 2023 by avibootz
...