Congratulations Rich, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Cos( )---wrong Value Result

Assistance Requested

Help Aerius with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Aerius claims to have checked these sources:

may be I am doing it wrong

cos(20) should result as .93969262078591
not .408082061813392
unless there is an extra conversion to do?

User-inserted image

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.

Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


COS calculates in radians not degrees.

Cos20 in radians is 0.408082061813392

If you want to work in degrees I guess you need to convert degrees to radians before carrying out the calculation. 1 radian = 57.2957795 (180/pi) degrees.


Take a look at one of the examples under EZ-Script Functions called "SketchPad" - I have code on how to create a circle using Sin and Cos, if that's what you are looking for.

Otherwise, look into EZ-Script Function Syntax folder at the project named "SIN COS"


I realy appreciate your quick response.

Merci beaucoup


There are ACos and ASin as well - the math functions that EZ-Builder supports are:

. Sin()
. Cos()
. Tan()
. Sec()
. Csc()
. Cot()
. ASin()
. ACos()
. ATan()
. SinH()
. CosH()
. TanH()
. Abs()
. Sqrt()
. Ciel()
. Floor()
. Exp()
. Log10()
. Log()
. Max()
. Min()
. Round()
. E()
. Pi()


Holy mathematics Rich! Next time I cut the birthday cake I'll be sure to use these functions! I am somewhat familiar with DJ's listed math functions ......except Floor() ?


I gess floor() and ciel() are reserved for AR Drone


Floor and Ceiling are math functions, not specifically for the drone.

This will probably explain it better than I can...

Or just run the following script I just knocked up...


Print("Floor: " + Floor($pi))
Print("Ceiling: " + Ciel($pi))


Floor () takes the decimals off ex: 1.234 will end as 1

Ciel () will add lyke if it will consider 1.234 be 1.9 + .1 = 2

Am i right?


Technically it's taught that floor is the greatest integer that is less than or equal to x and ceiling is the least integer that is greater than or equal to x.

So if x was 2.739492
Floor(x) would be the largest previous integer, which would be 2.
Ceiling(x) would be the smallest following integer, which would be 3.

If the number is already an integer then there is no change

i.e. if x was 5
Floor(x) would be 5.
Ceiling(x) would be 5.

Basically put it's rounding a number up or down without paying attention to the decimal part. Since Round(x,0) will round 5.51394 to 6 but will round 5.498389 to 5. If your application needs the number rounded up each time you would use Ciel(x), if it needed rounding down you rould use Floor(x)