< Back to Snippets

Rationalize Square Root

Turns a decimal value in the y-register into the closest \(\frac{a\sqrt{b}}{c}\), where maximum value of c is in the x-register.


<root>
  ...
  <values>
    ...
    <function ID="rationalizeSqrt" label="rat" subscript="sqrt" parameters="2" supportsMacros="true" supportsSolver="true">
      <StackBox.ApplyConsole/>
      <StackBox.Swap2/>
      <StackBox.Enter/>
      <MathSign.Action/>
      <StackBox.Swap2/>
      <MathSquare.Action/>
      <StackBox.Roll3Up/>
      <MathRationalize.Action/>
      <MathSqrt.Action/>
      <MathMultiply.Action/>
    </function>
    ...
  </values>
</root>