Exemple d’utilisation des fonctions mathématiques de la classe ‘BigDecimal’

Author:

classe, java
{filelink=11212}


import java.math.BigDecimal;

public class BigDecMath
 {

  public static void main(String[] args)
  	{

    BigDecimal bd1 = new BigDecimal("12525.14");
    BigDecimal bd2 = new BigDecimal("20");

    // Addition
    bd1 = bd1.add(bd2);
    System.out.println("bd1 = " + bd1);

    // Multiplication
    bd1 = bd1.multiply(bd2);
    System.out.println("bd1 = " + bd1);

    // Soustraction
    bd1 = bd1.subtract(bd2);
    System.out.println("bd1 = " + bd1);

    // Division
    bd1 = bd1.divide(bd2);
    System.out.println("bd1 = " + bd1);

    // Puissance
    bd1 = bd1.pow(2);
    System.out.println("bd1 = " + bd1);

    bd1 = bd1.negate();
    System.out.println("bd1 = " + bd1);
  }
}

A Voir sur le même Sujet:

  • java multiplier bigdecimal par -1
  • exemples fonction mathématiques avec javascript
  • bigdecimal fonctions
  • graphe des fonction mathématique en java
  • bigdecimal pour javascript
  • multiplier bigdecimal par -1
  • exemple utilisation fonctions mathematiques excel
  • exemple hashtable et mathématique
  • fonction mathematique en java.txt
  • system.gc methods in c#

Leave a Reply

Your email address will not be published. Required fields are marked *