« first day (1825 days earlier)      last day (3021 days later) » 

10:04 AM
which one is better in your opinion?
 
@Cyoce Let me see... cyoce?
 
0
A: Sandbox for Proposed Challenges

Camil StapsSolve the quadratic formula code-golf math arithmetic The quadratic formula says that a quadratic equation of the form ax2 + bx + c = 0 is solved by x = (-b ± sqrt(b2 - 4 ac)) / (2 a). Task Write a program or function that takes a string ax^2 + bx + c and outputs the values of x for which thi...

 
@orlp The "paint Starry Night as close as you can to the original" challenge has you to paint Starry Night as close as you can to the original. So score both and send whatever is better scored.
 
@zyabin101 that doesn't answer my question
obviously I've scored both
the question is, what do HUMANS prefer
 
Neither really. On visceral impression, the second one. But they're both too "smudgy"
 
10:08 AM
@Sherlock9 well, they're 1KiB files :(
 
And the first one is better in broad strokes, while the second one has... I don't know what those are. They look like the little "eye floaties" you see when you're staring off into space
@orlp Fair enough. I'll say the first one
 
10:22 AM
hi.. could a C person please do me a favor. I would like to see the assembly for (n+1)%8 where n is an unsigned char
so I can compare it it to (n+1)%8 where n is an unsigned int
 
@Lembik Did you post that before?
 
but I am not sure how to do this.. I feel I have seen PPCG answers where they use some nice page to do that
@zyabin101 I asked it here before
 
@Lembik Then stop. Just stop re-asking the same question again!
 
@zyabin101 well... I didn't get an answer the first time and it has been 24 hours :)
and different people are here at different times
 
I think there's a unix command for disassembly, but otherwise I'm not sure, sorry
 
10:28 AM
@zyabin101 there is no difference really
 
ah ok thanks. I just thought I had seen some web pages in PPCG answers showing disassembly prettily
but I may have dreamt it
 
your 64-bit CPU does not have 8-bit registers
and AFAIK there is no operation with a width smaller than 32 bit
the only thing that changes is how memory gets loaded
but what actually happens in both cases is this
 
@orlp I was told that n+1 is a signed int if n is an unsigned char
 
uint64_t register = n; // this part might differ depending on the width of n
uint64_t result = (register + 1) % 8;
 
and then %8 is a moire expensive operation.. I want to check it is true
 
10:29 AM
well, there is one part I didn't touch on
 
@orlp the type promotion that happens in n+1 is the key part
 
I assumed that the input variable, n, is in [0, 8)
if that is not the case there might actually be a difference
 
the compiler can't know the range of n can it?
 
although, funnily enough, not this time
 
I mean the compiler just knows the type
 
10:31 AM
let's say you were doing % 7, not % 8
actually, no, due to promotion it won't change
never mind, I'm talking out of my ass
no, what I said earlier is correct
there is no difference
@Lembik this is not true
 
hang on.. 1 is a signed int
if n has a type that is "smaller" than signed int then n+1 gets promoted to signed int doesn't it?
 
yes
 
but if n is an unsigned int, say, then n+1 get promoted to unsigned int
so now the question is what is the difference between x%8 when x is a signed int and x is an unsigned int
in terms of the assembly produced
that's what I would like to see
 
@Lembik When I want to do that, usually I start the debugger in an IDE and open the disassembly around the point of interest.
 
@feersum oh ok.. thanks
 
10:34 AM
If you don't use any IDE you could probably do it with gdb.
 
@feersum much more complicated than necessary
gcc can output assemply
compile with -S
 
@orlp It's easier, if you already use an IDE.
 
also this is nice when fiddling
 
aha!
that looks awesome!
 
10:36 AM
but x + 1 is unsigned if x is unsigned
but yes, signed modulo is more expensive
 
right
I am trying to work out how much more
basically I want to see the assembly with and without optimisation
 
@Lembik that has nothing to do with your first question
never look at the unoptimized code by the compiler
 
Using the remainder operator with signed integers is something you'd rarely want to do anyway.
 
it's meaningless
 
@orlp why? It is the promotion that makes it a signed modulo
 
10:38 AM
Since it's not even a true modulus.
 
@Lembik no it's not
I just told you
x + 1 is unsigned if x is unsigned
 
