class_docstr: Creates a numeric field for user to enter numbers as input or display numeric output.
  Preprocessing: passes field value as a {float} or {int} into the function, depending on `precision`.
  Postprocessing: expects an {int} or {float} returned from the function and sets field value to it.
  Examples-format: a {float} or {int} representing the number's value.
  
  Demos: tax_calculator, titanic_survival, blocks_simple_squares
docstr: Round to a given precision.
  
  If precision is None, no rounding happens. If 0, num is converted to int.
  
  Parameters:
      num: Number to round.
      precision: Precision to round to.
  Returns:
      rounded number or the original number if precision is None
docstr_tok: ["Round","to","a","given","precision",".","If","precision","is","None",",","no","rounding","happens",".","If","0",",","num","is","converted","to","int",".","Parameters",":","num",":","Number","to","round",".","precision",":","Precision","to","round","to",".","Returns",":","rounded","number","or","the","original","number","if","precision","is","None"]
code: def _round_to_precision(
      num: float | int, precision: int | None
  ) -> float | int:
      """
      Round to a given precision.
  
      If precision is None, no rounding happens. If 0, num is converted to int.
  
      Parameters:
          num: Number to round.
          precision: Precision to round to.
      Returns:
          rounded number or the original number if precision is None
      """
      if precision is None:
          return num
      elif precision == 0:
          return int(round(num, precision))
      else:
          return round(num, precision)
  
file_path: gradio/gradio/components/number.py
imports: from __future__ import annotations
  from typing import Any, Callable
  from gradio_client.documentation import document, set_documentation_group
  from gradio.components.base import FormComponent
  from gradio.events import Events
  from gradio.exceptions import Error
label_desc: Use image node_id 2 for calling the Number obj's underlying member method code with example usage: obj._round_to_precision(num, precision) and returns: num, int, round