Imposer des multiples de 4

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

    Bonjour,

    J’établis un valeur de début avec

    once début = high

    Parfait

    Maintenant, je voudrais que ce début se place sur le multiple de 4 le plus proche.

    J’ai fait quelques essais avec Modulo, mais sans succès.

    Si quelqu’un a une idée…..

    Merci d’avance

    #199017 quote
    JC_Bywan
    Moderator
    Master

    Là je l’ai mis avec “chaque” high pour tester, mais si tu ne veux que le tout premier high de barindex=0, tu peux rajouter once:

    debut= high
    
    reste=debut mod 4
    
    if reste>=2 then
    debut=4*floor(debut/4)+4
    else
    debut=4*floor(debut/4)
    endif
    
    return debut
    #199030 quote
    Lurubu
    Participant
    Senior

    Super !

    Mais il est inutile de rajouter 4, comme cela le résultat est immédiatement proche du high initial.

    Merci beaucoup.

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

Imposer des multiples de 4


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Lurubu @lurubu Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Lurubu
3 years, 7 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 08/13/2022
Status: Active
Attachments: No files
Logo Logo
Loading...