# DEG (Function)

*914*pages on

this wiki

## V1Edit

Indications are, `DEG`

in SmileBasic V1 is identical to that in V2.

## V2Edit

`DEG(number)`

is a function which takes a number representing an angle measured in radians, and gives a result which is the angle measured in degrees.

`DEG`

is interesting in that it exposes that Petit Computer V2 implements more sophisticated calculations "behind the scenes" than can be achieved directly. For example, `DEG(9100)`

gives 521391.593505859375, very close to the true value of approx. 521391.593569 (in fact, it is as close as you can get with the fixed-point values used in Petit Computer). Calculating `9100*180/PI()`

gives an error `Overflow`

, whereas calculating `9100/PI()*180`

gives 521430.6005859375, which is off by about 39.

This function is conceptually the inverse of the `RAD`

function. Apart from rounding issues preventing this from being actually the case, `DEG`

may produce negative results, and results greater than 361, which cannot be used as a parameter to `RAD`

.

## V3Edit

Indications are, `DEG`

in SmileBasic V3 is identical to that in V2 (except the comments above, relating to the fixed-point representation of numbers in V2, do not apply).