View source code
							
							
						
								Display the source code in std/math/rounding.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Module std.math.rounding
This is a submodule of std.
It contains several functions for rounding floating point numbers.
Functions
| Name | Description | 
|---|---|
| 
									ceil(x)
								 | Returns the value of x rounded upward to the next integer (toward positive infinity). | 
| 
									floor(x)
								 | Returns the value of x rounded downward to the next integer (toward negative infinity). | 
| 
									lrint(x)
								 | Rounds x to the nearest integer value, using the current rounding mode. | 
| 
									lround(x)
								 | Return the value of x rounded to the nearest integer. | 
| 
									nearbyint(x)
								 | Rounds x to the nearest integer value, using the current rounding mode. | 
| 
									quantize(val, unit)
								 | Round valto a multiple ofunit.rfuncspecifies the rounding
 function to use; by default this isrint, which uses the current
 rounding mode. | 
| 
									quantize(val, exp)
								 | Round valto a multiple ofpow(base, exp).rfuncspecifies the
 rounding function to use; by default this isrint, which uses the
 current rounding mode. | 
| 
									rint(x)
								 | Rounds x to the nearest integer value, using the current rounding mode. | 
| 
									rndtol(x)
								 | Returns x rounded to a long value using the current rounding mode. If the integer value of x is greater than long.max, the result is indeterminate. | 
| 
									round(x)
								 | Return the value of x rounded to the nearest integer. If the fractional part of x is exactly 0.5, the return value is rounded away from zero. | 
| 
									trunc(x)
								 | Returns the integer portion of x, dropping the fractional portion.
 This is also known as "chop" rounding. pureon all platforms. | 
Authors
Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw and David Nadlinger
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.