Zaokrąglenie oraz wartość bezwzględna |
Autor |
Wiadomość |
Radjon
Doradca

Pomógł: 3 razy Dołączył: 15 Gru 2005 Posty: 66 Skąd: Kraków
|
Wysłany: Wto 02 Sty, 2007 09:46 Zaokrąglenie oraz wartość bezwzględna
|
|
|
Cześć
Jak uzyskać WARTOŚĆ BEZWZGLĘDNĄ
Do tej pory wartość bezwzględną uzyskiwałem "if (x < 0){ x=x*-1}" ale jeśli jest jakaś komenda to chętnie ją poznam
A także jak uzyskać ZAOKRĄGLENIE do zadanej ilość liczb po przecinku,
ewentualnie jak zdefiniować generator liczb losowych by dawał wynik w liczbach całkowitych |
|
|
|
 |
krzyked
Przyjaciel


Pomógł: 9 razy Dołączył: 20 Cze 2005 Posty: 45 Skąd: Sulisławice
|
Wysłany: Wto 02 Sty, 2007 18:12
|
|
|
Wartość bezwzględzna liczby:
Liczba całkowita:
Zaokrąglenie do liczby całkowitej w dół:
Zaokrąglenie do liczby całkowitej w górę:
Zaokrąglenie do najbliższej liczby całkowitej:
Losowa liczba całkowita z zakresu od 0 do maksymalna:
Kod: | Math.randomInt(maksymalna) |
|
_________________
 |
|
|
|
 |
stefcio
Ekspert


Pomógł: 24 razy Wiek: 33 Dołączył: 14 Lut 2006 Posty: 530 Skąd: wawa
|
Wysłany: Wto 02 Sty, 2007 18:15
|
|
|
ja proponuje F1 i w indexie wpisz math i masz wszystkie kombinacje:))
[ Dodano: Wto 02 Sty, 2007 18:16 ]
Function
Requires Advanced Math Support?
Description
Math.abs(number)
N
Absolute value of number
Math.acos(number)
Y
Arc cos of ratio in radians
Math.acosdeg(number)
Y
Arc cos of ratio in degrees
Math.approach(number,dest,factor)
N
Moves 'value' closer to 'dest' by a factor of 'factor'
Math.asin(number)
Y
Arc sin of ratio in radians
Math.asindeg(number)
Y
Arc sin of ratio in degrees
Math.atan(number)
Y
Arc tan of ratio in radians
Math.atandeg(number)
Y
Arc tan of ratio in degrees
Math.atan2(y,x)
Y
Arc tan (angle in radians) of specified coordinates
Math.atan2deg(y,x)
Y
Arc tan (angle in degrees) of specified coordinates
Math.ceil(number)
N
Returns closest integer >= specified number
Math.chance(percent)
N
Returns true (1) percent (on average) amount of the time
Math.clamp(number,lo,hi)
N
if (lo < number < hi) returns number
if (number <= lo) returns lo
if (number >= hi) returns hi
Math.cos(radians)
Y
Returns the cosine of the angle. Angle is in radians
Math.cosdeg(degrees)
Y
Returns the cosine of the angle. Angle is in degrees
Math.degrees(radians)
N
Converts an angle in radians to degrees
Math.exp(number)
Y
Raises e to the power of number
Math.floor(number)
N
Returns closest integer <= specified number
Math.log(number)
Y
Returns the natural log of number
Math.max(number,number...)
N
Returns the maximum of the supplied Arguments
Math.min(number,number...)
N
Returns the minimum of the supplied Arguments
Math.Pi
N
Constant, PI
Math.pow(base,power)
Y
Raises base to the power of power
Math.radians(degrees)
N
Converts an angle in degrees to radians
Math.random()
N
Returns a random number, 0 <= number <= 1
Math.randomInt(max)
N
Returns a random number in the range
0 <= number <= max
Math.randomRange(lo,hi)
N
Returns a random number in the range
lo <= number <= hi
Math.round(number)
N
rounds the value of the parameter up or down to the nearest integer
Math.sign(number)
N
if (number < 0) returns -1
if (number == 0) returns 0
if (number > 0) returns +1
Math.sin(radians)
Y
Returns the sine of the angle. Angle is in radians
Math.sindeg(degrees)
Y
Returns the sine of the angle. Angle is in degrees
Math.sqrt(number)
Y
Returns the square root of number
Math.SQRT1_2
N
Constant, square root of 0.5
Math.SQRT2
N
Constant, square root of 2
Math.tan(radians)
Y
Returns the tangent of the angle. Angle is in radians
Math.tandeg(degrees)
Y
Returns the tangent of the angle. Angle is in degrees |
_________________ Stefan
Kliknij na przycisk Pomógł--jak ci pomogłem:)) |
|
|
|
 |
Radjon
Doradca

Pomógł: 3 razy Dołączył: 15 Gru 2005 Posty: 66 Skąd: Kraków
|
Wysłany: Wto 02 Sty, 2007 18:49
|
|
|
Aby szukać trzeba najpierw wiedzieć czego ...
mi wystarczy samo math i int resztę już bym znalazł
no ale skoro zrobiliście to za mnie to
Wielkie dzięki |
|
|
|
 |
nugatt


Pomógł: 75 razy Wiek: 43 Dołączył: 16 Maj 2005 Posty: 1389 Skąd: Warszawa
|
Wysłany: Wto 02 Sty, 2007 21:28
|
|
|
krzyked napisał/a: | Losowa liczba całkowita z zakresu od 0 do maksymalna:
Kod:
Math.randomInt(maksymalna) | raczej z zakresu od 0 do max -1 |
_________________ tomekf /// swishmaxxx |
|
|
|
 |
krzyked
Przyjaciel


Pomógł: 9 razy Dołączył: 20 Cze 2005 Posty: 45 Skąd: Sulisławice
|
Wysłany: Sro 03 Sty, 2007 17:57
|
|
|
nugatt napisał/a: | raczej z zakresu od 0 do max -1 |
Oczywiście, masz rację.Mój błąd |
_________________
 |
|
|
|
 |
|