Compare value in text with value in button

hi guys. i am trying to compare a value which is in Text with a value which is in Button but have no idea how to do it. i am trying for 6 days but no where find answer.
float value1 = Random.Range(1, 10);
float value2 = Random.Range(1, 12);

    float add = value1 + value2;
    no1.text = "" + value1;
    no2.text = "" + value2;
    ans.text = "" + add;
    button4.GetComponentInChildren<Text>().text = "" + add;

how can i compare ans.text = add with button4.text = add.

Add script to the button:

[SerializedField]
Text tF;//textFieldWhoseValueNeedsToBeCompared

//Call this method when you want to do the comparison
public void Compare(){

//I’m assuming button’s name is the value you want to compare

if(GetComponent().name == tF.text){

           Debug.Log("These are same");

}
}

if(button4.GetComponentInChildren().text == ans.text)
// equal
else
// not equal