Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
math.round
math.round(numericExpression, decimalPlaces)
Descrizione
Restituisce un valore arrotondato al numero intero più vicino o al numero di cifre decimali specificato.
Tipi di dati Param
NUMBER
Tipo restituito
NUMBER
Esempi di codice
math.round(10.7) // returns 11
math.round(1.2567, 2) // returns 1.25
math.round(0-10.7) // returns -11
math.round(0-1.2) // returns -1
math.round(4) // returns 4, math.round(integer) returns the integer
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-01-30 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-01-30 UTC."],[[["`math.round` function rounds a numeric value to the nearest integer or a specified number of decimal places."],["The function supports `NUMBER` as the input data type and returns a `NUMBER` type value."],["If no decimal places are specified, the function rounds to the nearest whole number."],["Negative values can be used and will be rounded accordingly to the nearest negative whole number or to the specified negative decimal place."],["The function is available within the context of `Search` as described in the documentation."]]],[]]