Number of rotations
up vote
3
down vote
favorite
Task
Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.
Rules
Input can be 2 positive rational numbers and can be taken in any convenient format.
Both inputs are of same unit.
There must not be any digits 0-9 in your code.
The output will be an integer (in case of float, round to infinity)
This is code-golf so shortest code wins
Examples
distance radius output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3
code-golf restricted-source
add a comment |
up vote
3
down vote
favorite
Task
Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.
Rules
Input can be 2 positive rational numbers and can be taken in any convenient format.
Both inputs are of same unit.
There must not be any digits 0-9 in your code.
The output will be an integer (in case of float, round to infinity)
This is code-golf so shortest code wins
Examples
distance radius output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3
code-golf restricted-source
1
You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like-DP=3.14
in compiler flags, that would defineP
as an approximation of pi, which is probably not what you intended
– Annyo
10 hours ago
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Task
Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.
Rules
Input can be 2 positive rational numbers and can be taken in any convenient format.
Both inputs are of same unit.
There must not be any digits 0-9 in your code.
The output will be an integer (in case of float, round to infinity)
This is code-golf so shortest code wins
Examples
distance radius output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3
code-golf restricted-source
Task
Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.
Rules
Input can be 2 positive rational numbers and can be taken in any convenient format.
Both inputs are of same unit.
There must not be any digits 0-9 in your code.
The output will be an integer (in case of float, round to infinity)
This is code-golf so shortest code wins
Examples
distance radius output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3
code-golf restricted-source
code-golf restricted-source
edited 14 hours ago
Jo King
19.3k245102
19.3k245102
asked 14 hours ago
Vedant Kandoi
57615
57615
1
You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like-DP=3.14
in compiler flags, that would defineP
as an approximation of pi, which is probably not what you intended
– Annyo
10 hours ago
add a comment |
1
You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like-DP=3.14
in compiler flags, that would defineP
as an approximation of pi, which is probably not what you intended
– Annyo
10 hours ago
1
1
You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like
-DP=3.14
in compiler flags, that would define P
as an approximation of pi, which is probably not what you intended– Annyo
10 hours ago
You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like
-DP=3.14
in compiler flags, that would define P
as an approximation of pi, which is probably not what you intended– Annyo
10 hours ago
add a comment |
20 Answers
20
active
oldest
votes
up vote
5
down vote
MathGolf, 5 4 bytes
τ/╠ü
Try it online!
Explanation
τ Push tau (2*pi)
/ Divide the first argument (total distance) by tau
╠ Reverse divide (computes (distance/tau)/radius)
ü Ceiling
add a comment |
up vote
3
down vote
APL+WIN, 9 bytes
Prompts for radius followed by distance:
⌈⎕÷○r+r←⎕
Try it online! Courtesy of Dyalog Classic
Explanation:
○r+r←⎕ prompt for radius and double it and multiply by pie
⌈⎕÷ prompt for distance, divide by result above and take ceiling
add a comment |
up vote
3
down vote
Python 2, 47 45 44 43 bytes
lambda l,r:l/(r+r)//math.pi+l/l
import math
Try it online!
- -2 bytes, thanks to flawr
- -1 byte, thanks to Jonathan Allan
Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can dol/(r+r)//pi+l/l
and save a byte.
– Jonathan Allan
13 hours ago
@JonathanAllan Thanks :)
– TFeld
13 hours ago
add a comment |
up vote
3
down vote
Java 8, 32 30 bytes
a->b->-~(int)(a/b/Math.PI/'')
Contains unprintable u0002
between the single quotes.
Port of @jOKing's Perl 6 answer.
Try it online.
Is that the digit '1' in your code? I think that might not be allowed.
– ouflak
13 hours ago
4
@ouflak Looks like it can be fixed like this.
– Erik the Outgolfer
13 hours ago
@ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit2
, and then just use digit1
... Luckily Erik is indeed right that a simple negative unary has the same effect as+1
(often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
– Kevin Cruijssen
9 hours ago
add a comment |
up vote
3
down vote
Perl 6, 15 12 bytes
-3 bytes tjanks to nwellnhof reminding me about tau
*/*/τ+|$+!$
Try it online!
Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1
. Tau is two times pi. The two anonymous variables $
are coerced to the number 0
, which is used to floor the number +|0
(bitwise or 0) and add one +!$
(plus not zero).
There must not be any digits 0-9 in your code.
– Titus
14 hours ago
@Titus I can't believe I forgot that. Thanks, fixed!
– Jo King
14 hours ago
Are digits in exponents also allowed?
– ouflak
13 hours ago
add a comment |
up vote
2
down vote
05AB1E, 6 bytes
·/žq/î
Port of @flawr's Python 2 comment.
Takes the input in the order radius
,distance
.
Try it online or verify all test cases.
Explanation:
· # Double the first (implicit) input
/ # Divide the second (implicit) input by it
žq/ # Divide it by PI
î # Ceil it (and output implicitly)
add a comment |
up vote
2
down vote
C, 46 bytes
f(float a,float b){return ceil(a/(b+b)/M_PI);}
I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the
include <math.h>
needed for the ceil function, which will rise the count to 64 bytes
New contributor
Welcome to PPCG! This is a nice first answer. Yes, you do need to count#include
and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
– O.O.Balance
12 hours ago
@O.O.Balance Digits are not allowed in the code for this challenge ;)
– Annyo
12 hours ago
@Annyo I knew I was forgetting something :(
– O.O.Balance
12 hours ago
add a comment |
up vote
2
down vote
Catholicon, 8 bytes
ċ//ĊǓĊ`Ė
Explanation:
/ĊǓĊ divide the first input by the doubled second input
/ `Ė divide that by pi
ċ ceil
New version (pi builtin made one byte, division parameters swapped), 5 bytes
ċ/π/Ǔ
add a comment |
up vote
2
down vote
MathGolf, 6 5 bytes
∞/π/ü
Semi-port of @flawr's Python 2 comment.
Takes the input in the order radius distance
.
-1 byte because ceil
builtin has just been added, replacing the floor+1
.
Try it online.
Explanation:
∞ # Double the first (implicit) input
/ # Divide the second (implicit) input by it
π/ # Divide it by PI
ü # Ceil (and output implicitly)
Nice answer! I'll have to admit, it's my fault that there are noceil
operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
– maxb
12 hours ago
4
I would like to see a proof that "Pi is rational"...
– Pakk
12 hours ago
1
@Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It isü
and works both with numericals and lists
– maxb
12 hours ago
@maxb That was fast. :D
– Kevin Cruijssen
9 hours ago
1
@Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that theceil
function is added. ;p
– Kevin Cruijssen
9 hours ago
add a comment |
up vote
1
down vote
PHP, 47 bytes
<?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));
Try it online.
add a comment |
up vote
1
down vote
Jelly, 6 bytes
÷÷ØPHĊ
Try it online!
add a comment |
up vote
1
down vote
Ruby, 29 bytes
->l,r{(l/Math::PI/r+=r).ceil}
Try it online!
add a comment |
up vote
1
down vote
J, 10 9 bytes
>.@%o.@+:
Try it online!
add a comment |
up vote
1
down vote
JavaScript (Babel Node), 25 bytes
-2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy
a=>b=>-~(a/(b+b)/Math.PI)
Try it online!
Justa=>b=>Math.ceil(a/(b+b)/Math.PI)
is 32 bytes. :)
– Kevin Cruijssen
14 hours ago
25 bytes
– Shaggy
10 hours ago
add a comment |
up vote
1
down vote
Julia 1.0, 20 bytes
f(d,r)=cld(d/π,r+r)
Try it online!
fixed..........
– gggg
6 hours ago
add a comment |
up vote
1
down vote
R, 39 32 bytes
-7 bytes Thanks to Giuseppe
function(d,r)ceiling(d/(r+r)/pi)
Try it online!
I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it
add a comment |
up vote
0
down vote
Lua, 61 58 57 bytes
s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))
Try it online!
The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
edit: Several ways, but nothing that saves bytes....
add a comment |
up vote
0
down vote
Japt, 7 bytes
/MT/V c
Try it here
add a comment |
up vote
0
down vote
Stax, 5 bytes
Vt*/e
Run and debug it
Vt* multiply by tau (2pi)
/ divide
e ceiling
add a comment |
up vote
0
down vote
C (gcc), 45 47 45 bytes
f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}
A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'
. We add one (r/r
) to force rounding to infinity.
Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.
Try it online!
add a comment |
20 Answers
20
active
oldest
votes
20 Answers
20
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
MathGolf, 5 4 bytes
τ/╠ü
Try it online!
Explanation
τ Push tau (2*pi)
/ Divide the first argument (total distance) by tau
╠ Reverse divide (computes (distance/tau)/radius)
ü Ceiling
add a comment |
up vote
5
down vote
MathGolf, 5 4 bytes
τ/╠ü
Try it online!
Explanation
τ Push tau (2*pi)
/ Divide the first argument (total distance) by tau
╠ Reverse divide (computes (distance/tau)/radius)
ü Ceiling
add a comment |
up vote
5
down vote
up vote
5
down vote
MathGolf, 5 4 bytes
τ/╠ü
Try it online!
Explanation
τ Push tau (2*pi)
/ Divide the first argument (total distance) by tau
╠ Reverse divide (computes (distance/tau)/radius)
ü Ceiling
MathGolf, 5 4 bytes
τ/╠ü
Try it online!
Explanation
τ Push tau (2*pi)
/ Divide the first argument (total distance) by tau
╠ Reverse divide (computes (distance/tau)/radius)
ü Ceiling
edited 12 hours ago
answered 12 hours ago
maxb
2,1081923
2,1081923
add a comment |
add a comment |
up vote
3
down vote
APL+WIN, 9 bytes
Prompts for radius followed by distance:
⌈⎕÷○r+r←⎕
Try it online! Courtesy of Dyalog Classic
Explanation:
○r+r←⎕ prompt for radius and double it and multiply by pie
⌈⎕÷ prompt for distance, divide by result above and take ceiling
add a comment |
up vote
3
down vote
APL+WIN, 9 bytes
Prompts for radius followed by distance:
⌈⎕÷○r+r←⎕
Try it online! Courtesy of Dyalog Classic
Explanation:
○r+r←⎕ prompt for radius and double it and multiply by pie
⌈⎕÷ prompt for distance, divide by result above and take ceiling
add a comment |
up vote
3
down vote
up vote
3
down vote
APL+WIN, 9 bytes
Prompts for radius followed by distance:
⌈⎕÷○r+r←⎕
Try it online! Courtesy of Dyalog Classic
Explanation:
○r+r←⎕ prompt for radius and double it and multiply by pie
⌈⎕÷ prompt for distance, divide by result above and take ceiling
APL+WIN, 9 bytes
Prompts for radius followed by distance:
⌈⎕÷○r+r←⎕
Try it online! Courtesy of Dyalog Classic
Explanation:
○r+r←⎕ prompt for radius and double it and multiply by pie
⌈⎕÷ prompt for distance, divide by result above and take ceiling
edited 13 hours ago
answered 13 hours ago
Graham
2,11668
2,11668
add a comment |
add a comment |
up vote
3
down vote
Python 2, 47 45 44 43 bytes
lambda l,r:l/(r+r)//math.pi+l/l
import math
Try it online!
- -2 bytes, thanks to flawr
- -1 byte, thanks to Jonathan Allan
Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can dol/(r+r)//pi+l/l
and save a byte.
– Jonathan Allan
13 hours ago
@JonathanAllan Thanks :)
– TFeld
13 hours ago
add a comment |
up vote
3
down vote
Python 2, 47 45 44 43 bytes
lambda l,r:l/(r+r)//math.pi+l/l
import math
Try it online!
- -2 bytes, thanks to flawr
- -1 byte, thanks to Jonathan Allan
Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can dol/(r+r)//pi+l/l
and save a byte.
– Jonathan Allan
13 hours ago
@JonathanAllan Thanks :)
– TFeld
13 hours ago
add a comment |
up vote
3
down vote
up vote
3
down vote
Python 2, 47 45 44 43 bytes
lambda l,r:l/(r+r)//math.pi+l/l
import math
Try it online!
- -2 bytes, thanks to flawr
- -1 byte, thanks to Jonathan Allan
Python 2, 47 45 44 43 bytes
lambda l,r:l/(r+r)//math.pi+l/l
import math
Try it online!
- -2 bytes, thanks to flawr
- -1 byte, thanks to Jonathan Allan
edited 13 hours ago
answered 14 hours ago
TFeld
13.6k21139
13.6k21139
Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can dol/(r+r)//pi+l/l
and save a byte.
– Jonathan Allan
13 hours ago
@JonathanAllan Thanks :)
– TFeld
13 hours ago
add a comment |
Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can dol/(r+r)//pi+l/l
and save a byte.
– Jonathan Allan
13 hours ago
@JonathanAllan Thanks :)
– TFeld
13 hours ago
Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do
l/(r+r)//pi+l/l
and save a byte.– Jonathan Allan
13 hours ago
Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do
l/(r+r)//pi+l/l
and save a byte.– Jonathan Allan
13 hours ago
@JonathanAllan Thanks :)
– TFeld
13 hours ago
@JonathanAllan Thanks :)
– TFeld
13 hours ago
add a comment |
up vote
3
down vote
Java 8, 32 30 bytes
a->b->-~(int)(a/b/Math.PI/'')
Contains unprintable u0002
between the single quotes.
Port of @jOKing's Perl 6 answer.
Try it online.
Is that the digit '1' in your code? I think that might not be allowed.
– ouflak
13 hours ago
4
@ouflak Looks like it can be fixed like this.
– Erik the Outgolfer
13 hours ago
@ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit2
, and then just use digit1
... Luckily Erik is indeed right that a simple negative unary has the same effect as+1
(often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
– Kevin Cruijssen
9 hours ago
add a comment |
up vote
3
down vote
Java 8, 32 30 bytes
a->b->-~(int)(a/b/Math.PI/'')
Contains unprintable u0002
between the single quotes.
Port of @jOKing's Perl 6 answer.
Try it online.
Is that the digit '1' in your code? I think that might not be allowed.
– ouflak
13 hours ago
4
@ouflak Looks like it can be fixed like this.
– Erik the Outgolfer
13 hours ago
@ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit2
, and then just use digit1
... Luckily Erik is indeed right that a simple negative unary has the same effect as+1
(often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
– Kevin Cruijssen
9 hours ago
add a comment |
up vote
3
down vote
up vote
3
down vote
Java 8, 32 30 bytes
a->b->-~(int)(a/b/Math.PI/'')
Contains unprintable u0002
between the single quotes.
Port of @jOKing's Perl 6 answer.
Try it online.
Java 8, 32 30 bytes
a->b->-~(int)(a/b/Math.PI/'')
Contains unprintable u0002
between the single quotes.
Port of @jOKing's Perl 6 answer.
Try it online.
edited 9 hours ago
answered 14 hours ago
Kevin Cruijssen
34.4k554182
34.4k554182
Is that the digit '1' in your code? I think that might not be allowed.
– ouflak
13 hours ago
4
@ouflak Looks like it can be fixed like this.
– Erik the Outgolfer
13 hours ago
@ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit2
, and then just use digit1
... Luckily Erik is indeed right that a simple negative unary has the same effect as+1
(often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
– Kevin Cruijssen
9 hours ago
add a comment |
Is that the digit '1' in your code? I think that might not be allowed.
– ouflak
13 hours ago
4
@ouflak Looks like it can be fixed like this.
– Erik the Outgolfer
13 hours ago
@ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit2
, and then just use digit1
... Luckily Erik is indeed right that a simple negative unary has the same effect as+1
(often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
– Kevin Cruijssen
9 hours ago
Is that the digit '1' in your code? I think that might not be allowed.
– ouflak
13 hours ago
Is that the digit '1' in your code? I think that might not be allowed.
– ouflak
13 hours ago
4
4
@ouflak Looks like it can be fixed like this.
– Erik the Outgolfer
13 hours ago
@ouflak Looks like it can be fixed like this.
– Erik the Outgolfer
13 hours ago
@ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit
2
, and then just use digit 1
... Luckily Erik is indeed right that a simple negative unary has the same effect as +1
(often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).– Kevin Cruijssen
9 hours ago
@ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit
2
, and then just use digit 1
... Luckily Erik is indeed right that a simple negative unary has the same effect as +1
(often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).– Kevin Cruijssen
9 hours ago
add a comment |
up vote
3
down vote
Perl 6, 15 12 bytes
-3 bytes tjanks to nwellnhof reminding me about tau
*/*/τ+|$+!$
Try it online!
Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1
. Tau is two times pi. The two anonymous variables $
are coerced to the number 0
, which is used to floor the number +|0
(bitwise or 0) and add one +!$
(plus not zero).
There must not be any digits 0-9 in your code.
– Titus
14 hours ago
@Titus I can't believe I forgot that. Thanks, fixed!
– Jo King
14 hours ago
Are digits in exponents also allowed?
– ouflak
13 hours ago
add a comment |
up vote
3
down vote
Perl 6, 15 12 bytes
-3 bytes tjanks to nwellnhof reminding me about tau
*/*/τ+|$+!$
Try it online!
Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1
. Tau is two times pi. The two anonymous variables $
are coerced to the number 0
, which is used to floor the number +|0
(bitwise or 0) and add one +!$
(plus not zero).
There must not be any digits 0-9 in your code.
– Titus
14 hours ago
@Titus I can't believe I forgot that. Thanks, fixed!
– Jo King
14 hours ago
Are digits in exponents also allowed?
– ouflak
13 hours ago
add a comment |
up vote
3
down vote
up vote
3
down vote
Perl 6, 15 12 bytes
-3 bytes tjanks to nwellnhof reminding me about tau
*/*/τ+|$+!$
Try it online!
Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1
. Tau is two times pi. The two anonymous variables $
are coerced to the number 0
, which is used to floor the number +|0
(bitwise or 0) and add one +!$
(plus not zero).
Perl 6, 15 12 bytes
-3 bytes tjanks to nwellnhof reminding me about tau
*/*/τ+|$+!$
Try it online!
Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1
. Tau is two times pi. The two anonymous variables $
are coerced to the number 0
, which is used to floor the number +|0
(bitwise or 0) and add one +!$
(plus not zero).
edited 7 hours ago
answered 14 hours ago
Jo King
19.3k245102
19.3k245102
There must not be any digits 0-9 in your code.
– Titus
14 hours ago
@Titus I can't believe I forgot that. Thanks, fixed!
– Jo King
14 hours ago
Are digits in exponents also allowed?
– ouflak
13 hours ago
add a comment |
There must not be any digits 0-9 in your code.
– Titus
14 hours ago
@Titus I can't believe I forgot that. Thanks, fixed!
– Jo King
14 hours ago
Are digits in exponents also allowed?
– ouflak
13 hours ago
There must not be any digits 0-9 in your code.
– Titus
14 hours ago
There must not be any digits 0-9 in your code.
– Titus
14 hours ago
@Titus I can't believe I forgot that. Thanks, fixed!
– Jo King
14 hours ago
@Titus I can't believe I forgot that. Thanks, fixed!
– Jo King
14 hours ago
Are digits in exponents also allowed?
– ouflak
13 hours ago
Are digits in exponents also allowed?
– ouflak
13 hours ago
add a comment |
up vote
2
down vote
05AB1E, 6 bytes
·/žq/î
Port of @flawr's Python 2 comment.
Takes the input in the order radius
,distance
.
Try it online or verify all test cases.
Explanation:
· # Double the first (implicit) input
/ # Divide the second (implicit) input by it
žq/ # Divide it by PI
î # Ceil it (and output implicitly)
add a comment |
up vote
2
down vote
05AB1E, 6 bytes
·/žq/î
Port of @flawr's Python 2 comment.
Takes the input in the order radius
,distance
.
Try it online or verify all test cases.
Explanation:
· # Double the first (implicit) input
/ # Divide the second (implicit) input by it
žq/ # Divide it by PI
î # Ceil it (and output implicitly)
add a comment |
up vote
2
down vote
up vote
2
down vote
05AB1E, 6 bytes
·/žq/î
Port of @flawr's Python 2 comment.
Takes the input in the order radius
,distance
.
Try it online or verify all test cases.
Explanation:
· # Double the first (implicit) input
/ # Divide the second (implicit) input by it
žq/ # Divide it by PI
î # Ceil it (and output implicitly)
05AB1E, 6 bytes
·/žq/î
Port of @flawr's Python 2 comment.
Takes the input in the order radius
,distance
.
Try it online or verify all test cases.
Explanation:
· # Double the first (implicit) input
/ # Divide the second (implicit) input by it
žq/ # Divide it by PI
î # Ceil it (and output implicitly)
answered 14 hours ago
Kevin Cruijssen
34.4k554182
34.4k554182
add a comment |
add a comment |
up vote
2
down vote
C, 46 bytes
f(float a,float b){return ceil(a/(b+b)/M_PI);}
I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the
include <math.h>
needed for the ceil function, which will rise the count to 64 bytes
New contributor
Welcome to PPCG! This is a nice first answer. Yes, you do need to count#include
and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
– O.O.Balance
12 hours ago
@O.O.Balance Digits are not allowed in the code for this challenge ;)
– Annyo
12 hours ago
@Annyo I knew I was forgetting something :(
– O.O.Balance
12 hours ago
add a comment |
up vote
2
down vote
C, 46 bytes
f(float a,float b){return ceil(a/(b+b)/M_PI);}
I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the
include <math.h>
needed for the ceil function, which will rise the count to 64 bytes
New contributor
Welcome to PPCG! This is a nice first answer. Yes, you do need to count#include
and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
– O.O.Balance
12 hours ago
@O.O.Balance Digits are not allowed in the code for this challenge ;)
– Annyo
12 hours ago
@Annyo I knew I was forgetting something :(
– O.O.Balance
12 hours ago
add a comment |
up vote
2
down vote
up vote
2
down vote
C, 46 bytes
f(float a,float b){return ceil(a/(b+b)/M_PI);}
I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the
include <math.h>
needed for the ceil function, which will rise the count to 64 bytes
New contributor
C, 46 bytes
f(float a,float b){return ceil(a/(b+b)/M_PI);}
I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the
include <math.h>
needed for the ceil function, which will rise the count to 64 bytes
New contributor
New contributor
answered 13 hours ago
bznein
1212
1212
New contributor
New contributor
Welcome to PPCG! This is a nice first answer. Yes, you do need to count#include
and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
– O.O.Balance
12 hours ago
@O.O.Balance Digits are not allowed in the code for this challenge ;)
– Annyo
12 hours ago
@Annyo I knew I was forgetting something :(
– O.O.Balance
12 hours ago
add a comment |
Welcome to PPCG! This is a nice first answer. Yes, you do need to count#include
and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
– O.O.Balance
12 hours ago
@O.O.Balance Digits are not allowed in the code for this challenge ;)
– Annyo
12 hours ago
@Annyo I knew I was forgetting something :(
– O.O.Balance
12 hours ago
Welcome to PPCG! This is a nice first answer. Yes, you do need to count
#include
and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…– O.O.Balance
12 hours ago
Welcome to PPCG! This is a nice first answer. Yes, you do need to count
#include
and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…– O.O.Balance
12 hours ago
@O.O.Balance Digits are not allowed in the code for this challenge ;)
– Annyo
12 hours ago
@O.O.Balance Digits are not allowed in the code for this challenge ;)
– Annyo
12 hours ago
@Annyo I knew I was forgetting something :(
– O.O.Balance
12 hours ago
@Annyo I knew I was forgetting something :(
– O.O.Balance
12 hours ago
add a comment |
up vote
2
down vote
Catholicon, 8 bytes
ċ//ĊǓĊ`Ė
Explanation:
/ĊǓĊ divide the first input by the doubled second input
/ `Ė divide that by pi
ċ ceil
New version (pi builtin made one byte, division parameters swapped), 5 bytes
ċ/π/Ǔ
add a comment |
up vote
2
down vote
Catholicon, 8 bytes
ċ//ĊǓĊ`Ė
Explanation:
/ĊǓĊ divide the first input by the doubled second input
/ `Ė divide that by pi
ċ ceil
New version (pi builtin made one byte, division parameters swapped), 5 bytes
ċ/π/Ǔ
add a comment |
up vote
2
down vote
up vote
2
down vote
Catholicon, 8 bytes
ċ//ĊǓĊ`Ė
Explanation:
/ĊǓĊ divide the first input by the doubled second input
/ `Ė divide that by pi
ċ ceil
New version (pi builtin made one byte, division parameters swapped), 5 bytes
ċ/π/Ǔ
Catholicon, 8 bytes
ċ//ĊǓĊ`Ė
Explanation:
/ĊǓĊ divide the first input by the doubled second input
/ `Ė divide that by pi
ċ ceil
New version (pi builtin made one byte, division parameters swapped), 5 bytes
ċ/π/Ǔ
edited 13 hours ago
answered 13 hours ago
Okx
12.4k27100
12.4k27100
add a comment |
add a comment |
up vote
2
down vote
MathGolf, 6 5 bytes
∞/π/ü
Semi-port of @flawr's Python 2 comment.
Takes the input in the order radius distance
.
-1 byte because ceil
builtin has just been added, replacing the floor+1
.
Try it online.
Explanation:
∞ # Double the first (implicit) input
/ # Divide the second (implicit) input by it
π/ # Divide it by PI
ü # Ceil (and output implicitly)
Nice answer! I'll have to admit, it's my fault that there are noceil
operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
– maxb
12 hours ago
4
I would like to see a proof that "Pi is rational"...
– Pakk
12 hours ago
1
@Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It isü
and works both with numericals and lists
– maxb
12 hours ago
@maxb That was fast. :D
– Kevin Cruijssen
9 hours ago
1
@Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that theceil
function is added. ;p
– Kevin Cruijssen
9 hours ago
add a comment |
up vote
2
down vote
MathGolf, 6 5 bytes
∞/π/ü
Semi-port of @flawr's Python 2 comment.
Takes the input in the order radius distance
.
-1 byte because ceil
builtin has just been added, replacing the floor+1
.
Try it online.
Explanation:
∞ # Double the first (implicit) input
/ # Divide the second (implicit) input by it
π/ # Divide it by PI
ü # Ceil (and output implicitly)
Nice answer! I'll have to admit, it's my fault that there are noceil
operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
– maxb
12 hours ago
4
I would like to see a proof that "Pi is rational"...
– Pakk
12 hours ago
1
@Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It isü
and works both with numericals and lists
– maxb
12 hours ago
@maxb That was fast. :D
– Kevin Cruijssen
9 hours ago
1
@Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that theceil
function is added. ;p
– Kevin Cruijssen
9 hours ago
add a comment |
up vote
2
down vote
up vote
2
down vote
MathGolf, 6 5 bytes
∞/π/ü
Semi-port of @flawr's Python 2 comment.
Takes the input in the order radius distance
.
-1 byte because ceil
builtin has just been added, replacing the floor+1
.
Try it online.
Explanation:
∞ # Double the first (implicit) input
/ # Divide the second (implicit) input by it
π/ # Divide it by PI
ü # Ceil (and output implicitly)
MathGolf, 6 5 bytes
∞/π/ü
Semi-port of @flawr's Python 2 comment.
Takes the input in the order radius distance
.
-1 byte because ceil
builtin has just been added, replacing the floor+1
.
Try it online.
Explanation:
∞ # Double the first (implicit) input
/ # Divide the second (implicit) input by it
π/ # Divide it by PI
ü # Ceil (and output implicitly)
edited 9 hours ago
answered 14 hours ago
Kevin Cruijssen
34.4k554182
34.4k554182
Nice answer! I'll have to admit, it's my fault that there are noceil
operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
– maxb
12 hours ago
4
I would like to see a proof that "Pi is rational"...
– Pakk
12 hours ago
1
@Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It isü
and works both with numericals and lists
– maxb
12 hours ago
@maxb That was fast. :D
– Kevin Cruijssen
9 hours ago
1
@Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that theceil
function is added. ;p
– Kevin Cruijssen
9 hours ago
add a comment |
Nice answer! I'll have to admit, it's my fault that there are noceil
operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
– maxb
12 hours ago
4
I would like to see a proof that "Pi is rational"...
– Pakk
12 hours ago
1
@Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It isü
and works both with numericals and lists
– maxb
12 hours ago
@maxb That was fast. :D
– Kevin Cruijssen
9 hours ago
1
@Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that theceil
function is added. ;p
– Kevin Cruijssen
9 hours ago
Nice answer! I'll have to admit, it's my fault that there are no
ceil
operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.– maxb
12 hours ago
Nice answer! I'll have to admit, it's my fault that there are no
ceil
operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.– maxb
12 hours ago
4
4
I would like to see a proof that "Pi is rational"...
– Pakk
12 hours ago
I would like to see a proof that "Pi is rational"...
– Pakk
12 hours ago
1
1
@Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is
ü
and works both with numericals and lists– maxb
12 hours ago
@Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is
ü
and works both with numericals and lists– maxb
12 hours ago
@maxb That was fast. :D
– Kevin Cruijssen
9 hours ago
@maxb That was fast. :D
– Kevin Cruijssen
9 hours ago
1
1
@Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the
ceil
function is added. ;p– Kevin Cruijssen
9 hours ago
@Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the
ceil
function is added. ;p– Kevin Cruijssen
9 hours ago
add a comment |
up vote
1
down vote
PHP, 47 bytes
<?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));
Try it online.
add a comment |
up vote
1
down vote
PHP, 47 bytes
<?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));
Try it online.
add a comment |
up vote
1
down vote
up vote
1
down vote
PHP, 47 bytes
<?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));
Try it online.
PHP, 47 bytes
<?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));
Try it online.
edited 13 hours ago
answered 13 hours ago
Titus
12.9k11237
12.9k11237
add a comment |
add a comment |
up vote
1
down vote
Jelly, 6 bytes
÷÷ØPHĊ
Try it online!
add a comment |
up vote
1
down vote
Jelly, 6 bytes
÷÷ØPHĊ
Try it online!
add a comment |
up vote
1
down vote
up vote
1
down vote
Jelly, 6 bytes
÷÷ØPHĊ
Try it online!
Jelly, 6 bytes
÷÷ØPHĊ
Try it online!
answered 13 hours ago
Erik the Outgolfer
30.7k429102
30.7k429102
add a comment |
add a comment |
up vote
1
down vote
Ruby, 29 bytes
->l,r{(l/Math::PI/r+=r).ceil}
Try it online!
add a comment |
up vote
1
down vote
Ruby, 29 bytes
->l,r{(l/Math::PI/r+=r).ceil}
Try it online!
add a comment |
up vote
1
down vote
up vote
1
down vote
Ruby, 29 bytes
->l,r{(l/Math::PI/r+=r).ceil}
Try it online!
Ruby, 29 bytes
->l,r{(l/Math::PI/r+=r).ceil}
Try it online!
answered 13 hours ago
G B
7,4761328
7,4761328
add a comment |
add a comment |
up vote
1
down vote
J, 10 9 bytes
>.@%o.@+:
Try it online!
add a comment |
up vote
1
down vote
J, 10 9 bytes
>.@%o.@+:
Try it online!
add a comment |
up vote
1
down vote
up vote
1
down vote
J, 10 9 bytes
>.@%o.@+:
Try it online!
J, 10 9 bytes
>.@%o.@+:
Try it online!
edited 12 hours ago
answered 12 hours ago
Galen Ivanov
5,92711032
5,92711032
add a comment |
add a comment |
up vote
1
down vote
JavaScript (Babel Node), 25 bytes
-2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy
a=>b=>-~(a/(b+b)/Math.PI)
Try it online!
Justa=>b=>Math.ceil(a/(b+b)/Math.PI)
is 32 bytes. :)
– Kevin Cruijssen
14 hours ago
25 bytes
– Shaggy
10 hours ago
add a comment |
up vote
1
down vote
JavaScript (Babel Node), 25 bytes
-2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy
a=>b=>-~(a/(b+b)/Math.PI)
Try it online!
Justa=>b=>Math.ceil(a/(b+b)/Math.PI)
is 32 bytes. :)
– Kevin Cruijssen
14 hours ago
25 bytes
– Shaggy
10 hours ago
add a comment |
up vote
1
down vote
up vote
1
down vote
JavaScript (Babel Node), 25 bytes
-2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy
a=>b=>-~(a/(b+b)/Math.PI)
Try it online!
JavaScript (Babel Node), 25 bytes
-2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy
a=>b=>-~(a/(b+b)/Math.PI)
Try it online!
edited 9 hours ago
answered 14 hours ago
Luis felipe De jesus Munoz
4,00421253
4,00421253
Justa=>b=>Math.ceil(a/(b+b)/Math.PI)
is 32 bytes. :)
– Kevin Cruijssen
14 hours ago
25 bytes
– Shaggy
10 hours ago
add a comment |
Justa=>b=>Math.ceil(a/(b+b)/Math.PI)
is 32 bytes. :)
– Kevin Cruijssen
14 hours ago
25 bytes
– Shaggy
10 hours ago
Just
a=>b=>Math.ceil(a/(b+b)/Math.PI)
is 32 bytes. :)– Kevin Cruijssen
14 hours ago
Just
a=>b=>Math.ceil(a/(b+b)/Math.PI)
is 32 bytes. :)– Kevin Cruijssen
14 hours ago
25 bytes
– Shaggy
10 hours ago
25 bytes
– Shaggy
10 hours ago
add a comment |
up vote
1
down vote
Julia 1.0, 20 bytes
f(d,r)=cld(d/π,r+r)
Try it online!
fixed..........
– gggg
6 hours ago
add a comment |
up vote
1
down vote
Julia 1.0, 20 bytes
f(d,r)=cld(d/π,r+r)
Try it online!
fixed..........
– gggg
6 hours ago
add a comment |
up vote
1
down vote
up vote
1
down vote
Julia 1.0, 20 bytes
f(d,r)=cld(d/π,r+r)
Try it online!
Julia 1.0, 20 bytes
f(d,r)=cld(d/π,r+r)
Try it online!
edited 6 hours ago
answered 8 hours ago
gggg
1,21656
1,21656
fixed..........
– gggg
6 hours ago
add a comment |
fixed..........
– gggg
6 hours ago
fixed..........
– gggg
6 hours ago
fixed..........
– gggg
6 hours ago
add a comment |
up vote
1
down vote
R, 39 32 bytes
-7 bytes Thanks to Giuseppe
function(d,r)ceiling(d/(r+r)/pi)
Try it online!
I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it
add a comment |
up vote
1
down vote
R, 39 32 bytes
-7 bytes Thanks to Giuseppe
function(d,r)ceiling(d/(r+r)/pi)
Try it online!
I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it
add a comment |
up vote
1
down vote
up vote
1
down vote
R, 39 32 bytes
-7 bytes Thanks to Giuseppe
function(d,r)ceiling(d/(r+r)/pi)
Try it online!
I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it
R, 39 32 bytes
-7 bytes Thanks to Giuseppe
function(d,r)ceiling(d/(r+r)/pi)
Try it online!
I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it
edited 5 hours ago
answered 7 hours ago
Sumner18
3015
3015
add a comment |
add a comment |
up vote
0
down vote
Lua, 61 58 57 bytes
s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))
Try it online!
The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
edit: Several ways, but nothing that saves bytes....
add a comment |
up vote
0
down vote
Lua, 61 58 57 bytes
s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))
Try it online!
The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
edit: Several ways, but nothing that saves bytes....
add a comment |
up vote
0
down vote
up vote
0
down vote
Lua, 61 58 57 bytes
s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))
Try it online!
The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
edit: Several ways, but nothing that saves bytes....
Lua, 61 58 57 bytes
s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))
Try it online!
The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
edit: Several ways, but nothing that saves bytes....
edited 11 hours ago
answered 12 hours ago
ouflak
15129
15129
add a comment |
add a comment |
up vote
0
down vote
Japt, 7 bytes
/MT/V c
Try it here
add a comment |
up vote
0
down vote
Japt, 7 bytes
/MT/V c
Try it here
add a comment |
up vote
0
down vote
up vote
0
down vote
Japt, 7 bytes
/MT/V c
Try it here
Japt, 7 bytes
/MT/V c
Try it here
answered 10 hours ago
Shaggy
18.1k21663
18.1k21663
add a comment |
add a comment |
up vote
0
down vote
Stax, 5 bytes
Vt*/e
Run and debug it
Vt* multiply by tau (2pi)
/ divide
e ceiling
add a comment |
up vote
0
down vote
Stax, 5 bytes
Vt*/e
Run and debug it
Vt* multiply by tau (2pi)
/ divide
e ceiling
add a comment |
up vote
0
down vote
up vote
0
down vote
Stax, 5 bytes
Vt*/e
Run and debug it
Vt* multiply by tau (2pi)
/ divide
e ceiling
Stax, 5 bytes
Vt*/e
Run and debug it
Vt* multiply by tau (2pi)
/ divide
e ceiling
answered 10 hours ago
recursive
4,9741221
4,9741221
add a comment |
add a comment |
up vote
0
down vote
C (gcc), 45 47 45 bytes
f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}
A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'
. We add one (r/r
) to force rounding to infinity.
Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.
Try it online!
add a comment |
up vote
0
down vote
C (gcc), 45 47 45 bytes
f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}
A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'
. We add one (r/r
) to force rounding to infinity.
Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.
Try it online!
add a comment |
up vote
0
down vote
up vote
0
down vote
C (gcc), 45 47 45 bytes
f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}
A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'
. We add one (r/r
) to force rounding to infinity.
Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.
Try it online!
C (gcc), 45 47 45 bytes
f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}
A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'
. We add one (r/r
) to force rounding to infinity.
Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.
Try it online!
edited 9 hours ago
answered 9 hours ago
gastropner
1,8201410
1,8201410
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f176328%2fnumber-of-rotations%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like
-DP=3.14
in compiler flags, that would defineP
as an approximation of pi, which is probably not what you intended– Annyo
10 hours ago