If a is 0 , then equation is not quadratic , but linear
if ( a == 0 ) { document . write ( " " ) ; return ; } let d = b * b - 4 * a * c ; let sqrt_val = Math . sqrt ( Math . abs ( d ) ) ; if ( d > 0 ) { document . write ( " " + " " ) ; document . write ( ( - b + sqrt_val ) / ( 2 * a ) + " " + ( - b - sqrt_val ) / ( 2 * a ) ) ; } else if ( d == 0 ) { document . write ( " " + " " ) ; document . write ( - b / ( 2 * a ) + " " + - b / ( 2 * a ) ) ; }