Arrotondare un valore decimale di tre cifre dopo la virgola

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #203947 quote
    byT77byT77
    Participant
    New

    Buongiorno,

    Vi chiedo gentilmente, come potrei arrotondare un valore decimale massimo di tre cifre dopo la virgola.

    Esempio: valore reale 1,25678 – valore arrotondato 1,257

    Grazie mille

    #203957 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Esistono tre istruzioni:

    ROUND(n1,n2)   n1=valore da arrotondare,  n2=numero di cifre decimali da considerare (se omesso, oppure è 0, vengono eliminate le cifre decimali)
    .                                arrotonda sempre all’intero più vicino fino a 0.4, da 0,5 in poi a quello più lontano
    .                                      round(7.4)   diventa 7
    .                                      round(7.5)   diventa 8
    .                                      round(-7.4) diventa -7
    .                                      round(-7.5) diventa -8

    FLOOR(n1,n2)   n1=valore da arrotondare,  n2=numero di cifre decimali da considerare (se omesso, oppure è 0, vengono eliminate le cifre decimali)
    .                                arrotonda sempre all’intero più piccolo
    .                                      floor(7.4)   diventa 7
    .                                      floor(7.5)   diventa 7
    .                                      floor(-7.4) diventa -8
    .                                      floor(-7.5) diventa -8

    CEIL(n1,n2)     n1=valore da arrotondare,  n2=numero di cifre decimali da considerare (se omesso, oppure è 0, vengono eliminate le cifre decimali)
    .                                arrotonda sempre all’intero più grande
    .                                      ceil(7.4)   diventa 8
    .                                      ceil(7.5)   diventa 8
    .                                      ceil(-7.4) diventa -7
    .                                      ceil(-7.5) diventa -7

    #203958 quote
    byT77byT77
    Participant
    New

    Grazie e gentile come sempre.

    #203961 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Scusami la svista, nelle istruzioni avevo sempre indicato ROUND, l’ho modificate come devono essere.

    #203963 quote
    byT77byT77
    Participant
    New

    Grazie mille, davvero gentile.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Arrotondare un valore decimale di tre cifre dopo la virgola


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
byT77 @byt77 Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by byT77byT77
3 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 11/10/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...