Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   Арифметические функции (http://www.flasher.ru/forum/showthread.php?t=82093)

wmicha 05.07.2006 10:18

Арифметические функции
 
Как возвести число в степень или взять корень?

motor4ik 05.07.2006 10:33

смотрим класс Math

Цитата:

Math class
Availability
Flash Player 5. In Flash Player 4, the methods and properties of the Math class are emulated using approximations and may not be as accurate as the non-emulated math functions supported by Flash Player 5.
Цитата:

Math.sqrt()
Computes a square root.

a^2=a*a !!
a^3=a*a *a!!

Код:


a=4;
b=1;
stepen=4;

for (i=0;i<stepen;i++){
b*=a;
}

trace(b);



Код:

function stepen(a:Number,c:Number):Void{
        var b:Number=1;
        for (i=0;i<c;i++){
                b*=a;
        }
        trace(b);
}


stepen(2,4);


fishbounce 05.07.2006 11:40

Math.pow( x, .5 ) - корень
Math.pow( x, y ) - степень

motor4ik 05.07.2006 11:44

реально )))) не увидел ))))


Часовой пояс GMT +4, время: 17:22.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.