brokkoli_origin has quit [Ping timeout: 246 seconds]
brokkoli_origin has joined #commonlisp
rkazak has quit [Ping timeout: 260 seconds]
geminium has joined #commonlisp
bpanthi977 has joined #commonlisp
geminium has quit [Ping timeout: 276 seconds]
<|3b|>
sbcl says (format nil "~12g" 4.7683716e-7) is "4.76837160000000e-7". Am i reading the spec correctly that it actually says that is correct?
<|3b|>
and now that i read it closer, the other half puts spaces at the end of the field instead of the beginning, which also isn't what i want
spdegabrielle has quit [Quit: Connection closed for inactivity]
bpanthi977 has quit [Ping timeout: 248 seconds]
bpanthi977 has joined #commonlisp
jonatack has joined #commonlisp
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 260 seconds]
josrr has quit [Remote host closed the connection]
rkazak has joined #commonlisp
Demosthe1ex has joined #commonlisp
waleee has quit [Ping timeout: 252 seconds]
Demosthenex has quit [Ping timeout: 244 seconds]
surabax has quit [Quit: Leaving]
Demosthenex has joined #commonlisp
<|3b|>
ah, i guess the spaces at the end maybe makes sense, but still tends to pick the wrong representation and put way too many 0 at the end :/
Demosthe1ex has quit [Ping timeout: 260 seconds]
Demosthe1ex has joined #commonlisp
amb007 has joined #commonlisp
Demosthenex has quit [Ping timeout: 260 seconds]
Demosthenex has joined #commonlisp
rkazak has quit [Ping timeout: 252 seconds]
amb007 has quit [Ping timeout: 245 seconds]
Demosthe1ex has quit [Ping timeout: 244 seconds]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 265 seconds]
bpanthi977 has quit [Ping timeout: 246 seconds]
jonatack has quit [Read error: Connection reset by peer]
jonatack has joined #commonlisp
gorignak has joined #commonlisp
jonatack has quit [Ping timeout: 244 seconds]
random-nick has quit [Ping timeout: 244 seconds]
ym has joined #commonlisp
alfiee has joined #commonlisp
rkazak has joined #commonlisp
jonatack has joined #commonlisp
alfiee has quit [Ping timeout: 248 seconds]
soweli_iki has joined #commonlisp
soweli_iki has quit [Changing host]
soweli_iki has joined #commonlisp
m5zs7k has quit [Ping timeout: 245 seconds]
rkazak has quit [Ping timeout: 260 seconds]
m5zs7k has joined #commonlisp
m5zs7k has quit [Ping timeout: 248 seconds]
rkazak has joined #commonlisp
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 260 seconds]
geminium has joined #commonlisp
<pillton>
Oh I hate the spec entry for Tilde G format directive. It seems to be computing the right value for d to pass to the Tilde E directive. Does it operate correctly?
istewart has quit [Quit: Konversation terminated!]
Inline has quit [Ping timeout: 252 seconds]
geminium has quit [Ping timeout: 260 seconds]
bpanthi977 has joined #commonlisp
manwithluck has quit [Ping timeout: 245 seconds]
m5zs7k has joined #commonlisp
manwithluck has joined #commonlisp
<|3b|>
sbcl seems to calculate the value of d to pass to ~e as per the spec. that value seems to be pretty silly for most floats
<|3b|>
unless the spec is ambiguous i guess
<|3b|>
it says " number of digits needed to print arg with no loss of information and without leading or trailing zeros"
<|3b|>
if that means printing 0.01 as .01 you get 3, and then passing that to ~e means you get 1.000e-2, which is not generally what you want
<|3b|>
if it means "1", you get 1.0e-2, which would be reasonable
* |3b|
(and apparently sbcl) interpret it the first way
rkazak has quit [Ping timeout: 260 seconds]
<|3b|>
how that is calculated also affects which of ~e and ~f it uses, so you get similarly useless output from large numbers where it uses ~f with huge # of trailing 0s (and a trailing . just to make it look like a base 10 integer for extra usefulness)
<pillton>
Well, n is negative for all args less than 0.1 so it boils down to q.
<|3b|>
right, question is how q is calculated
<|3b|>
though maybe N would confuse things for ~f with large numbers, would have to think about that case some more
<pillton>
You would think for negative n that q would be chosen to not change the number of significant digits.
<|3b|>
ah, min means it wouldn't
<|3b|>
right, question is whether q is "significant digits" (2nd interpretation) or "significant digits + all 0 between those and the decimal place" (first interpretation)
<|3b|>
printing 0.01 as 1 would lose information, so a literal reading says that is wrong
<pillton>
Yeah, but is a decimal point classed as a digit?
<|3b|>
and i don't interpret the 0 in .01 as a "leading 0" for that reason
<|3b|>
yeah, i'd still count .01 as 2 even if . was ignored though with that reading
* |3b|
does thing the 2nd interpretation ("significant digits") is correct now that i've realized it could be interpreted that way, i just didn't read it that way to start with, and apparently neither did sbcl devs
<|3b|>
(at least twice, since it was implemented that way, then someone followed the spec and got the same results in a bug report)
<pillton>
Hmm.. I'd have to figure out if people interpret 0.1e+0 differently to 1.0e-1. I would have thought they would.
<|3b|>
don't think that matters
<|3b|>
those are the same #, and picking one or the other might be nicer but neither is horrible
<pillton>
Well, if you interpret the spec as significant digits then you would expect it to output the correct number of significant digits. Rightly or wrongly, I think 1.0e-1 has two significant digits, where 0.1e+0 has one.
<|3b|>
my problem is with things like (length (format nil "~2g" most-positive-double-float)) -> 314
<|3b|>
and 347 for least-p-d-f
<|3b|>
almost all 0
<|3b|>
and it doesn't have to be exactly significant digits as written, since we are coming from some binary representation
<|3b|>
and being within 1 would be much better then writing 320+ extra characters
<pillton>
I'd probably roll my own with d equal to the number of significant digits minus 1 for the Tilde E case.
<|3b|>
so "convert the mantissa to base 10 and remove trailing 0s" or something
<|3b|>
well, what is "significant (decimal) digits" for a 23 bit binary fraction?
<|3b|>
(or remove leading 0s for denormals i guess?)
m5zs7k has quit [Ping timeout: 252 seconds]
<pillton>
"An exercise for the reader" 🥲
<|3b|>
all floats are binary 1.bbbbbbbbbbbbbbbbbbbbbb or similar, with exactly 23 significant bits
<|3b|>
which is 7.22 decimal digits, which we can probably agree isn't a useful number of significant digits :)
<pillton>
Yeah ok. I see your point.
decweb has quit [Quit: Konversation terminated!]
alfiee has joined #commonlisp
<|3b|>
so that leaves "convert to decimal and remove extra 0s", or "convert to decimal and keep extra 0s" as reasonable options
<|3b|>
but probably most people that didn't specify a # of digits after decimal want the variable width version with them removed
<pillton>
I would convert to decimal and strip all leading 0s and the decimal point and all trailing zeros.
edgar-rft_ has joined #commonlisp
<|3b|>
yeah, i think that is the intended interpretation
<|3b|>
a reasonable approximation of significant digits, and probably reasonable output with the rest of the algorithm as it is
alfiee has quit [Ping timeout: 248 seconds]
edgar-rft` has quit [Ping timeout: 252 seconds]
m5zs7k has joined #commonlisp
rkazak has joined #commonlisp
<|3b|>
though i'll probably still end up reimplementing ~g because i don't like trailing whitespace at the end of a line :p
<pillton>
What do you mean by a "reasonable approximation of significant digits"? The CL floating point representation cannot distinguish between 0.1 and 0.10.
<|3b|>
like you said "1.0" when written by a human is 2 sig digits, but 1 is a "reasonable approximation" when converting from a float, since the binary float can't distinguish between 1. 1.0 1.00 etc
King_julian has joined #commonlisp
<|3b|>
and we can't write 0.22 of a 0 at the end to get it exactly right
<|3b|>
(or however much of a 0 we would need for a double float)
<|3b|>
so "as many as we need to recreate the original binary float" is probably reasonable
<pillton>
Ah ok. Yeah. That is all you can do. The d argument to Tilde E is for what the user wants to communicate.
<|3b|>
or more specifically, "the minimum we need to unambiguously represent the original float"
<|3b|>
right
rkazak has quit [Ping timeout: 260 seconds]
jonatack has quit [Ping timeout: 252 seconds]
alfiee has joined #commonlisp
ym has quit [Ping timeout: 248 seconds]
alfiee has quit [Ping timeout: 272 seconds]
geminium has joined #commonlisp
<|3b|>
(and apparently i should be more careful grabbing numbers off wikipedia, since you need 9 digits to write a single float safely, even if it only has 7.22 digits worth of bits)
rkazak has joined #commonlisp
* |3b|
would have probably gotten it wrong in the same way if i tried to calculate it though :/
rtypo has quit [Ping timeout: 260 seconds]
geminium has quit [Ping timeout: 272 seconds]
rkazak has quit [Ping timeout: 248 seconds]
rkazak has joined #commonlisp
<pillton>
Huh "Converting a double-precision binary floating-point number to a decimal string is a common operation, but an algorithm producing results that are both accurate and minimal did not appear in print until 1990, with Steele and White's Dragon4." from the Floating-point Arithmetic page on Wikipedia.
<|3b|>
yeah, and people have still been working on adding 'fast' to that fairly recently :)
rkazak has quit [Ping timeout: 276 seconds]
<|3b|>
(or was it parsing them? don't remember)
amb007 has joined #commonlisp
vardhan has joined #commonlisp
alfiee has joined #commonlisp
robin__ has joined #commonlisp
zwr has joined #commonlisp
alfiee has quit [Ping timeout: 260 seconds]
robin_ has quit [Ping timeout: 252 seconds]
vardhan has quit [Ping timeout: 265 seconds]
King_julian has quit [Read error: Connection reset by peer]
vardhan has joined #commonlisp
vardhan has quit [Read error: Connection reset by peer]
vardhan_ has joined #commonlisp
vardhan_ has quit [Ping timeout: 245 seconds]
pve has joined #commonlisp
rkazak has joined #commonlisp
ym has joined #commonlisp
Th30n has joined #commonlisp
ym has quit [Ping timeout: 244 seconds]
Pixel_Outlaw has quit [Quit: Leaving]
rkazak has quit [Ping timeout: 260 seconds]
mishoo has joined #commonlisp
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 244 seconds]
rkazak has joined #commonlisp
bpanthi977 has quit [Ping timeout: 276 seconds]
Th30n has quit [Remote host closed the connection]
jonatack has joined #commonlisp
Th30n has joined #commonlisp
geminium has joined #commonlisp
bendersteed has joined #commonlisp
geminium has quit [Ping timeout: 246 seconds]
geminium has joined #commonlisp
rkazak has quit [Ping timeout: 246 seconds]
<beach>
Let me remind you of Quaviver, a library worked on by yitzi and paulapatience for printing and reading floating point numbers, fast and accurately.
alfiee has joined #commonlisp
King_julian has joined #commonlisp
mivanchev has joined #commonlisp
<mivanchev>
hey, is there a way to get the size of the machine bus width / machine word size?
<mivanchev>
i.e. 64 for 64-bit machines
<|3b|>
most reliable would probably be knowing about the various things that might be on *features* for particular implementations
<mivanchev>
yes, it's SBCL
<|3b|>
and/or using trivial-features to get something consistent from multiple implementations
alfiee has quit [Ping timeout: 265 seconds]
<|3b|>
trivial-features adds :64-bit and :32-bit, don't remember sbcl specifics
<ixelp>
trivial-features/SPEC.md at master · trivial-features/trivial-features · GitHub
<mivanchev>
hmmm, I guess i need the closest equivalent of finding the size of a signed long in the C runtime
<|3b|>
if you are actually talking to C, you probably want to ask cffi what it thinks a signed long is
<|3b|>
(or whatever sb-alien if you use that directly)
<|3b|>
if you aren't talking to C, *features* is probably good enough
<beach>
I am guessing that MOST-POSITIVE-FIXNUM would be very close.
ingeniot has joined #commonlisp
<mivanchev>
|3b|, GOOD CALL, cffi has a sizeof!!
<mivanchev>
thanks
<mivanchev>
let's use that
<beach>
,(integer-length most-positive-fixnum)
<ixelp>
=> 29
<mivanchev>
yes, fixnum is 2^62 here
<|3b|>
yeah, looks like that's what trivial-features would do on ccl :/
<|3b|>
but if you are wondering about ffi probably better to ask it directly
<|3b|>
for example here (cffi:foreign-type-size :long) => 4 but (integer-length most-positive-fixnum) => 62
<mivanchev>
yeah i got it going already, thanks |3b| :)
bpanthi977 has joined #commonlisp
rkazak has joined #commonlisp
<|3b|>
beach: can you define your own style easily in quaviver? (as in pick features directly, not adding anything) for example adding hex floats to CL styles
ingeniot has quit [Ping timeout: 240 seconds]
<|3b|>
or even just having only hex floats
<beach>
|3b|: As I recall, it supports several styles, including Python, C++, etc. But I don't have the full list of features. If there is a library I don't have to work on, I won't, and this one is doing quite well without me. :)
<beach>
You should ask yitzi or paulapatience.
<|3b|>
right, saw the docs and it lists languages not features
bpanthi977 has quit [Ping timeout: 260 seconds]
* |3b|
has no idea which of those would have hex floats, and worse no idea what else it would have that i might not want (like 0123 being octal or something)
<beach>
Hex or octal floats would be trivial, no? Just a matter of regrouping the bits.
<beach>
So it would be fast and 100% accurate.
<|3b|>
yeah, hex is probably trivial, but if i were to write them i'd probably prefer it to match what other languages do, so i'd have to go look that up
rainthree has joined #commonlisp
<|3b|>
(and octal was an example of something i don't want to get accidentally, where leading 0 parses as octal)
Guest47 has joined #commonlisp
<|3b|>
and mixing hex floats with normal floats and ratios is slightly less trivial
<|3b|>
and someone advertised a library for that, so thought i'd ask :)
* |3b|
will investigate further at some point when i have an actual need for it
rkazak has quit [Ping timeout: 272 seconds]
rainthree has quit [Ping timeout: 260 seconds]
alfiee has joined #commonlisp
varjag has joined #commonlisp
alfiee has quit [Ping timeout: 252 seconds]
Guest47_ has joined #commonlisp
thuna` has joined #commonlisp
<jackdaniel>
Shinmera: I see; thanks for trying. do you have somewhere handy instructions how to install your ql dist and load trial?
Guest47_ has quit [Remote host closed the connection]
kenran has quit [Remote host closed the connection]
jonatack has quit [Read error: Connection reset by peer]
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
jonatack has joined #commonlisp
rkazak has quit [Ping timeout: 248 seconds]
varjag has quit [Read error: Connection reset by peer]
alfiee has joined #commonlisp
markb1 has joined #commonlisp
mwnaylor has joined #commonlisp
alfiee has quit [Ping timeout: 252 seconds]
jackdaniel has quit [Quit: Lost terminal]
jackdaniel has joined #commonlisp
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
Equill has quit [Ping timeout: 260 seconds]
eddof13 has quit [Quit: eddof13]
chsasank6 has joined #commonlisp
chsasank has quit [Ping timeout: 276 seconds]
chsasank6 is now known as chsasank
prokhor has quit [Remote host closed the connection]
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
prokhor has joined #commonlisp
bpanthi977 has quit [Ping timeout: 260 seconds]
bpanthi977 has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
amb007 has quit [Ping timeout: 244 seconds]
geminium has quit [Ping timeout: 248 seconds]
rkazak has joined #commonlisp
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
waleee has joined #commonlisp
josrr has quit [Remote host closed the connection]
lagash has joined #commonlisp
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
jonatack has joined #commonlisp
rkazak has quit [Ping timeout: 265 seconds]
mange has joined #commonlisp
gorignak has quit [Quit: quit]
alfiee has joined #commonlisp
gorignak has joined #commonlisp
jonatack has quit [Ping timeout: 252 seconds]
alfiee has quit [Ping timeout: 252 seconds]
<skin>
q
skin has quit [Quit: leaving]
skin has joined #commonlisp
<skin>
Sorry abou the 'q', messed up in my client
<skin>
Hey NotThatRPG, I'm doing a study on ASDF hoping to find some way to improve it. Do you have any ideas on that front? What are the biggest headaches?
rkazak has joined #commonlisp
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
bpanthi977 has quit [Ping timeout: 265 seconds]
apac has joined #commonlisp
rkazak has quit [Ping timeout: 246 seconds]
bpanthi977 has joined #commonlisp
pve has quit [Quit: leaving]
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
brokkoli_origin has quit [Remote host closed the connection]
spdegabrielle has quit [Quit: Connection closed for inactivity]
shka has quit [Quit: Konversation terminated!]
brokkoli_origin has joined #commonlisp
rkazak has joined #commonlisp
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
bpanthi977 has quit [Remote host closed the connection]
bpanthi977 has joined #commonlisp
rkazak has quit [Ping timeout: 276 seconds]
amb007 has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
alfiee has joined #commonlisp
amb007 has quit [Ping timeout: 260 seconds]
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
alfiee has quit [Ping timeout: 252 seconds]
rkazak has joined #commonlisp
rkazak has quit [Ping timeout: 246 seconds]
alternateved has quit [Remote host closed the connection]
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
Inline has quit [Ping timeout: 265 seconds]
bpanthi977 has quit [Ping timeout: 246 seconds]
gorignak has quit [Quit: quit]
gorignak has joined #commonlisp
bpanthi977 has joined #commonlisp
rkazak has joined #commonlisp
Inline has joined #commonlisp
bpanthi977 has quit [Remote host closed the connection]
bjorkintosh has quit [Remote host closed the connection]