Eastborn
Eastborn

Reputation: 73

What is the meaning of a dot (.) after an integer in c?

I would like to know if anybody knew what a . after an integer in C means.

i have this piece of code i want to convert and that is the only thing i am not sure of what it does.

if (y>=0.) what does the . here do?

full code:

double angleOf(double x, double y) {

  double  dist=sqrt(x*x+y*y) ;

  if (y>=0.) return acos( x/dist);
  else       return acos(-x/dist)+.5*CIRCLE_RADIANS; }

Upvotes: 6

Views: 5246

Answers (2)

reko_t
reko_t

Reputation: 56430

It's same as 0.0, it will treat it as double instead of an integer, so you don't need to cast it.

Upvotes: 8

Martin v. Löwis
Martin v. Löwis

Reputation: 127467

The trailing dot makes the literal a floating point (double) literal, instead of an integer one.

Upvotes: 3

Related Questions