are you sure? I though that if x is char then x+1 is signed
 
char is not (necessarily) unsigned
 
@Lembik Accepted answer:
 
it's usually signed
 
10:38 AM
204
A: Using GCC to produce readable assembly?

Bastien LéonardIf you compile with debug symbols, you can use objdump to produce a more readable disassembly. >objdump --help [...] -S, --source Intermix source code with disassembly -l, --line-numbers Include line numbers and filenames in output Example: > gcc -g -c test.c > objdump -d ...

 
@orlp are you saying char is usually signed?
 
yes
 
ah!
how about short?
 
always signed
char is the exception
signed char = always signed
unsigned char = always unsigned
 
10:39 AM
char = implementation dependent, usually signed
 
ok so how about any unsigned type smaller than int
add 1 to it, don't you get a signed type?
 
@Lembik why do you care about these small types?
 
Jan 22 at 12:38, by feersum
If either is unsigned the result is unsigned.
 
@Lembik for the third time, x + 1 is signed if x is signed
here's arithmetic works on your CPU
1. do everything inside the CPU in 64-bit (rarely 32 bit if you know what you're doing with some certain operations like integer division)
 
@orlp I heard you .. sorry if I appear deaf. I don't think you answered the question, what if you add 1 to a small unsigned type.
 
10:41 AM
2. be aware of where you're loading things in/out of memory, and then choose a data type appropriate
 
or did you mean iff?
 
@Lembik unsigned int
 
@feersum ah!
 
@Lembik for the 4th time
if x is unsigned
then so is x + 1
 
@orlp it was an "if" versus "iff" confusion. I really was reading what you wrote!
 
10:42 AM
@Lembik no it's not
you don't need the power of 'iff' here
if A then B
you asked me 4 times, 'but what if I have A, do I then have B?'
@Lembik look at it like this
 
ok so in summary. adding 1 to x never changes the signedness
which is the opposite of what I was told.. so thank you!
 
"if x is a fruit, then x + 1 banana is a fruit salad"
 
we have gone fruity! :)
 
and you ask me
but what if I add 1 banana to an apple?
 
I have gone back to my source to ask for an example where adding 1 changes the type from unsigned to signed :)
someone is wrong here and I don't know who :)
 
10:46 AM
@Lembik I am not wrong
 
:)
 
"adding 1 to x never changes the signedness"
I never claimed that
I'm not disputing it yet either
but I'm not certain 100%
 
oh.. when does that happen?
the overall claim from my source is that (n+1)%8 can produce much worse assembly than n%8
 
link to the source?
because that sounds like garbage
 
it's a person :)
at the risk of annoying you
"Otherwise, if the type of the operand with signed integer type can represent all of the values of the type of the operand with unsigned integer type, then the operand with unsigned integer type is converted to the type of the operand with signed integer type. "
 
10:48 AM
People are perfectly capable of spitting out garbage.
 
You're talking about operator conversion though, not not value conversion.
 
it is operand conversion
so it seems that unsigned char + signed int = signed int
assuming unsigned char is smaller than signed int
 
oh I forgot that one bit
no, I was incorrect about the always being unsigned part
either way, that doesn't change assembly
 
well it does when you do the %8 part
 
10:51 AM
the compiler is smart enough to know that x is [0, 255] when x is unsigned char
 
because then you have signed modulus
 
no you don't
 
@orlp that's what I would like to see.. if the compiler is in fact smart enough
 
@Lembik didn't I link that?
 
you pasted goo.gl/VEhjYL
 
10:52 AM
there
in fact, the +1 is free in this case :)
 
what is the atomic for?
(sorry I am poor at C)
 
@Lembik nothing
leftover from earlier file I guess
not sure why I didn't see it
 
thanks for all this
this is definitely the post informative chat room :)
 
@Lembik are you gna make an answer?
4
Q: Compress an image to a 4 KiB preview

orlpIn this challenge you will be creating an image preview compression algorithm. It's goal is to reduce an arbitrary image file to a 4 KiB preview image, that can be used to quickly identify images with very little bandwidth. You must write two programs (or one combined program): a compressor and ...

 
@orlp it's quite interesting with O3. Also I notice you are compiling it as C++
 
10:56 AM
yes, I was talking about C++
 
I hope it's the same in C
 
0
Q: Your favorite ruby trick

tokhiWhats your favorite ruby trick which people may not know about it? I like this simple one: Array.new(10) { rand 300 } => [140, 10, 134, 86, 120, 70, 283, 295, 186, 38]

 
C shouldn't be different, but there's probably one tiny detail that's different
 
@orlp probably not sadly.. lack of time
 
@Lembik do you have python 3 installed?
 
10:57 AM
yes
 
python3 -m pip install --user pillow
and then
import base64,io,PIL.Image
PIL.Image.open(io.BytesIO(base64.b85decode('iBL{Q4GJ0x0000DNk~Le0000d0000W2m=5B0H%16zW@LLJWxzjMIIp@MPHIFJ#$E2f;B{2CoMBscAryil4g95I81|Zh@Ln<KPWOvf|rw@ter+yW3aV*evEZoY;v=uM0+bp*#H0nK}keGRCobZkq5FQAq+ze25eH(F!#UfO3bFOD)N&<AyN0%G0qy;d5u*~Ym6yks#+BaTB}6=d_2Z;Vzlk&;0~~Hy_i{>+fAa)ZE?UH1H4;-#jy7d<b%%Vecw3+`%q(!07-C(^lrsAlm_hcKIHhG&w-n|TvQA6gffYd`#$#lIaq_aH#b${0Rr~{_dXIXm(EsD=KF%BDY~EjjR!sA$`(cljOEjUsu$E%b-uF%pXA;tc+?QOHOg1TfuI?XhSeXYZ9>3XUzpreH6$%YFH{Ofn-d0cv*IqjHQQU+M=7PX5(65sP+;Sbo9=+q2n+8p!-Vw8kW>i%<+}8cQmp`7FKsM?maF*)_e&%vv>nKK;O9GnTVux79!MU;XJ(P4OxFsdP$0<JBn1vPFS#C^=
 
I am slightly scared to do that :)
but I like your use of dissim
 
@Lembik why?
it just decodes some binary image data using base64
 
running code that I don't understand seems generally risky
but why are you asking me to run it?
 
@Lembik so I could surprise you with the output image
 
11:00 AM
@NewMainPosts This question should be not only closed as duplicate, it should be closed as opinion based, as the question text says.
 
that is what is worrying me :)
at work :)
I should go in any case...
 
either way
 
thanks for the help
 
that Python source is 1KiB
and generates that ^
 
very nice
if a little blurry :)
the bgp one is very impressive
 
11:01 AM
I have a better one
1KiB of FLIF, upscaled
 
nice!
is flif a new standard?
 
yes
lossless image encoder
with really good progressive decoding
 
very nice.. so you reduced the resoluion yourself, made a lossless encoding and then increased it?
this looks like a strange way to do lossy compression to me
 
well I also quantified it
 
but what I do I know :)
 
11:03 AM
to 10 colors
 
is any out of the box lossy compression much better?
 
what do you mean
better than FLIF?
or my 'weird' method?
 
FLIF is lossless. You have made a lossy compression algorithm by using FLIF in the middle of it
but there are plenty of lossy compression algorithms out there. I was wondering if any those do really well
 
1KiB is very restrictive
not sure
BPG is ok
but has really bad artifacts
btw, this is starry night with 4 colors quantized:
that's 2 bits per pixel, uncompressed!
 
might be fun to try the h.265 still image mode
@orlp that image is amazing!
 
11:07 AM
5 colors:
that entire picture only uses 5 colors :P
 
what size?
 
386x320
why?
 
because you are trying to get it down to 1KiB :)
 
well, as I said before, my solution already quantizes to 10 colors
(I tried all permutations, and 10 colors gave the best result)
 
ok.. do you have a bpg encoder?
 
11:09 AM
not installed
 
 
1 hour later…
1:04 PM
@Doorknob 3am utc right?
 
@GamrCorps Good morning, then!
 
Morning!
 
@Doorknob UTC?
 
@GamrCorps It's already day in Russia.
 
in The 2nd Monitor, 9 mins ago, by Dan Pantry
((a … → b) … → [a] → *) → (a …, Int, [a] → b) … → [a] → *)
are there any ninjas around who can read this ninja speak
 
