I am working on an android Calculator application which can calculate trigonometric functions. I find that my Calculator shows:

```
Tan 90° = 1.633123935319537E16 instead of Tan 90° = undefined
Tan 270° = 5.443746451065124E15 instead of Tan 270° = undefined

```

I know these values actually mean `undefined` but these calculations might be a little confusing to the users. I am using Eclipse to make this app.

My question is "How do i get my Calculator to show the message `undefined` for Tan 90°, 270° and other values where Tan is infinity?".

This is my Code for Tan function:

```
ImageButton btnTan;
TextView txtDisplay;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btnTan = (ImageButton) findViewById(R.id.btnTan);
    txtDisplay = (TextView) findViewById(R.id.txtDisplay);

    btnTan.setOnClickListener(this);

}

Double total = 0.0;

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub

if (v.getId() == R.id.btnTan) {
    if (txtDisplay.getText().equals("")) {
        txtDisplay.setText("");
    }
    else {
        double total = 0.0;
        total = Math.round(Math.tan(Math.toRadians(Double.parseDouble(txtDisplay.getText().toString()))));
        txtDisplay.setText("");
        txtDisplay.setText(txtDisplay.getText().toString() + total);
    }
}

```