Skip to content

[P1] Core math builtins missing: sqrt, pow, floor, ceil, round, trig, log, exp, pi, e #19

@ecto

Description

@ecto

Loon currently has abs, min, max, sum, and integer truncation
via [int x], but no other standard math.

Proposal

Add to the builtin set (or a Math module):

  • sqrt, pow (or **)
  • floor, ceil, round
  • sin, cos, tan, asin, acos, atan, atan2
  • log, log10, exp
  • Constants pi and e (or Math.pi / Math.e)

Acceptance criteria

  • Available in the VM and documented in ref/builtins.loon.
  • Tests covering basic values and edge cases (sqrt 0, pow 2 10,
    floor -1.5).

Found while completing the hyperpolyglot ml column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions