Automatic commit of irc logs
[ipdf/documents.git] / irc / #ipdf.log
index 8799a23..370fe6b 100644 (file)
 16:17 -!- matches [[email protected]] has joined #ipdf
 16:17 -!- Irssi: #ipdf: Total of 2 nicks [1 ops, 0 halfops, 0 voices, 1 normal]
 16:17 -!- Irssi: Join to #ipdf was synced in 15 secs
+--- Day changed Wed Jun 25 2014
+21:41 < matches> So... if we need to put a HTTP server in IPDF I've got us covered...
+21:44 <@sulix> You terrify me.
+21:45 < matches> I still have to work out Websockets
+21:45 < matches> They are silly
+21:46 <@sulix> I take it they aren't compatible with regular sockets.
+21:46 < matches> Well you use a TCP socket, but they aren't just plain text
+21:46 < matches> There's a protocol on top of it
+21:46 < matches> It's wired
+21:47 < matches> *wierd
+21:47 < matches> There are frames and things
+21:47 < matches> And copious amounts of base64 encoding the SHA1 hash of a string prepended to a magic string
+21:48 < matches> Apparently this makes it more secure
+21:48  * sulix looks doubtful.
+21:48 <@sulix> I could understand it being more secure if they actually encrypted things.
+21:48 < matches> They have wss:// as well which is just the same thing through ssl
+21:48 < matches> Yes it doesn't make sense
+21:49 <@sulix> But plain "boring" TCP has been used since (I am assured) the beginning of time and there are still one or two things that use it which are not currently being hacked into.
+21:49 < matches> Haha
+21:49 < matches> I'd like websockets so I can control my robot via my phone through its web browser...
+21:50 < matches> I can probably do that without websockets but it will also be useful for humphrey the rabbit
+21:50 <@sulix> Surely with plain old TCP you could control your robot via telnet, which is more awesome and just as user friendly.
+21:51 < matches> :P
+21:51 < matches> It will have a webcam image though
+21:51  * sulix mutters "ASCII art" under his breath.
+21:52 < matches> I figure if I implement everything in C++ it will be less "Webby"
+21:52 < matches> And more segfaultastic
+21:52  * sulix has a new favourite word.
+--- Day changed Thu Jun 26 2014
+14:58 < matches> I think the WebSocket RFC put this "Framing" business in just to confuse people
+14:58 < matches> My RFC Compliant* WebSocket server just sends the entire message in a single frame
+14:59 < matches> Doesn't TCP already do framing or something
+15:00 < matches> I mean, they specifically allow for frames with up to 2^63 bytes
+15:00 < matches> Sorry, bits not bytes
+15:02 < matches> So server -> client is pretty much TCP but you stick some stupid frame guff on the message
+15:02 < matches> client -> server involves... "masking"
+15:02 < matches> There are several long paragraphs on it
+15:10 < matches> I'm going to pretend this is related to precision
+--- Day changed Wed Jul 02 2014
+17:30 < matches> I put the code repository on github
+17:32 < matches> This is where a more hip and cool person would say something like "#yolo" but I prefer to wonder how I got 26K of lines and you have 65K...
+17:32 < matches> "How many lines of code does it take to draw a rectangle?" 91000
+--- Day changed Fri Jul 04 2014
+12:59 < matches> Found my rational bug
+13:00 < matches> ...
+13:00 < matches> Copy paste strikes again
+13:00 < matches> My operator/ looked suspiciously similar to operator+ -_-
+13:00 < matches> -____-
+13:02 < matches> Not sure how it got like that, it was definitely working at one point
+13:02  * matches should probably use git properly
+13:12 < matches> Pushed it
+13:21 < matches> So yeah, it should work fine until you zoom
+13:21 < matches> Then crazy things happen
+16:44 < matches> I think all the references you added at the last minute break my litreview
+16:45 < matches> (he says several months later :P_
+21:00 <@sulix> Question: in Rational::Simplify(), why is (-P)/(-Q) becoming (-P)/(Q) rather than P/Q?
+21:01 <@sulix> Shouldn't P = -P here? http://git.ucc.asn.au/?p=ipdf/code.git;a=blob;f=src/rational.h;h=41cce09078b4e96eb17a6bb6e28478ea64637b57;hb=HEAD#l74
+21:02 <@sulix> Also zoom can be improved (but not totally fixed) by reducing precision when overflow would be possible.
+21:19 < matches> Yeah, that's the idea of using the Stern Barcot tree Tim was talking about
+21:20 < matches> Which I still need to read about
+21:20 < matches> Also yes P should be -P because I am just that amazing at maths
+21:22 < matches> In other news assembly happened
+21:22 < matches> http://git.ucc.asn.au/?p=ipdf/code.git;a=blob;f=src/tests/add_digits.s
+21:22 < matches> Which no doubt has terrible bugs in it :P
+21:23 < matches> It was a bit confusing how passing and returning arguments with x64 was completely and utterly different from x86 and almost every tutorial is from at least ten years ago talking about x86
+21:24 < matches> x64 is actually much easier though
+21:25 < matches> At least, I think they are different, I didn't have to mess with the stack which seemed to be a thing with x86 and also that motorolla language we used in first year
+21:25 < matches> Just got all the arguments in a bunch of registers
+21:31 <@sulix> I think I just worked out why you have 16 "inc" instructions, and am loving it!
+21:32 <@sulix> inc doesn't change flags!
+21:32 < matches> I wonder if it would be faster to just store the carry flag in a register though
+21:33 < matches> Actually probably not because there'd be branches involved
+21:33 < matches> Hmm
+21:33 <@sulix> Traditionally, mucking about with flags is slow.
+21:33 < matches> Yep cool
+21:34 < matches> I've got the AMD64 ABI
+21:34 < matches> Chapter 2 is a good one
+21:34 < matches> "Software Installation"
+21:35 < matches> "This document does not specify how software must be installed on an AMD64 architecture machine"
+21:35 < matches> End chapter
+21:35 <@sulix> Just a thought, can use use the lea instruction instead of all of those incs.
+21:37 <@sulix> Like lea rsi, [rsi+8h]?
+21:37  * sulix ponders.
+21:38 < matches> Maybe, my assembly is very rusty and was based on those ELEC1301 labs in the first place...
+21:38 < matches> I don't even remember if they had lea
+21:39 <@sulix> (Also I just got a message from KDE: "could not launch a process. perhaps you have reached the limit of running processes")
+21:39 < matches> :S
+21:40 < matches> When did you last reboot?
+21:40 <@sulix> This morning, actually.
+21:40 < matches> Integer overflow in PID?
+21:40 <@sulix> It looks like it was an out-of-memory problem.
+21:40 <@sulix> On a related note, the intel instruction set documentation is a 3 and a half thousand page pdf.
+21:41 <@sulix> and firefox has a PDF viewer written in javascript.
+21:41 <@sulix> ...that runs by default.
+21:44 < matches> Hahaha
+21:44 < matches> Yes, pdf.js is apparently the best thing since sliced bread...
+21:45 < matches> I'm having some difficulty with lea, possibly the syntax
+21:47 < matches> "lea (%rsi+8), %rsi" is wrong
+21:48 <@sulix> Yeah, gcc's assembler uses whacked syntax.
+21:48 < matches> I thought it was just () instead of [], add % to all the registers, and swap destination and source
+21:48 <@sulix> http://git.ucc.asn.au/?p=ipdf/code.git;a=blob;f=src/tests/add_digits.s;hb=HEAD
+21:49 <@sulix> They replaced the arithmetic operators with strange things, too.
+21:49 < matches> Riight
+21:49 < matches> Thanks
+21:49 < matches> So 8(,%rdi,1) means [rdi+8]
+21:49 < matches> That is dumb
+21:49 <@sulix> I'm not sure if it's worth using nasm or the ".syntax intel" directive.
+21:51 < matches> Hopefully there won't be too much more assembly to write...
+21:51 <@sulix> Technichally lea (and other memory addressing instructions) take the form "[register+register*(1,2 or 4)+(number)]" in intel and "number(%register,%register,(1,2 or 4))"
+21:51 <@sulix> in gcc
+21:51 < matches> ok
+21:51 < matches> Well once I know the syntax I can cope with it
+21:51 < matches> But all the documentation being written in a different syntax doesn't help :P
+21:52 <@sulix> Yeah, there are a lot of people who hate gcc syntax, which was an (unsuccessful) attempt to make assembly for different machines more consistent)
+21:52 < matches> I decided to go with it because I vaguely remembered your commander keen patches looked like they were in gcc syntax :P
+21:53 <@sulix> Hah: they were in "ckpatch" syntax.
+21:53 <@sulix> And were just the final output bytes.
+21:53 < matches> The memory can play strange tricks...
+21:54 <@sulix> I used the "debug.com" utility that came with dos to assemble them, which let you write assembly to arbitrary memory.
+21:54 <@sulix> and then read the contents of that memory to see what it assembled down to.
+21:55 < matches> So, I need subtraction and multiplication but not division to implement arbitrary rationals
+21:55 < matches> I'll try sort those out tomorrow
+21:56 < matches> I'm pretty sure I'm doing better than at least one arbitrary integer representation
+21:56 < matches> Which had a int32_t word and int64_t "double" word
+21:56 < matches> So they could tell if they had a carry by doing the additions using double words
+21:57 < matches> The code in C was longer than add_digits is in assembly
+21:57 < matches> Although to be fair it might actually work on things that aren't amd64
+21:57 <@sulix> Well, the good news is that there's an "sbb" instruction like "adc"
+21:57 < matches> Excellent
+21:58 <@sulix> The bad news is that multiplication is harder.
+21:58 < matches> Yeah, at least I don't need division though
+21:59 < matches> Although converting it to a string will be annoying
+21:59 <@sulix> IIRC, the IMUL instruction gives an output twice as long as the inputs, to prevent overflow.
+22:00 <@sulix> Converting to a string won't be so bad if you get division done.
+22:00 <@sulix> And you can always just implement multiplication and division by slow recursive addition/subtraction.
+22:03 < matches> There's a bunch of papers on number representations that use things that aren't floats or rationals from a quick look
+22:04 < matches> I guess I just need to implement as many things as possible and compare them all
+22:04 < matches> Seems easy enough...
+22:04 < matches> (Famous last words)
+--- Day changed Sat Jul 05 2014
+11:09 < matches> Well... subtraction took me two seconds
+11:09 < matches> Should probably have just done it last night
+11:09 < matches> I got distracted
+11:09 < matches> By someone actually using my websocket library
+11:09 < matches> Does this mean I'm officially an open source developer now
+11:09 < matches> I didn't even give it a license :S
+11:11 < matches> Hmm
+11:12 < matches> Multiplication...
+11:12 < matches> It is tempting to just use a for loop and call the += operator...
+11:40 < matches> I'll do that for now I think
+11:41 < matches> Once += actually works
+11:41 < matches> Turns out I will definitely need division also
+11:42 < matches> I was looking at the rationals going "There are no divisions here!"
+11:42 < matches> But there are
+11:42 < matches> In the gcd
+11:42 < matches> Mind you maybe I don't need to call gcd if I have arbitrary integers :P
+11:42 < matches> Just use all the memory
+12:39 < matches> Ok for loop for multiplication is not easy
+12:39 < matches> Bah
+12:39 < matches> Having to actually learn assembly properly
+12:40 < matches> I mean I could use a for loop but it would have to use an Arbitrary integer and take a very long time...
+12:47 <@sulix> There's no need to have a for loop index > 64bit because there will never be enough memory for an integer that big.
+12:47 < matches> True
+12:54 < matches> Putting "_asm" in filenames so that our Makefile can do the .s files is kind of irritating
+12:54 < matches> Would naming them .cpp work? That would be even more irritating though!
+12:54 < matches> Oh well it compiles
+12:58 < matches> I bet it turns out 128 bit integers would have been more than sufficient for any zoom range people could feasibly get to by scrolling
+13:15 <@sulix> I'm told 256-bit integers can represent the visible universe to the width of a proton or something.
+13:45 < matches> I might put a maximum length in once this works
+13:45 < matches> So I'm not doing a Java
+13:46 < matches> Where 1/3 becomes "Runtime Exception!"
+13:46 < matches> That's with BigDouble not BigInt but whatever
+14:00 < matches> I must admit, assembly is pretty nice for this sort of thing
+14:00 < matches> At least, the inner operations
+14:00 < matches> Not for managing the memory
+15:29 < matches> Alright. We have an Arbint class that is equivelant to an int64_t when it only has one digit.
+15:30 < matches> I'm not sure how to test that extra digits function correctly
+15:30 < matches> Other than just looking at a few cases and going "Yep that looks right" :S
+16:40 < matches> Well... somewhere along the way I lost kcachegrind and now I seem to have to run dist-upgrade to get it back
+16:41 < matches> Currently 10% of the way through upgrading tex-live...
+16:41 < matches> The mystery of just how shitty the Arbints are will have to wait
+16:42 < matches> Well it's clear they are shitty but I suspect there is a bug in division
+16:42 < matches> Maybe I should actually read my code
+16:42 < matches> Blargh
+16:47 < matches> Ok constructing a rational takes infinite time
+16:51 < matches> Ah, 1 % 1 == 1
+16:51 < matches> That is definitely not correct :P
+17:56 < matches> Oh my goodness I just rendered a frame
+17:56 < matches> On the GPU...
+18:00 <@sulix> Hmm...  {add,sub}_digits_asm.s are missing from git.
+18:05 < matches> Really
+18:05 < matches> Whoops
+18:07 < matches> There you go
+18:07 < matches> Addition, subtraction, multiplication should be fine, I need to actually do division properly
+18:08 < matches> Also probably pow at some point
+18:08 < matches> Since pow still just casts things to doubles
+18:22 <@sulix> It works!
+18:22 <@sulix> (Eventually)
+18:24 < matches> Haha
+18:24 < matches> Of course it's still in the single digit range
+18:24 < matches> Or did you manage to wait long enough to zoom a bit
+18:25 < matches> I'm sure I can make this division better if I use some kind of binary searchish type algorithgm
+18:25 < matches> I could look up the proper algorithm too I guess
+18:25 <@sulix> Yeah, I was thinking binary search.
+18:26 <@sulix> You'd want a decent bitshift implementation.
+20:32 < matches> Yeah it is more difficult than I thought
+20:33 < matches> I'm going to need "shift_digits" assembly functions
+20:33 < matches> C style bit shifting has too many wierd edge cases
+20:36 < matches> 0x7000000000000000 >> 3 == 0x0e00000000000000 ?
+20:36 < matches> There are more bits set in the second number than the first!
+20:38 < matches> And unlike multiplication where it fills an extra register for you, you just lose the extra bits with shr and shl :S
+20:39 < matches> Except for a carry
+20:39 < matches> So I'd have to do a loop one bit shift at a time
+20:39 < matches> Blergh
+20:40 < matches> I shall resume my epic battle with primary school level mathematics tomorrow
+--- Day changed Sun Jul 06 2014
+00:32 <@sulix> long division of an arbint by a uint64 worksish.

UCC git Repository :: git.ucc.asn.au