-1

I read this question Evenly distributing n points on a sphere and in one of the answers in python was used this:

offset = 2./samples

I was trying to find what does it mean but I didn't succeed. At first, I thought it is something with directories (./ like in Linux command line) but that doesn't make any sense actually.

If this is too basic or duplicate I am sorry, but I didn't find it anywhere.

Community
  • 1
  • 1
Smeagol
  • 593
  • 9
  • 23
  • 3
    It does the same as `offset = (2.)/samples`. `./` is not an operator. – vaultah Dec 22 '16 at 15:27
  • And that is? I don't know python at all, I have to do something similar in different language. – Smeagol Dec 22 '16 at 15:29
  • Division, as in `offset = 2.0 / samples`. The `2.0` is (probably) used instead of just 2 to get a floating point answer in the old python version 2. (In python2, integer 2 would give an integer result if `samples` was an integer). – cdarke Dec 22 '16 at 15:30
  • Ok, that is simple :), thanks. – Smeagol Dec 22 '16 at 15:32

1 Answers1

3

There's no ./ operator, the . is part of the number. That is you have the number 2. (which is the same as 2.0), followed by the / operator, followed by samples. With spaces, it'd be 2. / samples.

And, as you know, / is the division operator.

sepp2k
  • 363,768
  • 54
  • 674
  • 675