Arrondir un nombre à deux décimales

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #235851 quote
    Lifen
    Participant
    Senior

    Bonjour,

    J’aurais besoin d’aide pour arrondir un nombre à deux décimales après l’avoir mis au carré.

    Comment codez-vous cela ?

    sqr(x) =>
    math.round(x * x * 100) / 100
    two_dec(x) =>
    math.round(x * 100) / 100

    Merci de votre aide

    #235855 quote
    jacquesgermain
    Participant
    Senior

    Bonjour

    par exemple :

    c100=3.642*3.642
    c101=(round(c100*100)/100)

    c101 donne l’arrondi à 2 décimales de C100

    Lifen thanked this post
    #235857 quote
    druby
    Participant
    New

     

    // ROUND( var, dp )  dp = 0 - 6
    
    X = 3.642
    
    sqrX2 = round(sqr(x),2)
    
    return sqrX2
    Lifen and Iván González thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Arrondir un nombre à deux décimales


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Lifen @lifen Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by druby
1 year, 6 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 07/28/2024
Status: Active
Attachments: No files
Logo Logo
Loading...