.


:




:

































 

 

 

 


Math




float 4 (32 ) 1.5*10-45..3.4*1038 , 7-8 . real*4 IEEE754
double   8 (64 ) 5*10-324..1.7*10308 , 15..16 . real*8 IEEE754

 

 

+ x+y , x y , .
x-y
* x*y
/ x/y . , x y , .
% x%y x y. , x y , .

 

 

= v=x x, v
++ ( 1) v++ ++v v=v+1
-- ( 1) v-- --v v=v-1
+=   v+=x v=v+x
-=   v-=x v=v-x
*=   v*=x v=v*x
/=   v/=x v=v/x
%=   v%=x v=v%x

 

 

, (Math.PI) (Math.E) Math, java.lang.

, , , Math.

, Math.PI Math.sin(x). java.lang . , Math, , .

Math :

public static final double E = 2.7182818284590452354;

public static final double PI = 3.14159265358979323846;

static , ; final , - .

x, y, angdeg, angrad double, a float, m, n long int. double, .

 

Math
 
sin(x) sin(x) -
cos(x) cos(x) -
tan(x) tg(x) -
asin(x) arcsin(x) -
acos(x) arccos(x) -
atan(x) arctg(x) -
atan2(y, x) , x,y, .
toRadians(angdeg) angdeg / 180.0 * PI; - .
toDegrees(angrad) angrad * 180.0 / PI; - .
  , ,
exp(x) ex -
expm1(x) ex-1. x, 0, , exp(x)-1
log(x) ln(x) .
log10(x) log10(x) .
log1p(x) ln(1+x). x, 0, , log(1+x)
sqrt(x) -
cbrt(x) -
hypot(x,y) -
pow(x, y) xy x y
sinh(x) sh(x)=
cosh(x) ch(x)=
tanh(x) th(x)=
    , , ,
abs(m) abs(x) . int, long, float double. , .
signum(a) signum(x) . float double. , .
min(m,n) min(x,y) . . : int, long, float, double. , .
max(m,n) max(x,y) . . : int, long, float, double. , .
 
ceil(x) x , x
floor(x) x , x
round(a) round(x) x . float double. long, double, int float. , (int)floor(x + 0.5).
rint(x) x .
ulp(a) ulp(x) ( ). float double. , .
  ,
random() 0.0 1.0. 0 ≤ Math.random() < 1.
IEEEremainder(x,y) x/y, x-y*n, n

 

Float Double, Float Double:

Float.parseFloat()

Double.parseDouble()

 

, jTextField1 jTextField2, :

float f1= Float.parseFloat(jTextField1.getText());

double d1= Double.parseDouble(jTextField2.getText());

 

Math java.math, BigDecimal, BigInteger, MathContext, RoundingMode. BigDecimal . BigInteger . MathContext RoundingMode , BigDecimal BigInteger.

 





:


: 2017-02-28; !; : 815 |


:

:

, , 1:10
==> ...

965 - | 941 -


© 2015-2024 lektsii.org - -

: 0.015 .