Квадратное уравнение
Всем привет! Помогите пожалуйста разобраться.
Вот весь код скрипта: __________ function print(real, imag) { if (Math.abs(imag)<1E-6) return real; else return '('+real+','+imag+')'; } function solve() { A = document.quadratic.A.value; if (Math.abs(A)<1E-3) { document.getElementById('output').innerHTML = 'Нет корней'; return; } B = document.quadratic.B.value; C = document.quadratic.C.value; A = 2*A; D = B*B-2*A*C; if (Math.abs(D)<1E-3) { document.getElementById('output').innerHTML = 'x = '+(-B/A); return; } if (D>0) document.getElementById('output').innerHTML = 'x1 = '+print((-B+Math.sqrt(D))/A, 0)+'<br />x2 = '+print((-B-Math.sqrt(D))/A, 0); else document.getElementById('output').innerHTML = 'x1 = '+print(-B/A,Math.sqrt(-D)/A)+'<br />x2 = '+print(-B/A,-Math.sqrt(-D)/A); } __________ Меня интересует собственно, то, что я выделил жирным. Объясните пожалуйста, что значат выделенные строки? Заранее спасибо! |
Цитата:
var real=111; var imag=222; alert('('+real+','+imag+')'); |
Цитата:
|
Цитата:
* умножение - вычитание |
Цитата:
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>ГГ</title> <style> * { margin:0; padding: 0; outline: none; } </style> </head> <body> <form name="quadratic" action=""> <input type="text" name="A" value="eto A"> <input type="text" name="B" value="eto B"> <input type="text" name="C" value="eto C"> </form> <script> alert(document.quadratic.A.value); alert(document.quadratic.B.value); alert(document.quadratic.C.value); </script> </body> </html> |
Цитата:
Math.abs() http://javascript.ru/Math-abs alert(1E-3); |
Часовой пояс GMT +3, время: 02:31. |