Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

dart
atan
math
communitycreator

What is atan() in Dart?

harris910

The atan() function returns the inverse tangent of a number. To be more specific, it returns the inverse tangent of a number in radians.

Figure 1 shows the mathematical representation of the atan() function:

Figure 1: Mathematical representation of inverse tangent function

Note: dart:math is required for this function.

To convert radians to degrees, use the following formula:

degrees = radians * ( 180.0 / pi )

Syntax

double atan(double num)

Parameter

This function requires a number as a parameter.

Return value

atan() returns the inverse tangent of a number (radians) that is sent as a parameter.

The return value lies in interval [-pi/2,pi/2] radians.

Example

import 'dart:convert';
import 'dart:math';
void main() {
    //positive number in radians
    print("The value of atan(0.5): ${atan(0.5)} Radians");

    // negative number in radians
    print("The value of atan(-0.5): ${atan(-0.5)} Radians");

    //applying acos() and then converting the result in radians to degrees
    // radians = 1.0
    // PI = 3.14159265
    double result=atan(1.0) * (180.0 / pi);
    print("The value of atan(1.0): ${result} Degrees");
}

RELATED TAGS

dart
atan
math
communitycreator
RELATED COURSES

View all Courses

Keep Exploring