コードをコピー コードは次のとおりです: 在線一元二次方程式计算器 < p align="center">解二次程式计算 < tr> x = 0 一元二次方程的解法< ;/b> x1< /font>gt;gt;= x2= gt; tbody> CRoot 製<!-- <BR>var rootparti;<BR>var rootpart;<BR>var det;<BR>var rootparti1;<BR>var rootparti2;<BR>var a;<BR>var b ;<BR>var c;<BR>var x1;<BR>var x2;<BR>var i = "i";<BR>function checkQuad() {<BR>var a = document.fquad.fa.value ;<BR>var b = document.fquad.fb.value;<BR>var c = document.fquad.fc.value;<BR>if (a == 0 && c != 0) {<BR>x1 = -c / b;<BR>x2 = "二次方程式ではありませんが、x の答えは次のとおりです。";<BR>document.fquad.x1.value=x1;<BR>document.fquad.x2.value=x2 ;<BR>}<BR>else if (a == "" && c != 0) {<BR>x1 = -c / b;<BR>x2 = "二次方程式ではありません";<BR>ドキュメント。 fquad.x1.value=x1;<BR>document.fquad.x2.value=x2;<BR>}<BR>else {<BR>quad();<BR> }<BR>}<BR>関数クアッド() {<BR>var a = document.fquad.fa.value;<BR>var b = document.fquad.fb.value;<BR>var c = document.fquad.fc.value;<BR>det = Math.pow(b,2) - 4 * a * c;<BR>rootpart = Math.sqrt(det) / (2 * a);<BR>rootparti = (Math.sqrt(-det) / (2 * a)) i;<BR>if (parseFloat(rootparti) <; 0) {<BR>rootparti1 = rootparti;<BR>rootparti2 = (-1 * parseFloat(rootparti)) i;<BR>}<BR>else {<BR>rootparti1 = (-1 * parseFloat(rootparti)) i ;<BR>rootparti2 = rootparti;<BR>}<BR>if (rootparti1 == "1i") {<BR>rootparti1 = i;<BR>rootparti2 = "-i";<BR>}<BR>else if (rootparti1 == "-1i") {<BR>rootparti1 = "-i";<BR>rootparti2 = i;<BR>}<BR>if (det == 0) {<BR>x1 = x2 = -b / (2 * a);<BR>}<BR>else if (det > 0) {<BR>x1 = (-b Math.sqrt(det)) / (2 * a);<BR> x2 = (-b - Math.sqrt(det)) / (2 * a);<BR>}<BR>else if ((-b / (2 * a)) == 0) {<BR>x1 = rootparti1;<BR>x2 = rootparti2;<BR>}<BR>else {<BR>x1 = (-b / (2 * a) " " rootparti1);<BR>x2 = (-b / (2 * a) ) " " rootparti2);<BR>}<BR>document.fquad.x1.value=x1;<BR>document.fquad.x2.value=x2;<BR>}<BR>// 複素数を解きます</P> <P>// --><br>