Arrondir un nombre à deux décimales

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #235851 quote
    LifenLifen
    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
    jacquesgermainjacquesgermain
    Participant
    Veteran

    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
    drubydruby
    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.
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

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 drubydruby
2 years, 1 month ago.

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