1:07 PM
@GamrCorps yes
 
@Quill We all only know ninja'd, our all-out weapon word. Someone can maybe know the word katana, though.
 
@mınxomaτ yes
 
UTC?!?!?!
 
Ok I should be able to do that time then
 
@Quill YES!?!?!?
 
1:07 PM
@zyabin101 cat(meme)ana
 
because I realised after that it's an ES6 specific question
and that's not an ES6 feature or even ES7, it's like ES4 and deprecated
 
@Quill For ES5 or elderly features of ECMAScript, see Tips for golfing in JavaScript.
 
Yeah, it seemed to be present in that one, so I simply deleted by answer and whistle-walked away like nothing happened
 
@Quill Oh, I see.
I like with. Makes canvas much less of a pain
 
 
1 hour later…
2:44 PM
chat ees ded
no big surprise
 
user image
4
 
'morning, folks ^^
 
Good morning!
 
3:10 PM
0
Q: Official Dyalog APL 2016 Year Game

NBZA bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". Enjoy! The Objective Find APL expressions involving exactly the digits 2 0 1 6 in that order to equal the numbers 0 to 100. For example: 20=16 ×2016 2⌊016 2+0+1*6 ... The aim is to use as few characters as pos...

 
(removed)
YAAAAY
Blame caching
Even such a nice factorization: 73 * 137
Palindromic number + palindromic factorization = sweet=)
 
:D
I won't upvote :P
 
downvotes
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Thank you <3
Does anyone want a free downvote?=)
 
@flawr 17 82 257 626 1297 2402 4097 6562 10001 14642 20737 28562 38417 50626 65537 in bases 2..16, your rep.
 
3:16 PM
@CᴏɴᴏʀO'Bʀɪᴇɴ Why did you omit base 1?
 
@flawr I am not putting 10001 characters in the chat :P
 
Oh no, it won't even work. Unary has only one symbol
Now you interpreted 10001 as number in those bases, and convertet it to base 10, right?
 
Yeah. parseInt(10001,rep)
10011100010001 111201102 2130101 310001 114145 41105 23421 14642 10001 7572 5955 4724 3905 2e6b 2711 to bases 2..16
 
11 in base 10000
 
always nice :D
I wonder if there is a number x so that the prime factorization of x, when concatenated, represents x in some base b.
Nontrivial, of course.
 
3:21 PM
 
What's the prime factorization of 1? --oh
 
Trivially true for all primes. (And 1.)
 
Is it? 5 → 1 * 5 → 15?
 
Ah, wait
 
3:23 PM
iirc 1 is omitted
 
Yeah, putting one up there isn't really useful, is it =P
 
5 = 1 * 1 * 1 * ... * 1 * 5 = 111...15 :D
 
Does the order matter?
Or can you arrange them in any order?
 
I was thinking "sorted by value, then concatenated", but either would be interesting.
 
I usually see it from highest power to lowest, then numerically increasing within
3⁴ * 2² * 7² * 5
 
3:25 PM
Are you new here or is this just a new account?
 
Ah, sorted by order.
 
Or was it decreasing? Can't recall.
Me? I'm a week old, although I've been looking around PPCG for a couple of months now
 
Welcome to PPCG then=)
 
Thank you! ^^
 
For our purposes, the factorization would be 2 * 2 * 3 * 3 * 3 * 3 * 5 * 7 * 7 = 223333577
 
3:26 PM
@CᴏɴᴏʀO'Bʀɪᴇɴ 49 = 77 = 49 in base 6
lol
 
\o/
Let's call these numbers "B-reptilian numbers"
cuz why not
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Why?
 
Mainly trying to be clever with your avatar, as you found the first nontrivial reptilian number :P
 
Lol, but you see that 77 does not make much sense in base 6?=)
 
oh shizzle
my brain is dead XD
 
3:53 PM
@flawr Now searching for reptilian numbers.
(For bases up to 16)
hi @quartata
your avatar is still creepy
 
4:05 PM
Testing a message....
Ok, it worked
 
dammit, mine didn't
5
 
4:54 PM
@Dennis Can you please pull from MATL's repo?
 
  o      .-------.
 -|-|>===| [001] |
 / \     '-------'
 

« first day (1825 days earlier)      last day (3021 days later) »