Banana changed the topic of #ocaml to: OCaml 3.08.1 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
pharx has quit [Read error: 104 (Connection reset by peer)]
GreyLensman has joined #ocaml
gim_ has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
GreyLensman has quit ["Leaving"]
voxel has joined #ocaml
gim__ has joined #ocaml
gim_ has quit [Read error: 110 (Connection timed out)]
CosmicRay has joined #ocaml
gim__ has quit ["pula"]
monochrom has quit ["hello"]
CosmicRay has quit ["Leaving"]
vezenchio has joined #ocaml
vezenchio has quit ["Deadpool still votes for Perot. Every time. Just in case."]
vezenchio has joined #ocaml
cmeme has quit [Connection timed out]
cmeme has joined #ocaml
voxel has quit []
mlh has quit [Client Quit]
mrsolo has joined #ocaml
mlh has joined #ocaml
avn has quit [Remote closed the connection]
avn has joined #ocaml
vezenchio has quit ["Deadpool still votes for Perot. Every time. Just in case."]
vezenchio has joined #ocaml
solarwind has quit ["leaving"]
solarwind has joined #ocaml
solarwind has quit ["leaving"]
daapp has joined #ocaml
smimou has joined #ocaml
daapp has left #ocaml []
mlh has quit [Client Quit]
lus|wazz has joined #ocaml
vezenchio has quit [Read error: 110 (Connection timed out)]
smimou has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
smimou has quit [Client Quit]
srv has quit [Read error: 104 (Connection reset by peer)]
srv has joined #ocaml
dxlvi has joined #ocaml
solarwind has joined #ocaml
Herrchen has joined #ocaml
fremo has joined #ocaml
<fremo> 'lo
moonfish has joined #ocaml
<moonfish> can someone here answer a question on let-polymorphism?
<awwaiid> perhaps
<moonfish> let twoTuple () = let f x = x in (f 1, f false);; works
<moonfish> let twoTuple f = (f 1, f false);; doesn't
<moonfish> I want to be able to call twoTuple like: twoTuple id;;
<moonfish> is that at all possible?
<pango> I think you'll find answers in http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html
<moonfish> thanks. I'll take a look.
<moonfish> I was googling around but that link didn't come up, for some reason.
eugos has joined #ocaml
_fab has quit [Remote closed the connection]
<moonfish> The answer appears to be that it can't be done. See the "My program is not polymorphic (enough)?" question. Is that correct?
<moonfish> I meant "How to write a function with polymorphic arguments ?".
<solarwind> 'a?
<moonfish> solarwind: that's FAQ question matching my earlier question. and the answer is "you can't".
<solarwind> Ah.
Herrchen has quit ["bye"]
Nic has joined #ocaml
CosmicRay has joined #ocaml
eugos has quit ["Leaving"]
eugos has joined #ocaml
dxlvi has quit ["ey"]
dxlvi has joined #ocaml
dxlvi has quit [Remote closed the connection]
<Nic> hi
<Nic> how can I know if a number is a square ? or if the root square of a number is natural ?
<Nic> is there a root square function in caml?
<pango> sqrt ?
<Nic> ha yes thanks
<Nic> what about the first question ?
<solarwind> external sqrt : float -> float = "sqrt_float" "sqrt" "float"
<solarwind> It's in pervasives.
<solarwind> Nic: I think all the numbers have a square. Hence your question is the last one.
<Nic> a natural one
<Nic> not sure if it's the right word
<Nic> 25 is a square because sqrt(25)=5
<Nic> 24 isnt
<solarwind> A wild guess, you can check if that number's square mod'ed 2 has the result 0 or 1.
<pango> I don't know if that property can be checked in constant time... You could try finding square root thru dichotomia...
<Nic> do I really need that ?
<Nic> you think it will be faster ?
<pango> there's also a way to compute square root "by hand", it may give ideas on how to solve the problem
<vincenz> it's quite easy
<vincenz> just find the sqr-root
<vincenz> round down
<vincenz> and see if it's equal to iteself
<Nic> hmm yep
<vincenz> or, transfor to int and see if the number % the found sqrroot is 0
<vincenz> shouldn't be too hard, but this treally smells like homework
<Nic> how do I transfer to int ?
<vincenz> ls -la
<Nic> or how do I round down ?
<pango> I don't like going thru floats in that case
<vincenz> that's called "look in docs"
<Nic> ha ok
<Nic> thought it was rtfm
<Nic> :)
<Nic> sorry
<vincenz> rtfm, but I was being polite
<solarwind> RTFM sounds like a formatting method for some docs.
<vincenz> yes, RTF is windows crap
<Nic> what?
<solarwind> Rich Text Format.
<vincenz> comunque
<vincenz> back to away
monochrom has joined #ocaml
<Nic> pango: not really appropriate in my case, but interesting though
<pango> Nic: problem of going thru floats is rounding errors
gim has joined #ocaml
<Nic> pango: what do you mean ?
<pango> what if 4 is translated into 3.9999..., sqrt gives 1.9999...., in turn rounded to 1 ? then 4 is not a square number
<avlondono> Nic: what is this for?
<Nic> pango: this could really happen ?
<pango> Nic: happens all the time with floats
<Nic> avlondono: for a little math exercise
<pango> Nic: we're dealing with finite precision numbers
<avlondono> oh, so don't kill it like this, there is a nice (cool) simple recursion for this. enough tip I guess.
<Nic> I need to found all the numbers, for which a*a + (a+1)*(a+1)=c*c
<Nic> a=3 and c=5 for example
<pango> avlondono: based on the square root computation (URL above ?)
smimou has joined #ocaml
<avlondono> I think not
<Nic> to find :p
<pango> Nic: ok, you iterate over a, and check if a^2 + (a+1)^2 is a square, correct ?
<Nic> yep
<pango> Nic: then just keep c around, checking if a^2 + (a+1)^2 is within [c^2, (c+1)^2] range, increasing c when it's over
<Nic> then I check if it works with the last value of c?
<Nic> the function to test if a number is a square or not seems to work. so I could use my basic method
<Nic> int list = [100; 81; 64; 49; 36; 25; 16; 9; 4; 1; 0]
<pango> keep a and c so that c^2 <= a^2 + (a+1)^2 < (c+1)^2
<pango> checking each time if you need to increase a or c
<Nic> ha
<Nic> it'll be faster ? or more accurate ?
<pango> certainly both
<Nic> hmm
<pango> you can keep a*a, (a+1)*(a+1), c*c and (c+1)*(c+1) around to avoid computing more often than necessary, but that's an optimization
lus|wazz is now known as vezenchio
<Nic> how do I comment a function ? I don't remember, and I really don't know where to search in the manual :p
<pango> (* *)
<Nic> ha yes thanks
<Nic> I thought it was like in C /* */ :p
<Smerdyakov> Try searching the grammar.
<Smerdyakov> (for future questions like that)
<Smerdyakov> Oh no! You're using Caml Light? :O
<Nic> yep it sucks
<Smerdyakov> Well, it's still obvious where to look in the manual.
<Nic> but I already don't know anything in caml light. I would have to learn the both
<Smerdyakov> I'm saying that it's obvious where to look in the _Caml_Light_ manual.
_fab has joined #ocaml
<Nic> you said Oh no! it means it's bad and I agree. I can't even compile the additional libraries (like the graphics one)
<Smerdyakov> All I'm talking about now is how easy it is to resolve any questions about syntax.
<Nic> now, it still isn't obvious for me, as I'm pretty bad in english, and dumber than you I guess
<Smerdyakov> Well, let's see. There are four big section headings in the TOC. Do you know which would contain such information?
<Nic> hmm ok, I'm sorry
<Smerdyakov> Hm? Is that an answer to the question?
<Nic> core caml light language, then lexical conventions
<Smerdyakov> Tada! Easy, yes? :)
eugos has quit ["Leaving"]
smimou has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
<Nic> hmm my version isn't similar to yours :) it was almost done, but I'm having a small problem, so I don't even know if it works :p
<Nic> pango: you tried it?
<pango> 0, 1: 0^2 + 1^2 = 1^2
<pango> 3, 5: 3^2 + 4^2 = 5^2
<pango> 20, 29: 20^2 + 21^2 = 29^2
<pango> 119, 169: 119^2 + 120^2 = 169^2
<pango> 696, 985: 696^2 + 697^2 = 985^2
<pango> 4059, 5741: 4059^2 + 4060^2 = 5741^2
<Nic> finally, I don't get it
<Nic> once you've c^2 <= a^2 + (a+1)^2 < (c+1)^2 , why does it mean c^2 = a^2 + (a+1)^2 ?
<pango> here's the unoptimized version: http://rafb.net/paste/results/ToZ0mF56.html
smimram has joined #ocaml
<Nic> it isn't the program itself, its the algorithm. I don't see how it works. see my previous question
<pango> if c^2 = a^2 + (a+1)^2, you have a solution
smimou has quit [Read error: 60 (Operation timed out)]
<Nic> but its isnt =
<Nic> -s
<pango> if c^2 < a^2 + (a+1)^2 < (c+1)^2 then there's no solution with that c, you can go on with another value for a
<pango> if a^2 + (a+1)^2 >= (c+1)^2 then maybe a higher c value will do
<pango> correction, "if c^2 < a^2 + (a+1)^2 < (c+1)^2 then there's no solution with that a, you can go on with another value for a"
<pango> or in other words, a^2 + (a+1)^2 is between two consecutive square numbers, so there's no solution with that value of a
<Nic> sorry finally it's very clear, but I confused myself :p
<Nic> I didn't even do the right cases
<pango> the optimized version just threads the values of a^2, a+1, (a+1)^2, a^2+(a+1)^2 and c^2 to avoid recomputing them
<Nic> yep I saw that
<Nic> let (a,c) = (0,1) in for i = 1 to n do let (a,c) = next(a+1,c); done; (a,c);;
<Nic> whats wrong there ? it said there is a syntax error with done
<pango> let syntax is let var = expr in expr
<pango> unless it's a global declaration, but that's not the case here
<Smerdyakov> 'let' is not an 'assignment statement.'
<Smerdyakov> It's completely useless in the way you're trying to use it.
<Nic> how do I do that?
<Smerdyakov> You don't.
<Nic> I don't get it
<Smerdyakov> 'let' cannot be used by itself to introduce imperative features.
<Nic> I meant : why should I use then ?
<Nic> what
<Smerdyakov> Never use 'for.'
<Smerdyakov> Use a recursive function instead.
<Nic> ha yes, sorry :)
<pango> new version of first problem using Int64's: http://rafb.net/paste/results/9EG9Kv23.html
<pango> ain't that great to know that 159140519^2 + 159140520^2 = 225058681^2 ? ;)
smimram has quit [Read error: 110 (Connection timed out)]
chantry has joined #ocaml
Nic has quit [Read error: 104 (Connection reset by peer)]
<chantry> hmm I don't if its caml that hardlocked my laptop, but it was very fun
chantry is now known as Nic
<Nic> I miss the last msg, if there was any
<Nic> maybe my version is wrong : http://rafb.net/paste/results/RUGPxF27.html
<Nic> pango: are you able to calculate the 6th solution ?
chantry has joined #ocaml
Nic has quit [Read error: 104 (Connection reset by peer)]
<chantry> hardlock again :p
<pango> chantry: must be running a non tail recursive program with too few virtual memory
<chantry> my mem wasnt totally used in top
<chantry> the swap wasnt even hitten
<pango> or you have an overheating cpu
<chantry> but the proc was used at 99%
<chantry> hmm yep maybe
<pango> to answer your question, it's not difficult, I just added an additionnal n parameter:
<chantry> so it works for you?
<pango> $ time ./problem3int64 6
<pango> 4059, 5741: 4059^2 + 4060^2 = 5741^2
<pango> ./problem3int64 6 0,02s user 0,00s system 1373% cpu 0,001 total
<pango> system usage is interesting ;)
<chantry> lol
Smerdyakov has quit [Remote closed the connection]
Demitar has quit [Read error: 104 (Connection reset by peer)]
<chantry> hmm I need ocaml for that :)
<chantry> pango: why is my version so bad ? I could make it tail recursive ?
<avlondono> just wanted to note that (n + 1)^2 = n^2 + 2n + 1 (for a really unnecessary speedup)
<chantry> :)
<pango> avlondono: yes
<pango> using Int64.shift_left ;)
<chantry> pango: did you compare your different versions ? it would be interesting
<chantry> pango: wow it's impressive :)
Demitar has joined #ocaml
<chantry> you should have edited your last version
<pango> what did I miss ?
<chantry> to run it like that : ./a.out n
<pango> oh
<pango> btw, 927538920^2 + 927538921^2 = 1311738121^2
<chantry> :)
<chantry> lol
Kevin_ has joined #ocaml
<chantry> hmm the last one isnt faster there
<pango> depends on how a Int64.mul fares compared to an Int64.shilft_left, a Int64.add and an Int64.succ
<chantry> well
<chantry> so Int64.mul is faster in this case
<chantry> on my comp at least
<pango> yes, it depends on several factors (functions implementation, compiler, CPU)
<pango> it was just to make the code look uglier ;)
<chantry> ok :)
<avlondono> neat please, neat
<avlondono> :-)
<chantry> whats strange is my version, is that its very fast until 5
<chantry> and for 6, it never ends
<chantry> time ./myversion 5
<chantry> 4059 5741
<chantry> real 0m0.007s
<chantry> user 0m0.005s
<chantry> sys 0m0.002s
<chantry> I think I'll hardlock soon :)
<chantry> I'm running for 4 min at 99% and I'm stilll there
<chantry> don't know why it hardlocked so fast before
<chantry> I'm using ocamlc instead of camllight, its maybe that
<pango> http://rafb.net/paste/results/u4pxqw64.html only use Int64 for squares
<chantry> mine still didnt end after 8 min
<chantry> pango: nice, its faster :)
Godeke has quit [Remote closed the connection]
<chantry> 5.372 vs 7.58 for the previous and 5.9 for the Int64.mul one
pango has quit [Nick collision from services.]
pango_ has joined #ocaml
<pango_> $ time ./problem3pint64 6
<pango_> 4059, 5741: 4059^2 + 4060^2 = 5741^2
<pango_> ./problem3pint64 6 0,02s user 0,00s system 42% cpu 0,047 total
<chantry> ha t'es fr
<pango_> (using ocamlopt)
<chantry> t'es sous linux la ?
<pango_> yes
<chantry> il est bizarre ton time
<pango_> yes, don't know why... I enabled oprofile, maybe it confuses things :/
<chantry> k
<pango_> all I can tell is that it's almost instantaneous
<chantry> pango_: my prog would be a lot faster if it was tail recursive ?
<pango_> "next" looks tail recursive, unless I'm missing something
<chantry> u isn't
<pango_> but that shouldn't matter too much, it's no deeper than n calls
<chantry> I'm not even able to get u(6)
<pango_> I wonder what's u computing exactly, through
<chantry> the nth solution
<pango_> sometimes u result is some next output, but u results are also used for next arguments...
<chantry> ha yes :)
<pango_> looks like you have a problem with "let" again
<chantry> next(u(n-1))=u(n-1) so I can't do that
Godeke has joined #ocaml
<pango_> mmmh no maybe I wrong, next takes and returns int pairs, that looks ok
<pango_> s/I/I'm/
<chantry> hmm yep
<chantry> the let thing isnt the problem
<chantry> its still the same without it
<chantry> works fine for 1..5
<chantry> but takes more than 9 min for 6
monochrom has quit ["hello"]
<pango_> chantry: you're hitting int overflows when computing the square of numbers >= 32768
<chantry> haa
<chantry> yep it was strange that there was a such big difference between 5 and 6
<chantry> nice one
<chantry> pango_: so I need Int64 too ?
<chantry> pango_: you first versions would have done the same as mine ?
<pango_> they did. They stopped at 4059, 5741 also
<chantry> and btw, you were right, i think I did a tail recursive version, but it isnt faster
<chantry> k
<chantry> hey finally my version is the fastest for that :)
<chantry> for 4059, 5741
<chantry> I didnt notice my u(5) = your u(6)
<pango_> yes, your n is 0 based while mine is 1 based
<pango_> s/your/yours/
<chantry> right
<chantry> Int64 is the only way or is there other types I could try ?
<pango_> Big_int
<chantry> I have to use it in the same way ?
<pango_> Big_int module provides similar function, check the .mli
<chantry> k
<pango_> but then, I think the algorithm will need further optimization...
<pango_> a^2 + (a+1)^2 grows faster than c^2, so looking for solution by incrementing c is somewhat too slow
<pango_> if you can find an upper bound for c as a function of a, it may become faster to use dichotomia (for example) that just increments
<pango_> s/that/than/
<pango_> like, c <= (a+1)*(sqrt 2)
<Nutssh> There is an upper bound... a^2 = c^2-b^2 = (c-b)(c+b) So factor a into all possible pairs x*y, and solve for c-b=x, c+b=y
* avlondono was just giving tips, but they where blind to the tips ...
<avlondono> blindness!!! :-)
<Nutssh> Minor bug, you wnat the prime factorization of a^2, then enumerate them. Time: O(n^.5/log n) for the factorization.
<Nutssh> :)
<Nutssh> I prefer algorithmic improvements whenever possible.
<chantry> it becomes way too complicated for me :)
<chantry> well it was just a math exercise, not an informatic one
<chantry> I just needed a basic algorithmic
<chantry> but it can indeed be interesting :)
<Nutssh> With a tiny bit of care, this is O(size of result), once you have the prime factorization.
Smerdyakov has joined #ocaml
vezenchio has quit ["Deadpool still votes for Perot. Every time. Just in case."]
<chantry> omfg
<chantry> gcc : 0m0.278s
<chantry> ocaml : 0m5.399s
m3ga has joined #ocaml
chantry is now known as Nic
<Smerdyakov> What is the point of that?
<Nic> I don't understand why the same prog in C is so fast, or why it's so slow in ocaml
<Smerdyakov> Obviously it's not "the same prog."
<Nic> I wrote the C one, so it can't be better
<Smerdyakov> And you wrote the OCaml version?
<Nic> I wrote one, but tried the pango's one too
<Smerdyakov> Are the two versions on the web somewhere?
<Nic> yup
<Smerdyakov> Where?
<Nic> the last one pango_ did : http://rafb.net/paste/results/u4pxqw64.html
<Smerdyakov> Ugh. Kind of a pain to read through that. I'd suggest translating it to SML and trying it with MLton. OCaml does a very poor job of optimization.
<pango_> unoptimized version is http://rafb.net/paste/results/ToZ0mF56.html
<Smerdyakov> I would bet that OCaml is boxing all the Int64's.
<Smerdyakov> Since it even boxes the basic int type.
<pango_> Smerdyakov: boxing ints ?
<Smerdyakov> Er, Int32 type
<Smerdyakov> pango_, yes
<pango_> yes, Int32s
<Nic> even with the int type, there is a difference, but the times are very small in both cases
<Nic> 0.008 s vs 0.002 s
<Nic> for the big numbers I can compute with my ocaml version
<pango_> you used doubles in C, not 64 bit ints
<Smerdyakov> Nic, do you understand what it means that OCaml boxes Int64's? Every one has heap memory allocated for it, and it is referenced with a pointer.
<Nic> yep
<pango_> don't know how they compare in speed
<Nic> Smerdyakov: ha
<pango_> Nic: btw, the time you gave are for what n value ?
<Nic> pango_: pango_ 10
<Nic> oops
<pango_> 27304196^2 + 27304197^2 = 38613965^2 ?
<Nic> nah, my C prog is like yours
m3ga has quit ["Client exiting"]
<Nic> 4684659
<pango_> ok, 1 based
<Nic> yup
<pango_> C program is slower with long long, but still faster
<Nic> ok
<pango_> maybe it's boxing, maybe it's ocaml compiler that doesn't handle well tail recusion with so many parameters, I don't know. Only looking at generated asm will tell
<Nic> :)
<Nic> well, even if my prog in C is faster, the caml one looks nicer
<Nic> I think I'll keep it
<mrvn> How far do you let it run?
<mrvn> mrvn@frosties:~% time ./foo
<mrvn> 3^2 + 4^2 = 5^2
<mrvn> 20^2 + 21^2 = 29^2
<mrvn> 119^2 + 120^2 = 169^2
<mrvn> 696^2 + 697^2 = 985^2
<mrvn> 4059^2 + 4060^2 = 5741^2
<mrvn> 23660^2 + 23661^2 = 33461^2
<mrvn> 137903^2 + 137904^2 = 195025^2
<mrvn> 803760^2 + 803761^2 = 1136689^2
<mrvn> 4684659^2 + 4684660^2 = 6625109^2
<mrvn> 27304196^2 + 27304197^2 = 38613965^2
<mrvn> ./foo 0.35s user 0.00s system 97% cpu 0.359 total
<Nic> I only compared with precise values of n
<Smerdyakov> OK, I've run some experiments that use 64-bit integers to sum the numbers from 0 to 100000000.
<Smerdyakov> Without any special command-line flags:
<Smerdyakov> gcc takes 0m0.638s
<mrvn> ./foo 1.30s user 0.00s system 99% cpu 1.307 total
<Smerdyakov> ocaml takes 0m12.197s
<mrvn> in ocaml.
<Smerdyakov> mlton takes 0m1.119s
<Nic> a lot better indeed
<Smerdyakov> gcc down to .142 if compiled with -O5.
<Nic> whats mlton ? it can compile the same code ?
<Smerdyakov> No. MLton is an SML compiler.
<Nic> ha
<mrvn> Smerdyakov: How does your sourec look like?
<Smerdyakov> Why is that "ha"?
<Nic> Smerdyakov: because I didn't know it
<mrvn> I'm using 63bit ints for the above square sum problem and it takes just 1s till 100000000.
<mrvn> Having a decent cpu is a big plus.
<Smerdyakov> I believe I do have a decent CPU.
<Smerdyakov> Besides, it's the ratios that are interesting.
<mrvn> Answer: 5000000050000000
<mrvn> ./foo2 0.25s user 0.00s system 97% cpu 0.257 total
<mrvn> ocaml
<Smerdyakov> What about the C version?
<mrvn> zsh: segmentation fault ./test64
<mrvn> ./test64 0.00s user 0.00s system 0% cpu 0.000 total
<Smerdyakov> You have to run it with an argument that tells how many to sum.
<mrvn> hehe, it helps to pass an argument.
<mrvn> ./test64 100000000 0.10s user 0.00s system 93% cpu 0.107 total
<Smerdyakov> Use 100000000
<Smerdyakov> OK, now try my test64.ml.
<mrvn> That would be foo2
<pango_> imperative version is just as slow, so it's certainly boxing... http://rafb.net/paste/results/Vwxt8926.html
<mrvn> except with 63bit ints.
<Smerdyakov> Ah. But the requirement is 64-bit. :)
<Smerdyakov> (I don't think "CPU's" have anything to do with this. You changed the program!)
<mrvn> pango_: get lost. That is awfull code.
<mrvn> Smerdyakov: 63bit is usualy enough. 31bit ints are too little.
<pango_> mrvn: it's not a beauty contest
<Smerdyakov> How do I use 63-bit?
<mrvn> Smerdyakov: You buy a 64bit cpu.
<Smerdyakov> mrvn, do you have MLton installed?
<mrvn> E: Couldn't find package mlton
<Smerdyakov> There is no 64-bit version of it for Debian, if that's what you mean.
<Smerdyakov> The 32-bit version should work fine, though.
<pango_> mrvn: so you have a 64 bits, and now what ?
<Smerdyakov> Well, my point is that I suspect that MLton would trounce OCaml by some significant amount, if you could try it out.
<mrvn> Smerdyakov: comparing 64bit code against 32bit code wouldn't be fair and I'm not going to install a 32bit ocaml with all its libs.
<Smerdyakov> I would be interested in the unfair results, all the same.
<mrvn> pango_: The difference is I don't square. Probably doesn't make much of a difference for 64bit but for say 1024 bit numbers it would.
<pango_> mrvn: I have a version that don't square too (doesn't * 2 either, use shift instead), but Nic said it wasn't any faster for him
<mrvn> *2 and shift for ints should result in the same code.
<pango_> mrvn: I don't know, I'm not a compiler
<pango_> mrvn: take http://rafb.net/paste/results/u4pxqw64.html and use code in comments instead of the line above them
mrvn_ has joined #ocaml
<mrvn_> Int64.sqr is probably faster than a2 += 2 * a + 1 due to the extra function calls.
<mrvn_> re
<mrvn_> pango_: I was thinking that maybe c could be increased by more than 1 if c^2 is too small.
<pango_> mrvn: yes, for big values of a and c, incrementing c by one is too slow
<Nic> mrvn_: they already talked a bit about that :)
<pango_> if you have a log of the channel, it was said around 7:43pm
<mrvn_> pango_: and what time is it now?
<pango_> I have 10:02pm (sorry I should have mentionned TZ)
<mellum> You mean not everybody is from France here?
<pango_> I must have some kind of sinusitis, my brain is on fire, I have a hard time thinking straight :/
<mrvn_> And why do you use pm? 24h clocks are so much easier.
<pango_> do you people care about the problem at hand, or just about making me miserable ? :)
<mrvn_> Just killing time.
<pango_> yes, successfully
<calvin_> how does one sqrt in ocaml?
<calvin_> nevermind :P
<Nic> :)
<pango_> time to get the red pill...
mrvn has quit [Read error: 104 (Connection reset by peer)]
<Nic> whats that?
<pango_> Have you seen The Matrix (ep.1) ?
<Nic> yup
<Nic> but I don't remember what the pills mean
<pango_> check the scene when Neo and Morpheus meet for the first time... or google for "matrix red pill blue pill"... that's totally off topic :)
Demitar has quit [Remote closed the connection]
<async> Smerdyakov: u there?
<Nic> you're leaving the matrix ? :)
<Nic> it seems the ocaml prog is more limited too. It never ends for n=14
<Nic> I didn't even notice I was running it for nearly one hour :)
<pango_> Nic: it's also probable that, using doubles, the C program may miss some solutions
<pango_> Nic: comparing a floating type value to 0 is always dangerous
monochrom has joined #ocaml
<Nic> ha ok
<Nutssh> This problem has a closed form.
mrsolo has quit [Operation timed out]
mlh has joined #ocaml
<pango_> for(;;) { x = x + 1; i = i + 1; if(i*i-x*x != 0) break; } => x = 3037000500 (not too bad)
<pango_> I forgot double x = 0; long long i = 0;
dxlvi has joined #ocaml
<Nic> yep
pharx has joined #ocaml
dxlvi has quit ["brb .)"]
Kevin_ has quit ["Quit"]
CosmicRay has quit ["Client exiting"]
Nic has quit ["leaving"]
skylan has quit [Client Quit]
skylan has joined #ocaml
gim has quit ["..."]
monochrom has quit ["hello"]