Ceil

A function common to many programming languages that returns the next integer value by rounding the value up if necessary.

Floor

A function common to many programming languages that returns the next lowest integer value by rounding the value down if necessary.

Fractions direction std

Example |
---|

"Now if floor is from question Optimizing a simple 2D Tile engine (+potential bugfix) |

"So floor from question To find an element with nearest lower and greater value in MATLAB |

"On the other hand if what you want to do is not rounding but elimination of fractions into one direction then you have std ceil that goes from question How to round off the totalcost (double) to nearest inetegrs |

Others

Example |
---|

The floor times the ceil are from question Proving with floor and ceiling functions formally for computer scientists Works because ceil a b is always one from question Java rounding up to an int using Math.ceil |

5 so you have to from question Finding floor and ceil of every element after inserted into array efficiently |

But full floating point division and ceil is more expensive than necessary;instead since c defines from question Practice computing grid size for CUDA |

A simple function to follow would be if from question Delete digits after two decimal points, without rounding the value |

To stop the confusion on this page actually this is the best answer which is fast and works for both positive and negative values of x i ran speed tests of 10 million computations on php 7.2.15 and even though both solutions give the same results fmod is from question What's the best way to get the fractional part of a float in PHP? |