/// <summary>
 /// Rounds the specified digits.
 /// </summary>
 /// <typeparam name="TQuantity">The type of the quantity.</typeparam>
 /// <param name="quantity">The quantity.</param>
 /// <param name="digits">The digits.</param>
 /// <param name="midpointRounding">The midpoint rounding.</param>
 /// <returns>The rounded quantity.</returns>
 public static TQuantity Round <TQuantity>(
     this IQuantity <TQuantity> quantity,
     int digits,
     MidpointRounding midpointRounding)
 {
     CheckDigits(digits);
     return(quantity.CreateQuantity(Math.Round(quantity.Value, digits, midpointRounding), quantity.Unit));
 }
 /// <summary>
 /// Ceilings the specified quantity.
 /// </summary>
 /// <typeparam name="TQuantity">The type of the quantity.</typeparam>
 /// <param name="quantity">The quantity.</param>
 /// <returns> The smallest integer less than or equal to the specified <see cref="IQuantity"/>.</returns>
 public static TQuantity Ceiling <TQuantity>(this IQuantity <TQuantity> quantity)
 {
     return(quantity.CreateQuantity(Math.Ceiling(quantity.Value), quantity.Unit));
 }
 /// <summary>
 /// Floors the specified quantity.
 /// </summary>
 /// <typeparam name="TQuantity">The type of the quantity.</typeparam>
 /// <param name="quantity">The quantity.</param>
 /// <returns> The largest integer less than or equal to the specified <see cref="IQuantity"/>.</returns>
 public static TQuantity Floor <TQuantity>(this IQuantity <TQuantity> quantity)
 {
     return(quantity.CreateQuantity(Math.Floor(quantity.Value), quantity.Unit));
 }
 /// <summary>
 /// Rounds the specified quantity.
 /// </summary>
 /// <typeparam name="TQuantity">The type of the quantity.</typeparam>
 /// <param name="quantity">The quantity.</param>
 /// <returns>The rounded quantity.</returns>
 public static TQuantity Round <TQuantity>(this IQuantity <TQuantity> quantity)
 {
     return(quantity.CreateQuantity(Math.Round(quantity.Value), quantity.Unit));
 }
 /// <summary>
 /// Creates a new quantity.
 /// </summary>
 /// <typeparam name="TQuantity">The type of the quantity.</typeparam>
 /// <param name="quantity">The quantity.</param>
 /// <param name="newQuantity">The new quantity.</param>
 /// <returns>
 /// A new quantity.
 /// </returns>
 public static TQuantity CreateQuantity <TQuantity>(this IQuantity <TQuantity> quantity, IQuantity newQuantity)
 {
     return(quantity.CreateQuantity(newQuantity.Value, newQuantity.Unit));
 }