beach has quit [Killed (NickServ (GHOST command used by beach`!~user@2a01:cb19:682:4600:5a12:151b:d4f9:ab1))]
beach` is now known as beach
markb1 has quit [Ping timeout: 252 seconds]
King_julian has quit [Ping timeout: 260 seconds]
King_julian has joined #commonlisp
markb1 has joined #commonlisp
ryanbw has joined #commonlisp
bpanthi977 has quit [Ping timeout: 260 seconds]
bpanthi977 has joined #commonlisp
tedwing has joined #commonlisp
tedwing has quit [Ping timeout: 245 seconds]
bpanthi977 has quit [Ping timeout: 245 seconds]
bpanthi977 has joined #commonlisp
markb1 has quit [Ping timeout: 260 seconds]
JuanDaugherty has joined #commonlisp
tedwing has joined #commonlisp
tedwing has quit [Ping timeout: 244 seconds]
markb1 has joined #commonlisp
markb1 has quit [Ping timeout: 276 seconds]
Pixel_Outlaw has quit [Quit: Leaving]
markb1 has joined #commonlisp
mishoo has joined #commonlisp
pve has joined #commonlisp
ingeniot has joined #commonlisp
Guest47 has joined #commonlisp
markb1 has quit [Ping timeout: 265 seconds]
markb1 has joined #commonlisp
ryanbw1 has joined #commonlisp
edgar-rft has joined #commonlisp
ingeniot has quit [Quit: Client closed]
edgar-rft` has quit [Ping timeout: 252 seconds]
Th30n has quit [Remote host closed the connection]
Th30n has joined #commonlisp
JuanDaugherty has quit [Quit: praxis.meansofproduction.biz (juan@acm.org)]
markb1 has quit [Ping timeout: 252 seconds]
kurfen has quit [Ping timeout: 252 seconds]
Th30n has quit [Client Quit]
Th30n has joined #commonlisp
vardhan_ has quit [Remote host closed the connection]
vardhan_ has joined #commonlisp
ryanbw1 has quit [Ping timeout: 260 seconds]
bpanthi977 has quit [Remote host closed the connection]
markb1 has joined #commonlisp
X-Scale has quit [Ping timeout: 272 seconds]
Th30n has quit [Remote host closed the connection]
flip214 has quit [Ping timeout: 244 seconds]
Th30n has joined #commonlisp
flip214 has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 246 seconds]
Lord_of_Life_ is now known as Lord_of_Life
shka has joined #commonlisp
vardhan_ has quit [Ping timeout: 244 seconds]
ingeniot has joined #commonlisp
ingeniot has quit [Ping timeout: 240 seconds]
khinsen has joined #commonlisp
jjnkn has joined #commonlisp
markb1 has quit [Ping timeout: 245 seconds]
markb1 has joined #commonlisp
usagi_mimi has joined #commonlisp
usagi_mimi has joined #commonlisp
usagi_mimi has quit [Changing host]
varjag has joined #commonlisp
ingeniot has joined #commonlisp
usagi_mimi has quit [Quit: WeeChat 4.5.2]
veqq1 has joined #commonlisp
veqq has quit [Ping timeout: 252 seconds]
srji has joined #commonlisp
<srji>
o/
usagi_mimi has joined #commonlisp
veqq1 has quit [Ping timeout: 248 seconds]
<JoshYoshi>
o7
khinsen has left #commonlisp [#commonlisp]
treflip has joined #commonlisp
ingeniot has quit [Quit: Client closed]
treflip` has joined #commonlisp
ingeniot has joined #commonlisp
ingeniot has quit [Client Quit]
ingeniot has joined #commonlisp
treflip has quit [Ping timeout: 260 seconds]
ingeniot has quit [Quit: Client closed]
ingeniot has joined #commonlisp
dra has joined #commonlisp
<srji>
hows doin?
ello_ has quit [Ping timeout: 244 seconds]
ello has quit [Ping timeout: 244 seconds]
apac has joined #commonlisp
GalaxyNova has quit [Ping timeout: 260 seconds]
srji has quit [Remote host closed the connection]
dajole has quit [Quit: Connection closed for inactivity]
Demosthenex has quit [Ping timeout: 272 seconds]
markb1 has quit [Ping timeout: 246 seconds]
ryanbw1 has joined #commonlisp
markb1 has joined #commonlisp
ello has joined #commonlisp
ello_ has joined #commonlisp
attila_lendvai_ has joined #commonlisp
X-Scale has joined #commonlisp
ingeniot has quit [Ping timeout: 240 seconds]
m5zs7k has quit [Ping timeout: 276 seconds]
Guest9896 has joined #commonlisp
treflip` has quit [Changing host]
treflip` has joined #commonlisp
treflip` is now known as treflip
treflip` has joined #commonlisp
treflip has quit [Ping timeout: 252 seconds]
m5zs7k has joined #commonlisp
wbooze is now known as Inline
surabax has joined #commonlisp
Guest47 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
usagi_mimi has quit [Quit: WeeChat 4.5.2]
usagi_mimi has joined #commonlisp
ryanbw has quit [Quit: I'll be back.]
Guest47 has joined #commonlisp
usagi_mimi has quit [Quit: WeeChat 4.5.2]
usagi_mimi has joined #commonlisp
usagi_mimi has quit [Changing host]
usagi_mimi has joined #commonlisp
usagi_mimi has quit [Quit: WeeChat 4.5.2]
usagi_mimi has joined #commonlisp
usagi_mimi has joined #commonlisp
usagi_mimi has quit [Changing host]
usagi_mimi has quit [Client Quit]
usagi_mimi has joined #commonlisp
ryanbw1 has quit [Ping timeout: 252 seconds]
ryanbw1 has joined #commonlisp
mwnaylor has quit [Ping timeout: 248 seconds]
kurfen has joined #commonlisp
usagi_mimi has quit [Quit: WeeChat 4.5.2]
usagi_mimi has joined #commonlisp
usagi_mimi has joined #commonlisp
usagi_mimi has quit [Changing host]
usagi_mimi has quit [Client Quit]
usagi_mimi has joined #commonlisp
ryanbw1 has quit [Ping timeout: 252 seconds]
ryanbw1 has joined #commonlisp
decweb has joined #commonlisp
random-nick has joined #commonlisp
Guest47_ has joined #commonlisp
markb1 has quit [Ping timeout: 252 seconds]
Demosthenex has joined #commonlisp
Guest47 has quit [Ping timeout: 268 seconds]
treflip`` has joined #commonlisp
treflip` has quit [Ping timeout: 260 seconds]
attila_lendvai_ has quit [Ping timeout: 244 seconds]
JuanDaugherty has joined #commonlisp
markb1 has joined #commonlisp
chomwitt has joined #commonlisp
ryanbw1 has quit [Ping timeout: 244 seconds]
ingeniot has joined #commonlisp
JuanDaugherty has quit [Quit: praxis.meansofproduction.biz (juan@acm.org)]
<cdegroot>
@gilberth we have 17(?) significant digits in doubles. Everything after it is a zero, or a random number, it doesn't matter. Make it all zeroes and truncate can just return the mantissa padded with zeroes and 0 for the remainder. Only for small numbers you actually need to do the math. But as I said, all of mostly theoretical interest so "meh" to me :)
jon_atack has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
<beach>
cdegroot: I don't see how you arrive at that conclusion. A double float is a precise number. You can't add random stuff to the end of it. Floating-point arithmetic is precisely defined.
<beach>
In other words, a specific double-float value can not mean any number that rounds to that value.
<cdegroot>
no, it's not precise, that's the whole reason that you can go up to numbers with 300 digits in just 32/64 bits (or 4, if you're Nvidia :-)).
<cdegroot>
precision of fp64 is 53 bits, or 15-17 in base 10.
<beach>
So? The number is still precise once it is in that form.
<cdegroot>
So if you have 1.0e308, after 10000000000000000 you can insert whatever you want, essentially.
<beach>
You are confusing the conversion of decimal sequences of digits to binary floating-point numbers and the arithmetic on those binary floating-point numbers.
<cdegroot>
It's precise to 17 digits (let's take the max). You have a number that's 308 digits and you're asking it to be rounded (truncated, flored, ...) to an integer. Well, there was nothing (significant) behind the decimal point to begin with.
<beach>
Forget about decimal. Once the number is in binary floating-point form, it is exact as defined by IEEE 754.
<beach>
cdegroot: I think you either need to read up on this topic, or (more likely since you are not very interested in it) stop saying things that are false.
<cdegroot>
It is exact up to the defined precision (of 53 bits).
<beach>
It is exact.
<beach>
It means what the mantissa represents multiplied by what the exponent represents, and nothing else.
<cdegroot>
So you're saying that a number with hundreds of decimal places (in whatever base) is exactly described in a 53 bit field.
<beach>
Not at all.
<beach>
I am saying that once the number is an IEEE double float, its meaning is precise.
<cdegroot>
Yes, precise as with a defined precision.
<beach>
No, precise, with the definition I gave you. And IEEE defines precisely what it means to do arithmetic on that number.
<cdegroot>
You have 17base10/53base2 digits that are exact. Then stuff that (IIRC) is zeros base2 and <essentially line noise> base10 if you convert that base2 number to a decimal representation. If there's stuff behind the decimal point there, whatever, it was not in the handful of digits that are precise, so they're for all intents and purposes zero. That's all I'm saying.
<beach>
Forget about decimal.
<cdegroot>
Every double larger than 10e17 essentially is already an integer.
<cdegroot>
Well, we're talking about truncate/floor/round here, not?
<beach>
Yes, of numbers represented as precise floating-point numbers.
<beach>
There is nothing decimal about FLOAT etc.
<cdegroot>
How do you want to convert a float to an integer without considering a decimal point?
<beach>
I am not converting a float to a decimal, other than for printing it.
markb1 has quit [Ping timeout: 244 seconds]
<beach>
Converting a float to an integer does not require any decimal arithmetic either.
<cdegroot>
(I know there's nothing decimal about floats, decimals are precise ;-). I mean 1.0d308 has 10e290 integers, give or take, that will all map to that number and even though the IEEE standard has lots of very specific rules, I'm not sure that integer conversion is part of it)
attila_lendvai_ has joined #commonlisp
<cdegroot>
You don't require decimal arithmetic explicitly, but you do need to consider where the decimal point lies if you want to expand a float to an integer.
<beach>
Why do you keep harping on decimal notation?
<beach>
Converting to decimal is done only for printing, not for computing TRUNCATE.
<cdegroot>
I'm not, I'm talking about the decimal point, that thing that separates the integers from the remainder if you do a TRUNCATE.
<beach>
You just said "decimal point".
<cdegroot>
Yes, how else do we call the thing that separates integers from the remainder?
<cdegroot>
(I would call it a decimal comma, but then, I'm Dutch and we're odd with numbers :P )
<beach>
Call it the integer part and the fractional part.
<cdegroot>
Separated by that which we shall not call a decimal point.
<cdegroot>
So what's the fractional part of 1.0d308?
<cdegroot>
(let's make it 1.1d308 so nobody mistakes that .0 for what it isn't :-))
<beach>
I don't care to engage in answering that question, and I don't know why you are asking it.
<gilberth>
cdegroot: You really should forget about the decimal external representation of a binary floating point number. And if I may be frank: Get some education for once.
<cdegroot>
Well, apparentlyl I'm wrong when I say that all numbers larger than about 10e290 will have a fractional part of 0 and TRUNCATE in that range is pretty much a no-op.
<cdegroot>
(or maybe not a no-op, but a simple-op, conceptually)
Guest47_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<cdegroot>
(and apologies, as a non-native speaker who indeed does not _specialize_ in floats but knows them quite well, for not using the correct words. My English usually is quite ok, but outside your specialty you more often than not get caught out)
<beach>
You seem to have some pretty large holes in your knowledge about floating point.
<beach>
But since you are not really interested in them, the simplest strategy is just to avoid saying incorrect things.
<Inline>
floating points are dense in R
<cdegroot>
So it is incorrect to say that all numbers larger than 10e290 will have a fractional part of zero? Or that floats have a precision that's (just) 53 bits?
markb1 has joined #commonlisp
<beach>
The part where you claim that any particular floating-point number is not exact and that you can freely add random stuff to it without changing its meaning. That would be a direct violation of the semantics defined by IEEE.
chomwitt has quit [Ping timeout: 268 seconds]
<beach>
I am going to stop engaging in this discussion, because it is not good for my blood pressure. Perhaps someone else can continue.
<cdegroot>
It's exact in 53 bits, plus a sign, plus an exponent, right? We're talking about expressing an exact number as an integer, and while I'm pretty sure about what goes on inside floats, I don't know whether IEEE prescribes anything when you convert them to different representations, but I would assume that padding the thing with zeros is fine (base2. I'm really not talking about the fun stuff that happens when you go through base10 and back, trust me). I
<cdegroot>
mean, what else do you do?
* |3b|
thinks both are right... large floats are integers, but they are specific integers
<cdegroot>
I would say - but if there's something that IEEE has to say about it, that the integer representation of a large float is just the mantissa and then as many zeroes as the exponent say there should be (base 2, still, because ,(TRUNCATE 1.1d308) makes some people's heads spin)
<beach>
The original question was what TRUNCATE returns for (TRUNCATE MOST-POSITIVE-DOUBLE-FLOAT 3) so there is a division by 3 involved.
<|3b|>
,(integer-decode-float 1.1d308)
<ixelp>
=> 5511462990024675; 971; 1
<gilberth>
Sure they are. What we discussed was the two argument TRUNCATE and in particular coming up with the remainder (error really). And that corner case where the obvious solution to multiply the quotient by the divisor fails. And I in particular was puzzled what CMUCL and CLISP did and why Franz and ABCL are fine with saying the remainder is zero.
Guest47 has joined #commonlisp
<cdegroot>
And I was saying that for these large numbers you don't even need to math, that's all. Just return 0.0d0 as the remainder because there won't be anything else, the information simply ain't there (unless you go _exact_, which is operating on large decimal numbers but nobody wants to do that because it's slow :-). I will maintain that IEEE is only exact in its domain, which is 53 bits of precision and rounding on pretty much every operation in the last
<cdegroot>
bit. I would hope that that is not controversial?)
<|3b|>
i think the controversial part is that you think printing has rounding
<gilberth>
cdegroot: You don't need math to divide by three? Do you have a fancy tenary machine?
<cdegroot>
how did you know! ;-)
varjag has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
<gilberth>
Then let's divide by nine sooner.
markb1 has quit [Ping timeout: 268 seconds]
<cdegroot>
no, just saying that I can confidently predict that the remainder will always be zero.
<|3b|>
1.1d308 is (* 5511462990024675 (expt 2 971)), you can't just replace most of that with 0
<edgar-rft>
also ANSI CL nowhere says that DOUBLE-FLOAT must be IEEE double floats
<cdegroot>
Write that number out in binary, there'sll be a ton of zeroes after the first handful (relatively speaking).
<cdegroot>
Write that number out in binary, there'll be a ton of zeroes after the first handful (relatively speaking).
eddof13 has joined #commonlisp
<|3b|>
yeah, lots of zeros in binary
eddof13 has quit [Client Quit]
<cdegroot>
So your remainder with TRUNCATE will always come out to 0.
<gilberth>
Not always ,(truncate 1.5d300 1d300)
<ixelp>
(truncate 1.5d300 1d300) => 1; 5.0D+299
<|3b|>
for 2 argument truncate?
<cdegroot>
(if the result is larger than 1d290-ish)
<gilberth>
First of all the question is: What should the error^Wremainder be? Such that when I do the math in floating point I get (= x (+ (* quotient) remainder))?
<cdegroot>
I learned never to use `=` with floats :)
<|3b|>
well, you learned wrong, it should be 'almost never" at most
<|3b|>
testing fp math implementations is one case where you should
ingeniot has quit [Quit: Client closed]
<gilberth>
And, when I scale the problem ,(defun struncate (x y &aux (s (nth-value 1 (decode-float x)))) (multiple-value-bind (q r) (truncate (scale-float x (- s)) (scale-float y (- s))) (values q (scale-float r s)))) ,(struncate most-positive-double-float 3.0d0)
<ixelp>
(defun struncate (x y &aux (s (nth-value 1 (de[...]) => STRUNCATE, and then (struncate m[...]) => 59923104495410526931242990468434471693311377570012608978724592993481656097588250315549672659195735698776762138897629303648851849283980134210219162890501940227302967333569461225424618281939237177254825243423356618523788986540947638273286944978825097573024722814788503568114237186566502697680960059301391499264; -1.99584030953472D+292
<gilberth>
I do get a non-zero remainder. The same as my [older] CMUCL yields.
markb1 has joined #commonlisp
<gilberth>
My reasoning is that it should be save to bring the exponent near 1, do the math, and scale back. Mantissas (mantissae?) are all the same.
<cdegroot>
I'll need to actually look at that code, which will take me a bit :)
<gilberth>
Some return zero, some return the [actual?] remainder.
<cdegroot>
edgar-rft: heh. The SBCL cop-out _could_ be "well, ANSI only specifies 50+8 bits" but then, it should return that as most positive double float? ;-)
<gilberth>
And I found a bug with ancient CMUCL. I keep saying it: Bugs hound me.
<cdegroot>
Congrats :). I think that we can agree that that answer is wrong, indeed :)
<gilberth>
You may. I still don't know what the correct behaviour of TRUNCATE should be.
<ixelp>
floor, ffloor, ceiling, fceiling, truncate, ftruncate, round, fround | Common Lisp Nova Spec
ingeniot has joined #commonlisp
phantomics has joined #commonlisp
phantomics_ has quit [Ping timeout: 252 seconds]
<|3b|>
yeah, non-zero remainder is required, since it looks like there is no float that can be multiplied by 3 to get m-p-d-f
<beach>
Maybe at some point I should just do manual division in binary notation of MOST-POSITIVE-DOUBLE-FLOAT and 3.
<|3b|>
but arguably it has to be a positive remainder, since otherwise (* x 3) errors
surabax has quit [Quit: Leaving]
<gilberth>
|3b|: What you mean? For our special case of MOST-POSITIVE-DOUBLE-FLOAT?
<|3b|>
yeah
<gilberth>
The spec doesn't say that in this case I would need to use another #'/ and it doesn't say that (* quotient divisor) must be computable without overflow.
<cdegroot>
gilberth: I have so many links pointing to lispworks, _and_ some custom CSS to make it look not super dated... :)
<|3b|>
it says quotient*divisor+remainder=number
<gilberth>
Doing this multiplication to come up with remainder is an implementation detail. And I showed how you can compute it w/o overflow.
<|3b|>
and ERROR doesn't sound like 2 numbers being =
<|3b|>
and there is a quotient+remainder that would allow it, so arguably that pair could be more correct
<|3b|>
though that probably conflicts with the specific contracts of some of the functions, so there might not be a correct answer according to that equality
<|3b|>
and your answer might be the best available
<gilberth>
|3b|: Yes, it states that mathematical equation. It doesn't say that your floating pointer numbers are fit for computing that product.
<|3b|>
ah, i guess the notes specifies the first value (are notes normative? i don't remember any more)
<beach>
They are not.
<gilberth>
Yes, we discussed that. And I happen to believe they actually want that (= (truncate x y) (truncate (/ x y))) holds regardless.
phantomics has quit [Remote host closed the connection]
phantomics has joined #commonlisp
treflip`` has quit [Ping timeout: 244 seconds]
usagi_mimi has quit [Quit: WeeChat 4.5.2]
<gilberth>
This would fix our quotient. That equation number = quotient * divisor + remainder then says what remainder is. I raised the question whether (= number (+ (* quotient divisor) remainder)) would suffice which, I think, would warrant the remainder being zero or not which would point to the interpretation that SBCL and CCL took.
vardhan_ has joined #commonlisp
chomwitt has joined #commonlisp
shawnw has joined #commonlisp
<gilberth>
I am only talking of the interpretation of the remainder here, not about our FP overflow corner case.
<gilberth>
And I don't know whether SBCL, CCL (and CMUCL on a good day) are correct, or CLISP, ECL, ABCL, and ACL.
Inline has quit [Quit: Leaving]
usagi_mimi has joined #commonlisp
<|3b|>
hmm, now i'm not sure if (= (truncate x y) (truncate (/ x y))) will give you "the largest integer not larger than the mathematical quotient" for large floats
<cdegroot>
I'm still wondering where that large negative remainder came from. I guess I need to see this all happen in base2, but that's for tonight.
<cdegroot>
(and what |3b| said - I'm not sure whether the normative definition of quotient and remainder are a match with "what we'd also like to happen" from the notes).
usagi_mimi has quit [Quit: WeeChat 4.5.2]
<beach>
I think semz had the right idea using RATIONAL ,(rem (rational most-positive-double-float) 3)
<beach>
Since most-positive-double-float is an integer, we should use integer arithmetic to compute TRUNCATE when the second value is also an integer.
apac has quit [Ping timeout: 246 seconds]
attila_lendvai_ has quit [Ping timeout: 260 seconds]
<|3b|>
beach: you don't get remainders that add up to the original float that way though
<cdegroot>
So the choice is between an answer that makes sense but is wrong per the spec and an answer that - in my eyes - does not make sense but does compute :)
usagi_mimi has joined #commonlisp
usagi_mimi has quit [Changing host]
usagi_mimi has joined #commonlisp
<beach>
|3b|: Yes, FFLOAT would be trickier because it would not respect what gilberth wants.
<beach>
Er, FTRUNCATE I mean.
<|3b|>
beach: even without the F, the remainder is a float so you would get float math
<|3b|>
or else you need a quotient that isn't = to (floor (/ x 3))
<beach>
|3b|: 2 is an integer and it has an exact representation as a float.
<|3b|>
right, if you want the truncation of the integer with the same value as m-p-d-f, truncating that integer should return 2 for remainder
<|3b|>
but truncating the float should not
<gilberth>
Yes.
usagi_mimi has quit [Quit: WeeChat 4.5.2]
<beach>
|3b|: Why is that?
<gilberth>
Can we do this piecewise? Can we first agree on whether (= (truncate x y) (truncate (/ x y))) holds?
longlongdouble has joined #commonlisp
longlongdouble has quit [Client Quit]
<beach>
I can't agree on that without checking.
<gilberth>
Sure. It hides in the "Notes".
<|3b|>
gilberth: "largest integer not larger than mathematical quotient" sounds like no to me
usagi_mimi has joined #commonlisp
<gilberth>
|3b|: Sigh. Yes, that would suggest we do rational arithmetic.
usagi_mimi has quit [Client Quit]
<|3b|>
yeah, not sure i like that conclusion for performance reasons though :/
usagi_mimi has joined #commonlisp
<gilberth>
It also contradicts the note. But granted the note only lists rational examples.
<beach>
Yes, I was once at a conference and ended up at a banquet table with some Fortran-compiler creators, and I hinted that program transformations should preserve semantics, and they were violently against that, for performance reasons.
<gilberth>
And it doesn't make too much sense imho. This would imply you come up with a rational remainder that you then turn into a floating point number which due to the limited precision might be another value and can end up violating number = quotient * number + remainder.
<|3b|>
beach: arguing about the performance of the semantics, not the transformation though :)
<gilberth>
My reasoning is that this equation is about that when you take the pieces quotient and remainder you can stitch those together again without any loss to get back to the input. Or at least I think that would be useful property.
<beach>
gilberth: But it might not be possible in floating-point land.
<|3b|>
and the notes suggest the spec didn't consider that case, so it isn't clear they intended to specify something that would be slow
<beach>
gilberth: We should try to come up with an example where there are no floating-point numbers that will satisfy that equality.
<gilberth>
beach: That's my point. It is possible when you first divide using FP and then truncate to an integer and then compute the remainder according to remainder = number - quotient * number.
<|3b|>
though calculating it exactly does seem to do better than current sbcl (or 2.4.5.x) at adding up to the original number :/
<gilberth>
And it's not possible when you divide using rational arithmetic.
<gilberth>
Hence when we say we use rational arithmetic and return the mathematically correct truncated integer, we violate the equation for the remainder.
<|3b|>
sbcl says NIL there
<beach>
gilberth: I am saying there might be an example where you can't come up with three floating-point numbers that satisfy that equation. I haven't thought about it very hard, though.
<beach>
|3b|: You can't rely on the reader to do the right thing when converting decimal to float.
<beach>
Though, maybe someone verified that.
johnjaye has quit [Ping timeout: 260 seconds]
<gilberth>
beach: That's my other question: Is that equation mathematically or is that equation using actual FP computation?
<beach>
Good question. My hunch is that there might be an example where no three floats will satisfy it.
<gilberth>
Somewhere ANSI-CL states that (= (read-from-string (prin1-to-string x)) x) must be true for any float.
<beach>
Oh? Interesting! I missed that.
johnjaye has joined #commonlisp
<gilberth>
Whole point why CL implementation go to such great length to print floats correctly. Which is not trivial.
<|3b|>
gilberth: do you know of any floats sbcl reads incorrectly?
<gilberth>
|3b|: I don't. I just remember some discussion about this. It might be fixed by now.
eddof13 has joined #commonlisp
<gilberth>
|3b|: Wait a second! I once looked for floats which are misread. I didn't need long to find one.
* |3b|
just tried a million or so with no errors
<gilberth>
It might be fixed.
<gilberth>
I try to recall how I did that and what the name of the Lisp file might be. Or what to grep for.
zxcvz has joined #commonlisp
<|3b|>
seems ok at least around m-p-d-f and double-float-epsilon, tried the 5+ million floats around those and (= (read-from-string (prin1-to-string x) x)) was t
veqq has joined #commonlisp
<beach>
gilberth: I meant to say that differently. Of course, you can always come up with floating-point numbers so that number = quotient * number + remainder, by setting quotient to 1 and remainder to 0. But it would be desirable for the quotient and remainder to be somewhat correct as well, and those two might not be simultaneously possible.
<|3b|>
question is whether it is "somewhat correct" in FP or integer math
<beach>
Right.
<gilberth>
|3b|: I remember finding floats that don't work. But as I said: It might be fixed. I'm trying a few SBCL versions right now.
<beach>
So then the question becomes: How must are you willing to sacrifice precision in order to make that equation hold.
<gilberth>
|3b|: 6.931624305923328d19 ; SBCL version 2.4.2 ; after about 8M tests.
<beach>
For TRUNCATE I can't imagine a situation when both arguments represent integers (but perhaps being floats), that the result would not be two integers.
<gilberth>
8461455451566562; 13; 1 decoded.
<|3b|>
gilberth: thanks
<beach>
gilberth: Is this an example of a buggy reader?
<|3b|>
looks more like buggy printer
<beach>
Or that, sure.
<gilberth>
Let me check if it is the printer or reader.
<gilberth>
It's the reader.
<|3b|>
yeah, was just noticing that after looking more closely
<beach>
The reader is harder to get right.
<beach>
But now we have the Quaviver library that does it both right and fast. :)
<gilberth>
At the repl with SBCL 2.4.2 I get: (integer-decode-float 6.931624305923328d19) => 8461455451566563; 13; 1. While it should be ,(integer-decode-float 6.931624305923328d19)
<gilberth>
SBCL 2.2.9 is right and slower. But only speed matters!
yitzi has joined #commonlisp
brokkoli_origin has quit [Ping timeout: 244 seconds]
apac has joined #commonlisp
<yitzi>
gilberth: Quaviver gets it right btw. (quaviver/stream:parse-number "6.931624305923328d19") => 6.931624305923328d19
<yitzi>
On SBCL 2.5.1
shawnw has quit [Ping timeout: 244 seconds]
treflip`` has joined #commonlisp
shawnw has joined #commonlisp
brokkoli_origin has joined #commonlisp
apac has quit [Ping timeout: 248 seconds]
ingeniot has quit [Ping timeout: 240 seconds]
zxcvz has quit [Quit: zxcvz]
khinsen has joined #commonlisp
<yitzi>
The base 10-to-2 algorithm that Quaviver uses is about 5 times faster then SBCL native (roughly). And the base 2-to-10 is about 19 times faster. Just FYI.
yitzi has quit [Remote host closed the connection]
stanrifkin has joined #commonlisp
bpanthi977 has joined #commonlisp
khinsen has left #commonlisp [#commonlisp]
eddof13 has quit [Quit: eddof13]
<beach>
YAY!!!
<beach>
There is always this strange silence when something like this is announced.
bpanthi977 has quit [Ping timeout: 248 seconds]
eddof13 has joined #commonlisp
treflip`` has quit [Ping timeout: 260 seconds]
<cdegroot>
Mostly people being stunned :). I remember similar improvements in Erlang, recently.
<bjorkintosh>
I thought Erlang was now Elixir! hardly ever here of Erlang anymore.
<beach>
Well, I always try to imagine what various people are thinking in such a situation.
danza has joined #commonlisp
<cdegroot>
Yeah, it's still all Erlang under the hood (including the implementation of Elixir, pretty much the whole compiler is in Erlang).
<cdegroot>
beach: when I was younger, I would have been "that's silly, how hard can it be to parse a floating point number from a string?" :-)
<beach>
Yes, I see.
<cdegroot>
Now, my biggest reaction is "nice that there's a faster library, when will it be integrated in base SBCL?".
<beach>
Probably never.
<beach>
The reluctance of maintainers of existing Common Lisp implementations to improve their code is what finally convinced me to start the SICL project.
<beach>
While Quaviver was not written by me, I definitely consider it part of the SICL project, and I fully intend to use it in the SICL Common Lisp implementation.
eddof13 has quit [Quit: eddof13]
<beach>
... together with the other 20 or so libraries that have been created in the context of the SICL project.
<cdegroot>
(I do understand some of the reluctance. With old projects, people tend to - consciously or accidentally - rely on quirks. Fixing things that aren't outright bugs may break things. But I know little of how SBCL is maintained, a bit surprised to see it's still on SourceForge and I guess that that already says something? ;-))
<beach>
I should make a list of them, and give a lightning talk at ELS about them.
<JoshYoshi>
You should!
<beach>
Oops, time to go fix dinner for my (admittedly small) family.
<jackdaniel>
clasp afaik does use these libs
khinsen has joined #commonlisp
<jackdaniel>
my take would ve that some of the reluctance comes from rather demanding chouce that all tgese libraries assume full common lisp system and that requires either maintaining two versions of some modules, or imposes various metastability issues
<jackdaniel>
how many boot phases does sicl have?
<jackdaniel>
s/all/many of/
<jackdaniel>
so while tale of stubborn grumpy devs is certainly attractive, it may not be the core reason
<semz>
<|3b|> hmm, now i'm not sure if (= (truncate x y) (truncate (/ x y))) will give you "the largest integer not larger than the mathematical quotient" for large floats <- Late answer, but it won't in general. Consider decimal arithmetic with three significant digits: 9.98/5 is 1.996 (exactly), so (truncate 9.98 5.00) is 1.99, but (truncate (/ 9.98 5.00)) == (truncate 2.00) == 2.00. An actual IEEE 754 example is more complicated, but round-then-truncate and
<semz>
truncate are different whenever you would round up.
<semz>
And only truncate is what gives you that integer.
<semz>
Erm. (truncate 9.98 5.00) is 1, I mean.
khinsen has left #commonlisp [#commonlisp]
<semz>
Though I guess this isn't actually an example of what you're asking for.
<semz>
Very easy to confuse yourself with this topic
bpanthi977 has joined #commonlisp
<semz>
sorry for the noise
danza has quit [Remote host closed the connection]
<JoshYoshi>
I dont float I ratio
<jackdaniel>
flat-io
vardhan_ has quit [Ping timeout: 246 seconds]
bpanthi977 has quit [Ping timeout: 248 seconds]
bpanthi977 has joined #commonlisp
jon_atack has quit [Read error: Connection reset by peer]
jonatack has joined #commonlisp
eddof13 has joined #commonlisp
treflip`` has joined #commonlisp
bpanthi977 has quit [Ping timeout: 248 seconds]
cercopith has quit [Remote host closed the connection]
cage has joined #commonlisp
hellothar has joined #commonlisp
zxcvz has joined #commonlisp
uhuh has joined #commonlisp
ingeniot has joined #commonlisp
cage has quit [Read error: Connection reset by peer]
cage has joined #commonlisp
markb1 has quit [Ping timeout: 272 seconds]
hellothar has quit [Remote host closed the connection]
hellothar has joined #commonlisp
waleee has joined #commonlisp
uhuh has quit [Changing host]
uhuh has joined #commonlisp
apac has joined #commonlisp
markb1 has joined #commonlisp
bpanthi977 has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
jonatack has joined #commonlisp
uhuh has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
uhuh has joined #commonlisp
uhuh has quit [Changing host]
uhuh has joined #commonlisp
jonatack has quit [Ping timeout: 252 seconds]
bpanthi977 has quit [Remote host closed the connection]
bpanthi977 has joined #commonlisp
jonatack has joined #commonlisp
uhuh has quit [Client Quit]
Guest47 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bpanthi977 has quit [Ping timeout: 245 seconds]
jon_atack has joined #commonlisp
chomwitt has joined #commonlisp
jonatack has quit [Ping timeout: 244 seconds]
Guest47 has joined #commonlisp
chomwitt has quit [Ping timeout: 245 seconds]
ym has joined #commonlisp
<beach>
jackdaniel: As I have said before, a Common Lisp implementation could have a trivial implementation of some aspect of the standard, say written in C, and then load a better version later.
markb1 has quit [Ping timeout: 246 seconds]
<beach>
For example, the initial reader would not have to have all the features of a complete reader.
ingeniot has quit [Quit: Client closed]
apac has quit [Ping timeout: 246 seconds]
treflip`` has quit [Ping timeout: 260 seconds]
bpanthi977 has joined #commonlisp
<beach>
And the number of phases of SICL bootstrapping is kind of arbitrary. I could make it one phase if I wanted to. What is relevant is how long it takes and the amount of bootstrapping-specific code. I don't know the second number right now, but we are currently at less than 4 minutes. There is a lot more code to be loaded of course. Then again, not much in terms of optimization has been attempted.
markb1 has joined #commonlisp
dajole has joined #commonlisp
markb1 has quit [Ping timeout: 244 seconds]
GalaxyNova has joined #commonlisp
chrcav has quit [Ping timeout: 252 seconds]
markb1 has joined #commonlisp
chrcav has joined #commonlisp
bpanthi977 has quit [Ping timeout: 248 seconds]
bpanthi977 has joined #commonlisp
apac has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
markb1 has quit [Ping timeout: 276 seconds]
<jackdaniel>
beach: and as I've noted earlier, that still constitues writing CL subset to bootstrap the implementation; number of phases may be arbitrary, but I believe that sorting out the bootstrap process is a serious engineering effort on your side, and that may be an indicator that it is not straightforward
<jackdaniel>
my point is that jumping to use SICL libraries is not an easy choice as could be infered from the presentation, and not necessarily a beneficial one at that
attila_lendvai_ has joined #commonlisp
<jackdaniel>
it is worth noting that I root for SICL success; I take issue only with some recurring claims
ryanbw has joined #commonlisp
eddof13 has quit [Ping timeout: 260 seconds]
mishoo has quit [Ping timeout: 265 seconds]
markb1 has joined #commonlisp
nani has quit [Remote host closed the connection]
nani has joined #commonlisp
bpanthi977 has quit [Ping timeout: 260 seconds]
attila_lendvai_ has quit [Ping timeout: 252 seconds]
bpanthi977 has joined #commonlisp
varjag has joined #commonlisp
triffid has quit [Remote host closed the connection]
crabtastic has quit [Quit: Connection closed for inactivity]
triffid has joined #commonlisp
nani has quit [Ping timeout: 272 seconds]
attila_lendvai has joined #commonlisp
nani has joined #commonlisp
thuna` has joined #commonlisp
jeffrey has joined #commonlisp
stanrifkin has quit [Quit: Leaving]
pranav has quit [Read error: Connection reset by peer]
usagi_mimi has quit [Quit: WeeChat 4.5.2]
usagi_mimi has joined #commonlisp
Guest9896 has quit [Ping timeout: 252 seconds]
jjnkn has quit [Ping timeout: 246 seconds]
markb1 has quit [Ping timeout: 272 seconds]
ryanbw has quit [Ping timeout: 248 seconds]
jon_atack has quit [Ping timeout: 245 seconds]
chomwitt has joined #commonlisp
ryanbw has joined #commonlisp
ryanbw has quit [Ping timeout: 245 seconds]
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
Guest47 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
markb1 has joined #commonlisp
istewart has joined #commonlisp
pve has quit [Quit: leaving]
contrapunctus has quit [Quit: Gateway shutdown]
<veqq>
beach: what do you think leads to existing codebases not wanting improvements? What happened with e.g. sbcl to push you on this path?
cage has quit [Quit: rcirc on GNU Emacs 30.1]
pranav has joined #commonlisp
markb1 has quit [Ping timeout: 260 seconds]
markb1 has joined #commonlisp
chomwitt has quit [Ping timeout: 252 seconds]
markb1 has quit [Ping timeout: 265 seconds]
markb1 has joined #commonlisp
ryanbw has joined #commonlisp
<cdegroot>
I'm not beach but as an "innocent bystander", in today's day and age, hiding in SourceForge and using mailing lists... I have to think about that famous quote out of the Hitchhiker's Guide to the Galaxy. "in the bottom of a locked filing cabinet stuck in a disused lavatory.... " - at the very least, not very inviting. I don't say everybody needs to live on Github (I'm not a fan of freebie handouts by Microsoft but each to their own) but if you _want_
<cdegroot>
(at the same time, as I said before - if I would maintain such an old and widely-used implementation, I'd err on the conservative side and it's quite natural that new ideas on how to implement CL get taken elsewhere)
<cdegroot>
They do git these days.
<tux0r>
sigh. times are a'changing, it seems.
<cdegroot>
But if you need to, CVS is still an option. Yay.
<cdegroot>
Ah, read only.
<tux0r>
i'd much prefer SVN, but i guess that's still there as well
<tux0r>
SVN can delete files and i *tend* to upload passwords.
attila_lendvai has quit [Ping timeout: 252 seconds]
<cdegroot>
Yeah, don't do that (I use 1password, they have a CLI so if I need a password in code, I run the CLI to fetch the password. Multiple solutions abound, storing passwords in files is never a good solution. Never was, not even when CVS was popular :-))
markb1 has quit [Ping timeout: 252 seconds]
<cdegroot>
But while sometimes I reminisce about the Good Old Days, "CVS" or "SVN" never figure. Good riddance.
<tux0r>
i wish "popular" wasn't a relevant measurement in IT anymore
<tux0r>
i much prefer "good" and "efficient" over "popular"
markb1 has joined #commonlisp
<tux0r>
git just isn't efficient.
<veqq>
cdegroot: i store all passwords in pswrds.php
<tux0r>
unless you are the linux kernel team with 3526256 branches
<tux0r>
chances are you aren't
<nil>
At least I put up a sign.
chomwitt has joined #commonlisp
<cdegroot>
git/mercurial/darcs, I think I'd prefer any one of them over svn. Never got along with hit. None as good as Monticello and other Smalltalk VCSes and sometimes I wish that more languages dropped the idea that source code comes in text files ;-)
<cdegroot>
s/dropped/adopted/
<tux0r>
not all source code comes in text files. then again, who unironically develops in piet?
<veqq>
I have a racket project where code gets stored in sqlite
* tux0r
uses fossil for most things and darcs for some ancient one-time projects
<cdegroot>
But overall, git was I think the first VCS - for me - where I was like "yup, good enough". I prefer "good enough" over "perfect" so I stopped looking right then lol
<veqq>
Unfortunately, I pull it out to compile, because I don't understand the compiler well enough to feed it the ast directly from sqlite, yet
<tux0r>
if there was a good, actively developed web UI for SVN, i'd kick my last darcs stuff from darcshub and self-host SVN immediately tbh
<veqq>
But it lets me pull the code out in different views, instead of having flat text
<cdegroot>
(for context, Smalltalk stores source code in the image, as objects (duh), and there's a change log written out that is sorta textual but really more useful as a transaction log of sorts)
<cdegroot>
tux0r: trac not good enough?
<tux0r>
cdegroot: trac is less of a VCS ui and more of a bug tracker AFAICS
<cdegroot>
IIRC - but the last time I used SVN was in '08 or thereabouts - it also had a UI for SVN.
<cdegroot>
And a bug tracker, and a wiki. Dare I say "all that Github should aspire to be" - simple and usable ;-)
<tux0r>
IMNSHO, that's fossil: vcs server and ui and bug tracker and wiki and forum and chat, all contained in a single sqlite file per repository. i wish fossil supported SVN. ;-))
<tux0r>
there *are* things i'd really like to have in SVN
<tux0r>
sigh
<tux0r>
:|
<tux0r>
getting old is not for sissies.
<cdegroot>
One day you'll just throw the towel, get the source code for RCS, and stick with that. Should be trivial to throw a WebUI at that :P
<cdegroot>
(nobody here mention SCCS. That was horrific)
<veqq>
Any idea what blocks having a good web UI for SVN?
<cdegroot>
Trac-tion?
<cdegroot>
I mean, not a lot of users of SVN.
<cdegroot>
The hip people use Git and GitHub or GitLab or GitTea or GitWhatever (or Forgejo), and it's probably another example of "worse is better" - not many people are annoyed enough by Git's quirks to actively hunt for a replacement.
<veqq>
And now it's becoming like the browser, a platform to build (replacements) on top of like juju etc.
<tux0r>
too bad schily died before the SCCS v6 release
<cdegroot>
I had to use it once, first job, we used RCS+helper scripts but, dunno, some customer site and I could not work with it.
<tux0r>
i have exactly one file in SCCS, somewhere in my intranet
<tux0r>
i genuinely wonder where it is
<tux0r>
so that's that :))
<cdegroot>
Darn, now I want to install Trac to see whether it really has/nad a SVN UI. But I already need to learn about floats, people here told me. There goes the evening :)
<gilberth>
I recently moved to fossil. From CVS. The selling point to me is: It's dead easy to host a web interface yourself.
<cdegroot>
(I am looking for self-hosting some code at some point and Trac is very much on the shortlist, because IIRC it had one "project" with tracking and wiki and multiple repos underneath)
<tux0r>
gilberth: now that's quite the transition!
<cdegroot>
(but the path of least resistance? Forgejo)
<tux0r>
cdegroot: if you don't care about the underlying VCS, fossil might be interesting to you as well
<tux0r>
i wish i wouldn't care either
<gilberth>
tux0r: How so? fossil also is designed with a central repository in mind. Unlike git.
<tux0r>
gilberth: "unlike git" is an interesting thing to say in a github-dominated world. ;p generally speaking, fossil is decentralized.
<cdegroot>
I have some simple needs. Don't lose work. I need to sync laptop and desktop. Files in a spot where it gets picked up by nightly backup. And for some repos, a flick of a switch to share them with others.
<tux0r>
there's one "canonical upstream", but that's true for all VCS i know
<cdegroot>
Technically, not Git, unless you coun't Linus' machine for the kernel.
<Alfr>
Are you sure that this discussion belongs here?
<cdegroot>
(One of the ideas I toyed with was to build a DVCS on top of Syncthing because I really want my code everywhere, even on my phone).
<gilberth>
tux0r: Indeed. But I can use fossil just like I would use CVS.
<cdegroot>
Alfr: I was just about to mention "write a UI with CLOG!" ;-)
<tux0r>
true.
<Alfr>
cdegroot, fair! :D
<tux0r>
cdegroot: writing code on smartphones sucks
<cdegroot>
Talk about CL - is there no (D)VCS?
<tux0r>
written in CL, you mean?
<cdegroot>
tux0r: yup, but sometimes it is handy to be able to at least open things up. I even made an edit once or twice.
<cdegroot>
yeah, sorry, written in CL.
<tux0r>
not that i'd know
<cdegroot>
It would automatically be the best (my Smalltalk years have totally spoiled me for "I want everything in the same language").
<tux0r>
one could reimplement svn in CL.. hmm
<tux0r>
maybe if i'll ever have a free minute
<cdegroot>
CLOG UI on it, done.
<tux0r>
now all we need is a renaissance of mocl
<cdegroot>
I run sbcl under Nix on my phone.
<cdegroot>
Still need to sort out graphics, but it runs surprisingly well. If "disk" were quicker, a good phone makes for an excellent little computer these days.
<tux0r>
true, but "nerd solutions" aren't actual solutions
<tux0r>
the few tools of mine which i released into the public usually come with a one-line install-and-done script
markb1 has quit [Ping timeout: 248 seconds]
<tux0r>
"first, install nix" sounds horrible
<TMA>
speaking of (D)VCS, I am still a bit nostalgic for tla
<tux0r>
tl what
<TMA>
TLA ... Tom Lord's Arch
<TMA>
it was a VCS that came about the time as git was created
<tux0r>
oh, that's an ancient thing
<tux0r>
and among the very few VCS i had never even tried
<tux0r>
in 2005, there was a huge market for VCS, it seems. mercurial and git appeared at the same time as well.
<TMA>
it was not that good. but it had some features I miss in git, like tracking renames via tagging files identity
varjag has quit [Ping timeout: 246 seconds]
shka has quit [Quit: Konversation terminated!]
<TMA>
my voyage was rcs -> cvs -> tla -> git [with a detour from git to subversion, because of Sparx Enterprise Architect support for svn versioning]
<TMA>
git is not perfect, but it is good enough for my use cases even if a bit clunky at times
<tux0r>
ah, "good enough". the enemy of "good"
<tux0r>
for most people, svn is good enough
<tux0r>
:o)
* TMA
has a limited amount of attention to invest in reinventing the wheel
<TMA>
tux0r: maybe. the last time I was using it it was still unadvisable (even if notionally possible) to commit while the central repo was not accessible
jonatack has joined #commonlisp
markb1 has joined #commonlisp
<TMA>
which happened quite often, for I had my notebook but very flaky and expensive internet connectivity
<tux0r>
ah, yes. that's still (somewhat) true. but we live in an always-online time (or at least most people do), so that's less of a problem than it was in 2002/2003 when SVN appeared, i guess
<tux0r>
at least that has become better recently
<tux0r>
i can see the point though
<TMA>
that was the main argument for tla over svn (there was 'svk' that offered somewhat equivalent functionality)
<veqq>
Much of the past few years I've spent without stable or strong connections. So many tools etc. are barely useful with it
<veqq>
I started vendoring dependencies just because of that
varjag has joined #commonlisp
Guest86 has joined #commonlisp
usagi_mimi has quit [Quit: WeeChat 4.5.2]
markb1 has quit [Ping timeout: 244 seconds]
usagi_mimi has joined #commonlisp
Guest86 has quit [Quit: Client closed]
<cdegroot>
Talk about dependencies and vendoring - is there anything in the CL work resembling the many variations of dependency lock files? Normally I don't super mind but I had a real job earlier this week sorting out some older and newer packages that came from various quicklisp upstreams...
hellothar has quit [Ping timeout: 272 seconds]
<cdegroot>
"Why is there no quicklisp.lock file in that repo!?" is what I thought :-)
markb1 has joined #commonlisp
<TMA>
"added only after problems are detected"
<reb>
gilberth: The (integer-decode-float 6.931624305923328d19) bug in SBCL was an off by 1 error in bignum-to-double-float. Thanks for mentioning it here. stassats just committed a fix.
<bjorkintosh>
an oby-one error.
stirl has quit [Ping timeout: 252 seconds]
random-nick has quit [Ping timeout: 252 seconds]
stirl has joined #commonlisp
hellothar has joined #commonlisp
hellothar has quit [Remote host closed the connection]
King_julian has quit [Read error: Connection reset by peer]