dmolony-DiskBrowser/src/com/bytezone/diskbrowser/visicalc/Sqrt.java

29 lines
580 B
Java
Raw Normal View History

2017-03-05 10:42:27 +00:00
package com.bytezone.diskbrowser.visicalc;
public class Sqrt extends Function
{
Sqrt (Cell cell, String text)
2017-03-05 10:42:27 +00:00
{
super (cell, text);
2017-03-18 09:21:11 +00:00
assert text.startsWith ("@SQRT(") : text;
2017-03-19 01:03:57 +00:00
source = cell.getExpressionValue (functionText);
2017-03-05 10:42:27 +00:00
values.add (source);
}
@Override
public void calculate ()
{
source.calculate ();
if (!source.isValueType (ValueType.VALUE))
{
valueType = source.getValueType ();
return;
}
value = Math.sqrt (source.getValue ());
2017-03-18 21:23:44 +00:00
valueType = Double.isNaN (value) ? ValueType.ERROR : ValueType.VALUE;
2017-03-05 10:42:27 +00:00
}
}