Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update Math.pow stdlib function #9

@alexdovzhanyn

Description

@alexdovzhanyn

The current implementation of the Theta.Math.pow() function has several limitations and issues:

Negative Exponents: The function does not handle negative exponents properly, such as 10**-5. We need to check the sign of the exponent and perform division if the exponent is negative.

Negative Base Values: The function does not handle negative base values correctly. For negative bases, we need to multiply by the absolute value of the base to get the correct result.

Floating Point Exponents: The function does not handle floating point exponents. It might be beneficial to split this internally into a powf (for floating-point exponents) and pow (for integer exponents) function to improve efficiency. This change will also require detecting and storing whether a number is an integer or a float in the lexer and subsequently in the ASTNode.

Metadata

Metadata

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions