Added square root function

This commit is contained in:
dunkeroni 2023-09-06 09:39:47 -04:00 committed by psychedelicious
parent 005087a652
commit 99ee47b79b

View File

@ -146,4 +146,14 @@ class ModulusInvocation(BaseInvocation):
b: int = InputField(default=0, description=FieldDescriptions.num_2)
def invoke(self, context: InvocationContext) -> IntegerOutput:
return IntegerOutput(value=self.a % self.b)
return IntegerOutput(value=self.a % self.b)
@invocation("sqrt", title="Square Root", tags=["math", "sqrt"], category="math", version="1.0.0")
class SquareRootInvocation(BaseInvocation):
"""Returns the square root of a number."""
value: float = InputField(default=0, ge=0, description="The float value")
def invoke(self, context: InvocationContext) -> FloatOutput:
return FloatOutput(value=np.sqrt(self.value))