« first day (1754 days earlier)      last day (2087 days later) » 

12:08 AM
0
Q: shortest code to copy a file with incremented pattern

user47350let’s say I havesomefile runningsomescript somefile dir 2 (where 2 represent the pattern length) would copysomefiletodirso thatdirwould copies ofsomefilewith the following pattern : 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 0g 0h 0i 0j 0k 0l 0m 0n 0o 0p 0q 0r 0s 0t 0u 0v 0w 0x 0y 0z 0A 0B ...

 
@TanMath Sorry, I was in my car. I haven't quite figured out your code yet. I'll take another look a bit later.
 
@Dennis Do you CJam while driving? I've heard that's the leading cause of traffic collisions among code golfers.
 
guys
I have a new profile picture
 
@AlexA. No, I just got home. :P
 
@orlp It's the diagvote!
 
12:22 AM
Seriously, kids, don't CJam and drive!
 
(Used by the dianoga.)
 
@Dennis The C doesn't stand for "car"? :P
 
Cherry AFAIK.
 
(I know, I was kidding)
It should be "cram." CramJam.
 
On one occasion, I pulled over to post an answer though. It was a CnR, and the deadline would have had passed if I had waited until I got home.
 
12:24 AM
 
@Dennis Now that's dedication.
4
 
I didn't mind the robbing points, but the cop answer was shorter than my shortest one...
Hasty first revision posted from the side of the road:
 
later...
> added 2506 characters in body
2
 
@El'endiaStarman I would have called it obsession, but I like your wording better.
 
@orlp Ah yes, the fabled no-vote.
 
12:29 AM
Sep 17 at 1:15, by Doorknob
user image
 
did you know that my reputation is OVER 9000?!
 
@Doorknob Downcarrot?
 
Mine's over 1337 :P
 
I now officially have 1 rep point on codegolf for every 5 I have on stackoverflow
 
12:30 AM
mine are almost equal
 
I feel like I should write a sort of lore to PPCG :P\
 
by the way
I'm done now
 
I have almost no rep on Stack Overflow. :P (After taking the 100-point rep bonus for passing 200 rep on any site into consideration.)
 
