//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.18; contract SimpleStore { function sqrt(uint x) private pure returns (uint y) { if(x == 0) return 0; else { if(x <= 3) return 1; uint z = (x + 1) /2; y = x; while(z < y){ y=z; z= (x / z + z) / 2; } } } function D(int a, int b, int c) public pure returns (int){ return b * b - 4 * a * c; } function equation (int a, int b, int c) public pure returns (int, int){ var temp = D(a, b, c); require (!(temp < 0)); int minusB = b * ( -1); if(temp==0){ int x= ( minusB ) /2 * a; return (x,x); } int x1 = minusB + int(sqrt(uint(temp))) /2 * a; int x2 = minusB - int(sqrt(uint(temp))) /2 * a; return (x1,x2); } }
0.4.18