Floor(), Round() angle incorrect

glen.reesor shared this problem 10 years ago
Answered

This is in Version 3.0.0.0.


If angle mode is set to degrees, when I put the following in a text box, the results are incorrect:

"" + round(theta)


For 0 < theta < ~28.6, the result is 0.

For ~28.6 < theta < ~85.7, the result is 57.3.


Given that:

28.6 degrees is approximately 0.5 rad

57.3 degrees is approximately 1 rad

85.7 degrees is approximately 1.5 rad


it appears that Geogebra is rounding a radian value then converting to degrees, rather than rounding the degree value. Similar incorrect values occur for floor() and presumably ceil().


Interestingly, since asin() and acos() return numbers rather than angles, I am able to use round(acos(xCoordinate on a unit circle)) to get a correctly rounded degree measure (with appropriate logic to deal with which quadrant we're in).

Comments (9)

photo
1

Hello

try this instruction

(round(theta*180 / 3.14)) with theta a normal slider 0 to 6.24

Best: Daniel

photo
1

Hello

try this instruction

(round(theta*180 / 3.14)) with theta a normal slider 0 to 6.24

Best: Daniel


That works and I have used it in the past, however from a teaching point of view I think that dragging a point is slightly more meaningful to students than dragging a slider. I've attached a .ggb file to illustrate both the problem and my work-around.

https://ggbm.at/534435

photo
1

This bug is also in the latest development version (3.1.188.0).

photo
1

I needed a reeel angle and this is the solution:

I discoverd that sometimes geogebra Works with degrees and sometimes with rad


It works when I do:

 Angle alpha

a=sin(alpha)

 Dutch:

b= Als[alpha ≤ 90 °, asin(a) 180 / 3.14159, Als[alpha ≤ 180 °, 180 - asin(a) 180 / 3.14159, Als[alpha ≤ 270 °, 180 - asin(a) 180 / 3.14159, Als[alpha ≤ 360 °, 360 + asin(a) 180 / 3.14159, 3]]]]

English

b=if[alpha ≤ 90 °, asin(a) 180 / 3.14159, if[alpha ≤ 180 °, 180 - asin(a) 180 / 3.14159, if[alpha ≤ 270 °, 180 - asin(a) 180 / 3.14159, if[alpha ≤ 360 °, 360 + asin(a) 180 / 3.14159, 3]]]]

c=round(b)

photo
1

It should now work in 3.1.227.0, online now. Please test!

photo
1

indeed it works


round(alpha) gives de round value of alpha

also ceil and floor works oke.

version is 3.1.227 not 3.1.127

photo
1

Not fixed in 3.2.23 !


Floor(60) gives 60

Floor(60 <degrees> ) gives 59 <degrees>


I was hoping to convert degrees to degrees, minutes, seconds, but my method won't work for whole numbers of degrees.

photo
1

Ha! This is a very interesting bug! try this:

a=60°

b=floor(a)

As reported, b=59°


Now turn on a as a slider; for a>60° b=a, but for a<60° b=a-1.


Now run a all the way down to 0°; after that b=a for all values!


Moreover, if you define a=70° (or some other value), then the breaking point moves.

photo
1

Thanks for the report - 3.2.24.0 online now :)

© 2019 International GeoGebra Institute