Epractical Posted June 17, 2006 Share Posted June 17, 2006 Bonjour, Voila j'ai cherché sur le net et j'ai trouvé la fonction Math.round pour arrondir, le problème est qu'il arrondis à l'unité près moi je souhaiterai au centième près J'ai essayé avec : Math.round(xxx,3) mais cela ne semble pas marcher, pourriez vous m'aider ? Merci d'avance, Très cordi@lement William T-J Link to comment Share on other sites More sharing options...
Sentinel Posted June 17, 2006 Share Posted June 17, 2006 Math.round arrondit à l'entier le plus proche, et ne prend qu'un seul paramètre. Impossible donc d'arrondir au centième directement. Mais multiplie ta valeur par 100, arrondis avec Math.round, et divise le résultat par 100. Tu auras une valeur arrondie au centième :) Link to comment Share on other sites More sharing options...
Quarky Posted June 17, 2006 Share Posted June 17, 2006 Il existe 2 méthodes ! Va voir ceci : Comment arrondir un nombre décimal ? - edit - Grillé par Sentinel .... Le lien fourni la même méthode. Link to comment Share on other sites More sharing options...
Epractical Posted June 17, 2006 Author Share Posted June 17, 2006 Bonjour, Merci de votre aide ça marche parfaitement Link to comment Share on other sites More sharing options...
Sentinel Posted June 17, 2006 Share Posted June 17, 2006 Bon je le mets à ta place Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.