Rounding and Angles

eugbug shared this question 10 months ago
Answered

The Wiki doesn't go into detail on the rounding function. I assume round(x) without an additional precision parameter just truncates the decimal part? So if an angle object was created using the angle tool and the angle was say 22 degrees and Geogebra holds angle values internally as radians (so 22 degrees <1 radian), how come if I do Y = round (x) with x as 22 degrees, the value displayed in the algebra view for Y is 22 degrees (rather than rounded down to 0)?

Comments (9)

photo
1

Just did some tests and it rounds numbers up or down to the nearest whole number. But what does it do with angles?

photo
1

The algebra view displays angles as degrees. So does the round function round to the nearest degree (even though the value is stored internally in radians)?

photo
1

'Round' rounds the numbers in the unit tey are stored to the unit. So if an angle is shown in degrees, degrees will be rounded, no radians. If the algebra view displays angles as degrees this means that the settings for angles is in degrees (Options - Advanced) so it's normal that degrees will be rounded. If you want to work and round radians you have to change the settings.

chris

photo
1

How do I access Options Chris?

My menu has "settings" which allows me to change number of decimal place etc. Properties for an angle object has an advanced tab but there isn't an option to change degrees to radians there.

photo
photo
1

I think I have it. It's under the "Algebra" settings window.

photo
1

However the trig functions as I understand it take a radian argument, so if angles are displayed in degrees, they need to be converted to radians first to do any calculations?

photo
1

this is a matter of users interface and internal programming, but this is the same for any calculator in which you can choose different modi. For the user the calculations are made in the chosen modus. That's the same with trigonomic functions.

If the chosen modus is degrees, you will find: cos (60) = 0.5 cos (60 rad) : -0.95 cos (60°) = 0.5

This illustrates that GeoGebra remembers the chosen settings and functions are calculated in this chosen modus. What happens internally is another question, that's a matter of conversion between internal calculations and users interface which indeed will require some conversions. Fortunately this is solved by developers

chris

photo
1

Ok, but in my case I have a slider whose value is degrees and is used as the argument for sin and cos. I have to convert the value to radians for the calculations to work. That of course is because the value of the slider is a number, not an angle.

photo
1

Hmm, but I just discovered now that a slider can be an angle value. That makes more sense. No need to do conversions!

© 2020 International GeoGebra Institute