Skip to content

Add deg to rad and rad to deg for numbers...#25

Open
newsocialifecom wants to merge 2 commits intoguipn:masterfrom
newsocialifecom:patch-1
Open

Add deg to rad and rad to deg for numbers...#25
newsocialifecom wants to merge 2 commits intoguipn:masterfrom
newsocialifecom:patch-1

Conversation

@newsocialifecom
Copy link
Copy Markdown

...and add toInt which converts the number from float to int (it's faster than the builting javascript function)

...and add toInt which converts the number from float to int (it's faster than the builting javascript function)
@ashnur
Copy link
Copy Markdown

ashnur commented Jan 25, 2014

The .toInt() method provided in this PR does not give the correct result for numbers larger than 2147483648

  (Math.pow(2,31) + 0.25) | 0  == -2147483648   // incorrect
  (Math.pow(2,32) + 0.25) | 0  == 0             // incorrect
  (Math.pow(2,31) - 0.25) | 0  == 2147483647    // correct

@newsocialifecom
Copy link
Copy Markdown
Author

As far as I know 2147483647 is the maximum number size for 32 bit so.... it's normal....

@ghost
Copy link
Copy Markdown

ghost commented Jan 25, 2014

Numbers are not 32-bit integers, they're IEEE 754 double-precision floats.

@newsocialifecom
Copy link
Copy Markdown
Author

oh, didn't know it.... I'll fix this

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.

2 participants