I optimized the constants
inline double fast_sin(double x) {
    // Polynomial constants generated with sollya.
    // fpminimax(sin(x), [|1,3,5,7|], [|D...|], [-pi/2;pi/2]);
    // Both relative and absolute error is 9.39e-7.
    const double magicround =  6755399441055744.0;
    const double pi         =  3.14159265358979323846264338327950288;
    const double invpi      =  0.31830988618379067153776752674502872;
    const double a          = -0.00018488140186756154724131984146140;
    const double b          =  0.00831189979755905285208061883395203;
 
My PPCG, meta.SE, and SO rep are all within a range of 2000
 
12:32 AM
maximum error is now 9.39e-7 (funnily enough both absolute and relative), in ~5 cycles
 
oh, spotted an optimization
haha
guess I'm not done
 
....nice...r.
 
uint64_t period = u.i & 1;
period << 63
notice something useless about this?
 
the & 1? :P
 
12:34 AM
exactly
 
@orlp My PPCG / my SO rep is very close to (within 0.007 of) pi + gamma/2.
 
... what
 
Yeah
 
What number is gamma?
 
0.5772156649015...
The Euler–Mascheroni constant (also called Euler's constant) is a mathematical constant recurring in analysis and number theory, usually denoted by the lowercase Greek letter gamma (). It is defined as the limiting difference between the harmonic series and the natural logarithm: Here, represents the floor function. The numerical value of the Euler–Mascheroni constant, to 50 decimal places, is 0.57721566490153286060651209008240243104215933593992…. == HistoryEdit == The constant first appeared in a 1734 paper by the Swiss mathematician Leonhard Euler, titled De Progressionibus harmonicis...
@Doorknob abs((12570 / 3671) - (π + γ/2)) --> 0.0060
 
12:40 AM
interesting
my PPCG rep / my Puzzling rep is close to 11 + 1/(4pi)
apparently
 
:O
 
@orlp The & 0xffffffff is also redundant, as far as I can tell.
 
@orlp u r gud c++
 
and my Puzzling user ID / my PPCG user ID is close to pi to the -4
 
Whaaaaat
Math everywhere
Math Overflow
 
12:43 AM
...
 
2^2 <= 3
 
Oh no, I mathed everywhere.
 
ew
 
@Calvin'sHobbies In Z/2Z, 2^2 = 2*2 = 0 and 3 = 1, so indeed 2^2 <= 3.
 
12:46 AM
> In Z/2Z
O_o
 
P ≈ NP
 
But then <= has no meaning.
 
@Doorknob The integers modulo 2
 
oh
that makes more sense
 
pi mod e = pi mode
 
12:48 AM
Pie a la mode
 
only in pitalics
 
Edna Mode
......and guest.
 
@feersum it is not
u.i & 0xffffffff takes the least significant 32 bits of the 64-bit value u.i
 
so I was trying to find something interesting about the inverse of my PPCG user id...
THANKS WolframAlpha...
 
u.i & 0xffffffffffffffffull would be redundant
 
12:51 AM
@Doorknob hahaha...
 
@orlp But you immediately truncate it to 32 bits.
 
If they were both signed it would matter, but I think it doesn't if either is unsigned.
 
@Calvin'sHobbies totally 7
 
@Calvin'sHobbies WHY CAN'T I PICK ALL?!?
 
12:53 AM
@El'endiaStarman that's irrational
 
@Doorknob Not to be a spoilsport, but that should work for my PPCG ID as well.
Better actually, since it's higher.
 
Actually it doesn't matter even if they're both signed.
 
@Calvin'sHobbies one vote for everything except phi. Sorry @PhiNotPi :P
now pi's winning which is wrong because 7 is the best irrational
 
test
 
@Doorknob I think I was the only vote for e.
 
12:54 AM
@feersum it wouldn't matter if both were unsigned
not sure how sign extension works when one is unsigned and the other is signed...
just to be safe I truncate, but I guess it could be redundant
(because the sign extension is crucial in this case)
fun fact!
tan(x)*tan(x+pi/2) = -1
 
0
A: Sandbox for Proposed Challenges

El'endia StarmanPythagoras' Other Leg code-golf Pythagoras had his leg blown up in the war. It had to be amputated, and though he nearly died, he pulled through and made a full recovery. Now, after a year of walking with crutches, he gets the privilege of getting a prosthetic leg! Thing is, though, there are s...

 
lol, "to be safe"
flaming undefined behaviors everywhere but let's be safe now :P
 
 sin(x)cos(x)
-------------
-cos(x)sin(x)
 
well, AFAIK this code is perfectly well behaved under IEEE754 and two's complement
 
I'm not saying it won't work.
What are you using this for?
 
12:59 AM
you're right though, it seems that it is redundant
still not removing though :P
@feersum fun
I enjoy writing fast code
 
Applied fun or theoretical fun?
 
right now I'm not using this
so I guess theoretical
but the function itself could be practically useful
 
> theoreticla
Just because @AlexA. probably missed it.
 
@El'endiaStarman you saw nothing
 
[whistles]
 
1:00 AM
@El'endiaStarman I appreciate you saving this moment in time for me :)
 
:)
Hedgehogs love birds.
They're tasty.
 
uh
 
@feersum this is an old project of mine though
only recently I laid my eyes on sollya, which allowed me to compute the minimax polynomial
so I finished it
(before I used a hand-generated polynomial based on the following set of equations)
f(x) = ax^5 + bx^3 + c
f(pi/2) = 1
f'(pi/2) = 0
f(pi/6) = 1/2
 
1:03 AM
@Calvin'sHobbies trafficsine?
 
> trafficsine
 
@Calvin'sHobbies wat votes for all of them
 
lol
> leasecosine
lolz
 
Cosign a lease
 
sin wins though
it's the primitive
although, what about cos
 
1:04 AM
Trigonometry class should really be called sin city.
 
can a good argument be made which is more primitive of sin and cos?
 
yes
 
@orlp sin(0) = 0 and sin(x) ~= x when x is small.
 
@MitchSchwartz Hi there, I just sent an email to shinh to have the deadlines synchronised. I have to admit, it didn't occur to me that the problems could be solved with a similar strategy until I noticed your 116 char submission. Great job by the way! I eagerly wait to study your submissions :)
 
@El'endiaStarman buuut cos(x) = cos(-x)
 
1:06 AM
@Doorknob sin(-x) = -sin(x)
Also cool...
OH. AND...d/dx sin(x) = cos(x).
 
can a good argument be made which is more primitive of sin and -sin?
 
sin(x) = sin(x)
 
cos has a better formula in terms of e^x.
 
@Calvin'sHobbies sin^2 is positive, so pick the one with the same sign.
 
"Cos" is terrible, lazy textual slang for "because."
 
1:08 AM
can a good argument be made which is more primitive of sin(x) and cos(x-pi/2)?
 
My favorite identity though is log(xy) = log(x) + log(y)
 
Logalogalogalooooog!
 
I prefer ln(a^x) = x ln(a)
 
@CᴏɴᴏʀO'Bʀɪᴇɴ e^(pi*i) = -1
 
Hello all!
 
1:09 AM
@CᴏɴᴏʀO'Bʀɪᴇɴ log(1) = log(-1) + log(-1)
:D
 
log_a(x) / log_a(b) = log_b(x)
 
@orlp ಠ_ಠ
 
@Doorknob That is actually false did u no
 
@Doorknob That one is good to othough
 
That is cool though. :P
 
1:10 AM
@El'endiaStarman communist shrew ;)
 
@AlexA. are you sure?
 
@orlp #mathtrollin
@Doorknob ya
 
my calculator says it's right :P
(I'm in the middle of doing math homework actually so I have it right here)
 
@Calvin'sHobbies I'm sure he's wise though, so he probably has a reason... :P
 
ur calculater isnt rite
 
1:10 AM
@AlexA. AFAIK it's true
why is it false?
 
e^(pi*i) = -1.00000000001
 
@orlp I'm #mathtrollin
 
I've used that log base conversion before. It's definitely true.
 
Hello? What is going on?
 
Of course that shit is true
 
1:11 AM
@CᴏɴᴏʀO'Bʀɪᴇɴ GASP
 
@CᴏɴᴏʀO'Bʀɪᴇɴ e to the pi minus pi :P
Also, I hear the 4th root of (9^2 + 19^2/22) is pi.
2
 
IIRC, e^(pi*sqrt(163)) gets really close to being a whole number.
 
@Calvin'sHobbies ಠ_ಠ
 
@Calvin'sHobbies no you didn't just do that
 
1:12 AM
@Calvin'sHobbies seriously?
 
@Calvin'sHobbies ಠ_ಠ + angry
 
suspends Calvin for rick rolling
2
 
Anonymous
@Calvin'sHobbies You adsjflkdshfkjsndfjsbguidfjgn
 
I couldn't help it :p
 
@El'endiaStarman that would be (╯ಠ_ಠ)╯︵ ┻━┻
 
1:13 AM
@El'endiaStarman yup
 
ಠ_ಠ
 
Brilliantly executed, though.
 
3987^12 + 4365^12 = 4472^12
 
Is one still rick rolled if one closes the tab while the loading animation is still displayed, and there is no light or sound?
 
@Doorknob damnit
I was searching for that one
 
1:14 AM
@feersum One is ricked but insufficiently rolled
 
@orlp I knew the title :P
 
this is pretty rad
 
Impressive.
 
@orlp Whoa. Is that you?
 
1:18 AM
@AlexA. eehm what
that video is clearly taken outside
of course it isn't me
 
Hahaha
 
There's an outside now??
 
wait what
HI @QUARTATA
 
@Dennis please please don't be working on a Bubblegum flag of france
 
"Working"?
How do you work in Bubblegum
 
Anonymous
1:20 AM
Ruling question:
 
The computer instantly generates teh answer for you.
 
 
Anonymous
Oh wait nvm the question answers it
 
> teh answer
 
@quartata If you can get to 38 bytes, I won't post mine.
 
1:21 AM
@Dennis Wow he's being so merciful
Thank you based golfer
 
> based golfer
 
1:35 AM
Mini challenge: Put a string with two digits and one plus sign in the order [digit]+[digit]. e.g. 93+` 3+9 +93 would all become 9+3 or 3+9
 
@Calvin'sHobbies Julia, 36 bytes: s->(m=matchall(r"\d",s))[1]*"+"*m[2]
@Dennis I can't even believe how many bytes you saved
 
Anonymous
@Calvin'sHobbies ,O'+O-W'+O+('+O-W@
 
Anonymous
18 bytes
 
@AlexA. I can't believe how I saved it. I hadn't made that mistake in a long time...
@Mego Seriously?
 
Anonymous
1:48 AM
@Dennis Not sure if dumbfounded or confirming language name
 
It works on many levels.
 
Anonymous
Wait I can do better :o
 
@Dennis q = get all input, e! = get all unique permutations, -2 = -2, = = get index -2 of the permutations -> is this all correct?
 
Anonymous
,'+O-W'+O+('+O-W@
 
@Calvin'sHobbies x=>x[0]+x[1]+x[2] JavaScript ES6 17 bytes
 
1:50 AM
 
Anonymous
17 bytes, I out-golfed Minkolang :P
 
Anonymous
Oh bugger that doesn't work
 
Anonymous
Still at 18
 
@Calvin'sHobbies Yes, that is correct. e! actually sorts the permutations, so it ignores the input order.
 
...sort! Oooh!
 
1:51 AM
@Dennis ah, was just about to ask
 
Anonymous
Get input, explode into CP437 ordinals, push "+", explode, subtract top two, while truthy: add ordinal of "+" and rotate entire stack, swap top two
 
Anonymous
It cycles through the stack until "+" is on top, then swaps the top two elements
 
Anonymous
Wait I'm dumb
 
Anonymous
,;'+=WX(;'+=W@
 
Anonymous
1:52 AM
Same idea, less bytes
 
Anonymous
...I really need a sort command
 
@Calvin'sHobbies APL, 10 bytes: {¯1⌽⍵[⍋⍵]} try online
 
I BEAT APL! :D
 
You beat Alex
 
1:54 AM
true
 
How would one do ' '.join(someList) in cjam?
 
[list]S*
 
@Calvin'sHobbies In Julia, since you asked, it's join(someList, " ").
 
1:59 AM
Hmm. It'd be possible to do this task in three bytes with the right (possibly yet-to-exist) language: \rotateRight(\sort(\input( with implicit printing at the end.
 

« first day (1754 days earlier)      last day (2087 days later) »