Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc-core:math] Documentation for core:math package. (partials) #4961

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

kelreeeeey
Copy link

@kelreeeeey kelreeeeey commented Mar 23, 2025

Documented: (all of this will be gradually updated)

  • math.Float_Class enum
  • math.sqrt proc group
  • math.sin proc group
  • math.cos proc group
  • math.tan proc group

  • math.to_radians proc group
  • math.to_degrees proc group

  • DEG_PER_RAD constant
  • RAD_PER_DEG constant

  • math.asin proc group
  • math.acos proc group
  • math.atan proc group

More detail underlying explanation/issue in #2358 (comment)

/*
Return square root of given input.

**Only accept floats**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably also document the behavior for when the input is an inf, nan, a negative zero and possibly subnormal.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that is a good point! I added more examples for the special cases according to Float_Class enum

Comment on lines 66 to 75
x_float : = 4.0 ; sqrt_x_float := math.sqrt(x_float) // using default type of f16
x_f16 :f16 = 30.90 ; sqrt_x_f16 := math.sqrt(x_f16)
x_f16le :f16le = 50.0 ; sqrt_x_f16le := math.sqrt(x_f16le)
x_f16be :f16be = 100 ; sqrt_x_f16be := math.sqrt(x_f16be)
x_f32 :f32 = 4.89 ; sqrt_x_f32 := math.sqrt(x_f32)
x_f32le :f32le = 3.14 ; sqrt_x_f32le := math.sqrt(x_f32le)
x_f32be :f32be = 2.0 ; sqrt_x_f32be := math.sqrt(x_f32be)
x_f64 :f64 = 0.0578 ; sqrt_x_f64 := math.sqrt(x_f64)
x_f64le :f64le = 1000.6 ; sqrt_x_f64le := math.sqrt(x_f64le)
x_f64be :f64be = 89.98 ; sqrt_x_f64be := math.sqrt(x_f64be)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the standard style convention here too please.

x_float: f64   = 4.0;    sqrt_x_float := math.sqrt(x_float) // using default type of f64
x_f16:   f16   = 30.90;  sqrt_x_f16   := math.sqrt(x_f16)
x_f16le: f16le = 50.0;   sqrt_x_f16le := math.sqrt(x_f16le)
x_f16be: f16be = 100;    sqrt_x_f16be := math.sqrt(x_f16be)
x_f32:   f32   = 4.89;   sqrt_x_f32   := math.sqrt(x_f32)
x_f32le: f32le = 3.14;   sqrt_x_f32le := math.sqrt(x_f32le)
x_f32be: f32be = 2.0;    sqrt_x_f32be := math.sqrt(x_f32be)
x_f64:   f64   = 0.0;    sqrt_x_f64   := math.sqrt(x_f64)
x_f64le: f64le = 1000.0; sqrt_x_f64le := math.sqrt(x_f64le)
x_f64be: f64be = 89.98;  sqrt_x_f64be := math.sqrt(x_f64be)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! fixed it and added more examples for special cases according to Float_Class

kelreeeeey added a commit to kelreeeeey/sandbox-to-contrib-odin-doc that referenced this pull request Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants