jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
eddof13 has quit [Client Quit]
<verisimilitude> Do clocks work, aeth?
<verisimilitude> Can clocks work, aeth?
<aeth> Good question. I constantly have to set the digital clocks in each room because they constantly drift out of sync. The only ones that maintain time properly over months/years are the ones that synchronize every night via radio signals, which are usually marketed as "atomic clocks". https://en.wikipedia.org/wiki/Radio_clock
<aeth> If I could make every clock be an atomic clock, I would because that would save me a lot of setting.
<aeth> You can also have them synchronize over GPS or over the network, but the ones that never synchronize always drift out of sync. Always.
<verisimilitude> So yes or no?
doyougnu has joined #commonlisp
<Bike> do i need to be more clear about this? this philosophical discussion or whatever you're doing doesn't belong here. you've been talking about this for like two hours. please use lispcafe or PMs or something.
<verisimilitude> I think I've already made my point, so I'm fine stopping now.
doyougnu has quit [Remote host closed the connection]
<aeth> An unreliable clock that synchronizes is actually very close to correctables (e.g. correctable errors) in the Common Lisp condition system, if you're going to keep arguing by analogy. But these tangential analogies makes Bike unhappy so I should stop, too.
pranavats has left #commonlisp [Error from remote client]
tyson2 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
Lycurgus has joined #commonlisp
doyougnu has joined #commonlisp
tyson2 has joined #commonlisp
pranavats has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 250 seconds]
Lord_of_Life_ is now known as Lord_of_Life
causal has joined #commonlisp
makomo has quit [Quit: WeeChat 3.5]
Lycurgus has quit [Quit: Exeunt juan@acm.org]
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
gpiero has quit [Quit: Quitting...]
gpiero has joined #commonlisp
<neominimum> I am intrigued by the conversation that just occured. Enlighten me, but I don't see how software can be perfect.
<neominimum> All judgements require a model with which to be evaluated against. I don't think there is such a thing as a perfect model that applies to all space and time.
<neominimum> One can see that whole history of philosophy so far is philosophers debating about what arbitrary tautologies to base their personal subjective logical model upon. There currently still is no agreement as to what the perfect logical model is.
<neominimum> Unless one endeavours to constrain the domain in some way there can be no consensus about logical conclusions, but this requires all involved to subscribe to the given constraints.
<neominimum> We can easily find a contradiction in the example given before about the New York Blackout. Conside that the blackout may have avoided death that would have otherwise occurred, say, a child who stuck a fork in the toaster during this period.
tyson2 has quit [Remote host closed the connection]
<aeth> neominimum: not really "perfect" but see e.g. https://en.wikipedia.org/wiki/SPARK_(programming_language) or https://en.wikipedia.org/wiki/MISRA_C for efforts in other programming languages
<aeth> they're wise enough to not claim perfection, though
<aeth> you would start from a formal specification of Common Lisp and attempt to prove (using "proof" in the math sense, like a mathematical automatic theorem prover) that the program is correct, but you'll obviously still run into some issues for a Turing complete language like the halting problem.
<aeth> This is probably combined with a tool to ensure complete test coverage
<aeth> so you would need to start by turning something like this into a formal language. https://github.com/robert-strandh/Well-Specified-Common-Lisp
verisimilitude has quit [Read error: Connection reset by peer]
<aeth> You might do something like this. https://en.wikipedia.org/wiki/Design_by_contract
<aeth> it's a bit subjective and there are multiple parallel approaches, which might even be combined
<aeth> it greatly slows down development, though
tyson2 has joined #commonlisp
<aeth> most people settle for unit tests and maybe type checking
tyson2 has quit [Remote host closed the connection]
<aeth> You might have a DEFINE-VERIFIED-FUNCTION macro that refuses to compile if you don't cover every possible case. You can sometimes get this in places e.g. ECASE or ETYPECASE, but that's at runtime.
Everything has left #commonlisp [#commonlisp]
tyson2 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
doyougnu has quit [Ping timeout: 268 seconds]
<neominimum> Yes those appoaches do help to achieve relatively perfect software, but they are examples of highly constrained domains. They only consider a small portion of the broader conversation about what makes software absolutely good or perfect.
tyson2 has joined #commonlisp
<neominimum> Sorry, I have to run. Have a nice day all.
<aeth> Right. You're probably not going to get something substantial like a game engine or a web browser to be "perfect" in any sense.
<neominimum> Agreed!
<aeth> At least, not something that's considered complete and competitive in those domains.
<aeth> I actually wonder how databases handle things because they kind of have it the hardest because you care about correctness more there.
<aeth> I personally would consider those the three classic hard programs to write (in fairly different domains/approaches): game engine, web browser, database.
tyson2 has quit [Remote host closed the connection]
<Bike> databases at least have some formalizable good qualities, like ACID and stuff
tyson2 has joined #commonlisp
<Bike> and even if you can't for example formally verify that something is a good video game, you can verify some of the components that make it up
<hayley> "Safety and liveness are not the only properties of a program that are of interest. For example, one might like to know the program's probability of terminating, or whether it is cute. However, I do not know of any practical method for reasoning about such properties."
<Bike> probability of termination actually does have some interesting math
<Bike> cuteness maybe not so much, but i haven't checked with the cuteologists
eddof13 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
eddof13 has quit [Client Quit]
<Bike> compiler warnings about stuff like type conflicts are basically a step in the direction of verification, and pretty tractable and easy for the programmer to deal with, but also limited
<Bike> i would like to get compilers doing things like warning about incorrect dynamic extent declarations, for one, but of course the standard declarations can't really be used to express all program properties one might care about
<aeth> there's actually a science behind cuteness, but that would be more for the graphics than the program itself
<Bike> (off the top of my head, you can't express information about the coupled types of two variables, like "if X is a function Y is NIL"
tyson2 has joined #commonlisp
<aeth> in a sense, though, one could consider Lisp to be a cute language because it uses ()s where other languages use {}s and []s
<aeth> its programs also tend to be smaller
<aeth> but if you're going to associate that with a language in this family, it'd probably be more Scheme than Common Lisp, I guess
<aeth> I guess you could also try to judge the mascot. http://www.lisperati.com/logo.html
molson has joined #commonlisp
molson has quit [Remote host closed the connection]
ec has quit [Ping timeout: 258 seconds]
ec has joined #commonlisp
Lord_Nightmare has quit [Quit: ZNC - http://znc.in]
Lord_Nightmare has joined #commonlisp
waleee has quit [Ping timeout: 268 seconds]
jeosol has joined #commonlisp
Oladon has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
nicmollel[m] has joined #commonlisp
xlarsx has joined #commonlisp
xlarsx has quit [Ping timeout: 246 seconds]
xlarsx has joined #commonlisp
xlarsx has quit [Remote host closed the connection]
xlarsx has joined #commonlisp
Alfr is now known as Guest7943
Alfr has joined #commonlisp
Guest7943 has quit [Ping timeout: 252 seconds]
igemnace has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
verisimilitude has joined #commonlisp
_cymew_ has joined #commonlisp
shka has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
shka has joined #commonlisp
lottaquestions_ has joined #commonlisp
lottaquestions has quit [Ping timeout: 246 seconds]
pranavats has left #commonlisp [Error from remote client]
pranavats has joined #commonlisp
bitmapper has joined #commonlisp
gxt has quit [Ping timeout: 258 seconds]
Oladon has quit [Quit: Leaving.]
MajorBiscuit has joined #commonlisp
gxt has joined #commonlisp
Cymew has joined #commonlisp
m5zs7k has quit [Ping timeout: 265 seconds]
MajorBiscuit has quit [Ping timeout: 260 seconds]
lsj has joined #commonlisp
MajorBiscuit has joined #commonlisp
m5zs7k has joined #commonlisp
<pjb> neominimum: exactly: we'd have to have a formal specification for space-time (the universe) itself first. Physics is far from it. I hinted at that with "you'd have to start with sand", but indeed, even sand is a flaky foundation, since its atoms and particules could be specific (eg. they could be entangled with quantum pairs in the other side of the universe, and could change state at any time, thus magic).
<pjb> neominimum: while electronicians's or chip makers' work is to isolate us from the universe flakyness, they can't always do it, either because of bugs in their design, or because of cosmic rays flipping bits here and there.
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
<verisimilitude> What dumbfuckery.
<beach> I think we should drop the off-topic stuff.
<verisimilitude> I think it's been educational, in any case, beach.
<beach> That's not a sufficient reason.
<verisimilitude> I know not to take advice from certain people here now, as do others.
<verisimilitude> I agree.
pranavats has left #commonlisp [Error from remote client]
pranavats has joined #commonlisp
<verisimilitude> I recommend the entire ``Softword'' really, but that chapter's special.
<neominimum> My bad, I'll try lispcafe next time. Although I do wonder why verisimilitude thinks such vitriolic language is warranted.
<verisimilitude> I care deeply about this topic.
azimut has quit [Ping timeout: 258 seconds]
<beach> Still, I think attributes such as "shit" or "joke" should either be avoided, or accompanied by some evidence.
<phoe> verisimilitude: ...so lemme get this straight, if you care deeply about some topic then you're justified in posting vitriol to #commonlisp
<verisimilitude> I see no rule against adult language here.
<beach> No, it just makes you much less credible.
<verisimilitude> Okay.
aartaka has joined #commonlisp
<jackdaniel> I don't remember signing any moderator Code of Conduct, so don't get surprised if I kick for 'vitrolic language'; just a friendly warning, I tend to do that when i bad mood ,)
<jackdaniel> I'm in a bad mood*
<verisimilitude> Do it or don't.
<verisimilitude> This is ridiculous.
ec has quit [Ping timeout: 258 seconds]
<phoe> eh, use of aggressive language follows social cues and #commonlisp is no different in this regard
attila_lendvai has joined #commonlisp
Brucio-61 has quit [Ping timeout: 268 seconds]
scymtym has quit [Ping timeout: 252 seconds]
<jackdaniel> I don't mind occassional 'fucks' and other variants of adult language, but toxicity is another story
<verisimilitude> I don't hug people because I'm toxic.
ec has joined #commonlisp
<_death> best keep signal/(noise∪rants) high
<splittist> What are some good examples of 'pluggable' error-handling strategies? Something like being able to specify that a particular 'run' should drop into the debugger, another should return a list of conditions encountered, another should return a list of messages...
<neominimum> Passion is fine with me, but displays of excessive stimulation of the limbic system implies an inhibition of logical though processes. Conditions under which rational discussion cannot ideally take place.
<beach> splittist: What do you mean by "pluggable"?
<phoe> splittist: define different handlers around the rest run I guess?
<phoe> one handler can directly #'INVOKE-DEBUGGER, another can collect the condition object into some sorta list, yet another can log it to text
<verisimilitude> Unfortunately, HTTP would qualify, wouldn't it, splittist?
<phoe> verisimilitude: what does HTTP have to do with lisp error handling strategies
<verisimilitude> In general, the error codes of increasing specificity IETF protocols tend to use isn't strictly bad.
<_death> I don't know of any such high-level error handling strategy library.. but maybe https://github.com/melisgl/journal could come close or be shaped so
<splittist> I have something like (PROCESS-FILES LIST-OF-FILES). All sorts of things can go wrong when processing a particular file - I wrote the software, after all. I would like the caller of PROCESS-FILES to be able to specify what action to taken upon encountering an error in the bits that PROCESS-FILE calls. Thanks to all who responded while I wrote this comment!
<pjb> splittist: note that by default the only way to handle errors is to perform a non-local exit. To be able to handle an error by continuing or retrying, you need to set up things in advance, with a call to CERROR instead of ERROR, or a restart and a loop.
<phoe> splittist: sounds like a prime case for handler-bind
<verisimilitude> I can point to a small example I've written, if that would help, splittist.
<phoe> have you read the PCL chapter on conditions? it has a very similar case study in there
<phoe> it has processing log entries, where you have files
<splittist> phoe: thanks. Will re-read.
<aeth> As far as where to draw a line in moderation, imo 'fuck, I forgot to recompile my code' is fine, while calling people 'dumb fucks' is not because the first one is directed either at oneself or just computing in general and is very understandable.
<verisimilitude> I called the continued conversation ``dumbfuckery''.
<aeth> right
<aeth> that's more in between and unclear
Brucio-61 has joined #commonlisp
<aeth> anyway, my point is that it's about where it's directed rather than what is said
<jackdaniel> let's put this topic in a grave and move on ;) as a last remark, swears are not very "adult"-like, so this is quite paradoxical
scymtym has joined #commonlisp
attila_lendvai has quit [Ping timeout: 248 seconds]
<_death> depends on the insults :) I'm reminded of a book called "Very Nice Ways to Say Very Bad Things"
<aeth> this has moved to #lispcafe (you're not there)
<aeth> But if it does go to flames and swears and insults and it's in #commonlisp, there are things you can say, such as "Good question, I haven't considered that. I'll look into it." Sure, you "lose" the argument. But #commonlisp remains on-topic.
<aeth> (Doesn't really work too well on IRC though because someone else can reply, though)
verisimilitude has quit [Ping timeout: 264 seconds]
xlarsx has quit [Remote host closed the connection]
xlarsx has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 265 seconds]
aartaka has joined #commonlisp
random-nick has joined #commonlisp
pve has joined #commonlisp
makomo has joined #commonlisp
xlarsx has quit [Remote host closed the connection]
xlarsx has joined #commonlisp
xlarsx has quit [Ping timeout: 268 seconds]
thuna` has joined #commonlisp
mathrick has quit [Ping timeout: 260 seconds]
makomo has quit [Ping timeout: 268 seconds]
xlarsx has joined #commonlisp
xlarsx has quit [Ping timeout: 252 seconds]
azimut has joined #commonlisp
megeve has quit [Write error: Connection reset by peer]
megeve has joined #commonlisp
azimut has quit [Remote host closed the connection]
hineios has quit [Ping timeout: 260 seconds]
azimut has joined #commonlisp
makomo has joined #commonlisp
makomo has quit [Ping timeout: 252 seconds]
mingus has quit [Quit: mingus]
gateway2000 has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 250 seconds]
aartaka has joined #commonlisp
makomo has joined #commonlisp
mingus has joined #commonlisp
tyson2 has joined #commonlisp
azimut has quit [Ping timeout: 258 seconds]
mingus1 has joined #commonlisp
akonai_ has quit [Ping timeout: 268 seconds]
mingus has quit [Ping timeout: 250 seconds]
mingus1 is now known as mingus
epony has quit [Quit: QUIT]
notzmv has joined #commonlisp
waleee has joined #commonlisp
attila_lendvai has joined #commonlisp
akonai has joined #commonlisp
hineios has joined #commonlisp
akonai has quit [Ping timeout: 252 seconds]
attila_lendvai has quit [Ping timeout: 268 seconds]
cage has joined #commonlisp
akonai has joined #commonlisp
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
<random-nick> when you're some code from external files, e.g. some ffi definitions, what's the best way to compile it with the file compiler?
<random-nick> while playing along with asdf
<random-nick> mean to say when you're generating
random-nick has quit [Quit: quit]
random-nick has joined #commonlisp
thuna` has quit [Ping timeout: 265 seconds]
eddof13 has joined #commonlisp
son0p has quit [Ping timeout: 268 seconds]
xlarsx has joined #commonlisp
Cymew has quit [Ping timeout: 264 seconds]
epony has joined #commonlisp
aartaka has quit [Ping timeout: 265 seconds]
mingus1 has joined #commonlisp
mingus has quit [Ping timeout: 260 seconds]
mingus1 is now known as mingus
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
aartaka has joined #commonlisp
eddof13 has joined #commonlisp
<pjb> random-nick: good question.
<pjb> random-nick: I guess it would involve a :in-order-to clause, but I don't know what pre-existing operation to use. Perhaps you'd also have to define a generate-source-op operation?
<pjb> random-nick: that said, so far I always had to tune manually the cffi definitions. When generating them from C header, they rarely can be used directly. So my ffi definitions are actual sources, not generated on the fly.
xlarsx has quit [Remote host closed the connection]
xlarsx has joined #commonlisp
xlarsx has quit [Ping timeout: 246 seconds]
xlarsx has joined #commonlisp
jmdaemon has quit [Ping timeout: 252 seconds]
drbluefall has joined #commonlisp
waleee has quit [Ping timeout: 268 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
triffid has quit [Remote host closed the connection]
makomo has quit [Ping timeout: 260 seconds]
<Josh_2> Good Morning
<Josh_2> :sunglasses:
* drbluefall waves hello ' ')/
aartaka has quit [Ping timeout: 252 seconds]
ebrasca has joined #commonlisp
causal has quit [Quit: WeeChat 3.6]
Oladon has joined #commonlisp
avocadoist has quit [Ping timeout: 260 seconds]
Lycurgus has joined #commonlisp
makomo has joined #commonlisp
Lycurgus has quit [Quit: Exeunt juan@acm.org]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
son0p has joined #commonlisp
verisimilitude has joined #commonlisp
<resttime> Decent chunk of progress on my raytracer I wrote: https://i.imgur.com/72qiKN6.jpg took ~9hr to render on a dinky laptop. Wraps up the first week in "Ray Tracing in One Weekend"
<jackdaniel> resttime: looks nice
<Bike> ooh, double reflections. neat.
<resttime> It's a nice resource: https://raytracing.github.io/
<resttime> I went through all three weeks with Rust, doing it in Common Lisp to see how far I can take it in terms of performance
hirez- has joined #commonlisp
MajorBiscuit has quit [Ping timeout: 268 seconds]
hirez has quit [Read error: Connection reset by peer]
<drbluefall> ay, that's pretty cool.
xlarsx has quit [Remote host closed the connection]
xlarsx has joined #commonlisp
hirez- has quit [Quit: Later]
tyson2 has quit [Remote host closed the connection]
hirez has joined #commonlisp
<Catie> Seconded on its quality as a resource. Translating the C++ code is a bit of a pain, but that's just kind of how it goes
xlarsx has quit [Ping timeout: 252 seconds]
xlarsx has joined #commonlisp
drbluefall has quit [Remote host closed the connection]
ebrasca has quit [Remote host closed the connection]
scymtym has quit [Ping timeout: 250 seconds]
Brucio-61 has quit [Ping timeout: 268 seconds]
hirez- has joined #commonlisp
<Josh_2> resttime: How is done?
<Josh_2> How's*
hirez has quit [Ping timeout: 252 seconds]
<resttime> Josh_2: Meaning how does raytracing work or how it's written in common lisp?
eddof13 has joined #commonlisp
Brucio-61 has joined #commonlisp
cercopith has joined #commonlisp
pve has quit [Quit: leaving]
<Josh_2> How does it perform?
<resttime> I'll need to finish going through the other two parts of the series and add parallel processing first to figure out
<resttime> (Can't make a good comparison without feature parity and common render)
<resttime> One thing I can note about development is that it does take more effort optimize for performance in Common Lisp
<White_Flame> I'm not sure that's true
<White_Flame> in other languages, you're basically forced to make all those related low-level decisions up front
<White_Flame> so you have a sunk cost that likely paid mind to optimization already
<White_Flame> the ability to (time (foo)) on the repl and immediately change things is also a much better optimization cycle than full compile/execute elsewhere
scymtym has joined #commonlisp
<White_Flame> and of course disassembly is a great, fast tool available in CL which is a slow slog elsewhere
cosimone has joined #commonlisp
Dynom_ has joined #commonlisp
Dynom_ is now known as Guest29
<resttime> Hmmm, maybe to clarify is that while writing in Common Lisp needed to dig into compiler internals, check the profiler output, inspect assembly, and etc. This itself took time and a mental overhead. Rust and similar langs have these low-level descions upfront so that sort of time spent on this kind of optimization wasn't "needed"
<White_Flame> you can write CL in the same way, too
<White_Flame> banging concrete types and alignment and whatnot
<White_Flame> right from the get-go
<White_Flame> also with the advantage of metaprogramming
<resttime> I guess my thoughts is that it's the "defaults" that made the difference regardless of whether something can be done irrespectively of the language
cosimone has quit [Ping timeout: 252 seconds]
Oladon has quit [Quit: Leaving.]
tyson2 has joined #commonlisp
<verisimilitude> Choosing concrete types isn't performance optimization, or at least shouldn't be.
<verisimilitude> In Ada, such decisions can be made early, but they're not low-level, and the general idea is to tweak the representation later on for optimization, not to strictly choose types for optimization.
<verisimilitude> That is, to tweak the representation of the type, not the type itself.
<aeth> floating point *is* a performance optimization, it's just one that basically everyone should go with, with few exceptions
<aeth> (which I'm assuming any ray tracer uses)
<Catie> When I went through RTIOW I didn't use floats specifically, though in retrospect there was no good reason for me not to
<aeth> if you're *really* stubborn in a language like CL, you can just use rationals with your own (or a library's) implementations of SQRT, EXPT, SIN, COS, etc., that will approximate the inexact result to arbitrary rational precision (as much as you want, really)... it just won't be fast.
<aeth> (but still some finite precision, obviously)
<aeth> resttime: I think it's just because you're not used to writing optimized CL. It's simpler than you think because you'll learn what is and isn't worth the effort.
waleee has joined #commonlisp
<aeth> Although in a language with manifest typing (often confused with static typing, but *declaring* the type is the important part) and non-generic data structures, you basically always have to do things that you'd have to do in CL to take the fast path.
tyson2 has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
azimut has joined #commonlisp
thuna` has joined #commonlisp
_cymew_ has quit [Ping timeout: 268 seconds]
xlarsx has quit [Remote host closed the connection]
xlarsx has joined #commonlisp
<resttime> Yeah could be, which is what I'm hoping to figure out by writing the raytracer since performance now becomes a major factor
xlarsx has quit [Ping timeout: 265 seconds]
aartaka has joined #commonlisp
<resttime> There was a moment while writing the raytracer in Rust that my mind mapped it onto modern C++ concepts. Suddenly the language became familiar and I no longer had issues with the borrow checker
tyson2 has quit [Remote host closed the connection]
<aeth> if you're unfamiliar with CL, you can do things like (make-array 42 :element-type 'double-float :initial-element 0d0)
<aeth> or 'single-float
<jackdaniel> single-float has a better chance to be inlined when pulled from the array, because it is easier to encode it as an immediate type in 64bit
<jackdaniel> s/inlined/unboxed/
<aeth> (defun random-array (a) (declare (type (simple-array double-float (42)) a)) (loop :for i :from 0 :below 42 :do (setf (aref a i) (coerce (random 100) 'double-float))) a)
<aeth> (random-array (make-array 42 :element-type 'double-float :initial-element 0d0))
<aeth> is the sort of thing that you can do to float arrays, but you have to be careful with double-float because you could accidentally return a double-float, which has to box it
<aeth> which is why you should always explicitly return the array or NIL from these because things like (setf (aref a 21) 42d0) will not just SETF, it will also return 42d0, so if that's the last thing in the function, it will be implicitly returned
<aeth> if you can get away with using single-floats... there are many fewer issues
zyni-moe has joined #commonlisp
<aeth> but the rule of thumb for optimization is to use double-float or single-float or arrays of double-float or arrays of single-float, with single-floats being easier to work with because there's no boxing (type tagging that takes more than a 64-bit word to do), even for values not part of an array.
<aeth> and you can have a (simple-array single-float (*)) and it will still know that it's a single-float, it just will also have to bounds check because it doesn't know the length.
<White_Flame> or rather, the tagging is amortized to the array itself
<aeth> right, there's no mandatory way for an implementation to represent it, but in memory it's probably [tag | double | double | double | double | double | ... ] instead of each becoming their own [tag | double]
<aeth> and this is really the intuition you need when optimizing code that uses double-floats.
zyni-moe has quit [Client Quit]
<aeth> with single-floats you don't even have to worry about this (because the type tag fits with the float in 64 bits) so you only have to worry about making sure the compiler knows that it's single-float
<verisimilitude> Does the standard specifically tell us that SINGLE-FLOAT will be treated like FIXNUM, such as avoiding boxing, in any way?
aartaka has quit [Ping timeout: 265 seconds]
<aeth> In a ray tracer, you'll probably want your entry point to be (float-features:with-float-traps-masked t ...) so you can get NaNs and +/- inf (although there's no portable *printable* representation so they're still a bit odd) instead of having the additional overhead of potentially erroring. But if you can't place a bug, you can just remove that in your entry point and recompile and now you'll found out
<aeth> exactly what caused the inf/nan
<Bike> no. it facilitates it a bit with the eq definition, but that's it. it also doesn't say fixnum will be unboxed.
<jackdaniel> no, single float will be most likely boxed on 32bit architectures, and there is no guarantee that it will be an immediate type on 64bit
<jackdaniel> and also what Bike says
aartaka has joined #commonlisp
<aeth> (defun foo (x) (declare (type single-float x)) (/ 1f0 x)) (float-features:with-float-traps-masked t (foo 0f0)) => #| implementation specific printable representation of single-float +inf |#
<aeth> (note that actually doing it in one line might not behave like that because the compiler might be able to see it)
<aeth> but then you can just (foo 0f0) to get the error back
<aeth> (with no wrapping)
<aeth> Portability libraries are useful.
<verisimilitude> I meant FIXNUM exists for avoiding boxing, whereas SINGLE-FLOAT seems to have a different purpose.
<jackdaniel> fixnums could be explained from other angles too - i.e it is an integer type that has a fixed number of bits
<aeth> verisimilitude: single-float and short-float exist to potentially avoid boxing (and also to potentially save on space and improve speed and to interoperate with OS/etc. APIs, etc.)
<aeth> verisimilitude: it's just that with the added caveat that it needs to fit in the word.
<aeth> if you don't care about boxing and you're not working with the rest of the world, why not always long-float?
<aeth> even double-float might avoid boxing on a 128-bit (or 96-bit or whatever) architecture
<jackdaniel> most implementations does not exhibit long-float (ecl is a noble exception ;)
<Bike> doesn't clisp make long-float arbitrary precision or something?
<Bike> clearly we need an implementation brave enough to have computable reals as long floats
<aeth> jackdaniel: yes, but from the standards-first perspective, saying "I don't care about if it's boxed or slow" is to use long float, including by using long float literals like 1l0, 2.0l0, 4l-5 etc.
<aeth> Because you might accidentally have a fast, unboxed float with double-float
<jackdaniel> usually double float will be boxed though
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<aeth> verisimilitude: but, anyway, because "single-float" is fairly well-defined with its bounds (and is probably an IEEE single-precision float or a similar hardware-supported single-float on top of that), it can't *always* be unboxed, unlike fixnum, which could be almost anything (including really small... most-positive-fixnum is tiny) so it's probably unboxed.
<aeth> but in modern (64-bit) hardware single-float is unboxed and short-float is fairly useless and usually the same as single-float... short-float absolutely exists to avoid boxing no matter what, and unfortunately winds up being a bit *too* precise as specified in the standards to map to hardware 16-bit floats. You'd have to violate the standard.
<aeth> CLHS short-float is 13 bit minimum precision, 5 bit minimum exponent size; IEEE half-precision float is 1 sign bit, 5 bit exponent, 11 bit precision... which makes sense because half-float is for 16 bits while... short-float is... 18 bits? makes no sense except to avoid boxing on a 32-bit machine.
<aeth> it might be the only case in the standard where a minimum is too high instead of incredibly low
<pjb> I guess short-float was specified when the only implementation that had them was on a 36-bit word / 18-bit half-word machine.
<pjb> Therefore a WSCL could extend it to 11-bit mantissa.
<pjb> along with other IEEE stuff.
<aeth> yes, long-float is the only one that doesn't necessarily map to IEEE because there's... quite a few different ways to do it
<jackdaniel> since we talk about floats, I think that clisp has bigfloats (i.e floats that doesn't have fixed number of bits)
<aeth> long-float might be IEEE quadruple float (binary 128), x86 80-bit extended precision, CLISP-style arbitrary precision, or anything else.
<aeth> beyond doubles you'd probably want to introduce new types and just leave "long-float" to mean "the longest float"
<pjb> not exactly. You can set the number of bits in long-floats, so all long-floats produced have the same number of bits. But then, you can instantiate at different times, long-floats with different lengths…
<pjb> It's not "arbitrary" in that the results are always of the length specified, they don't depend on the arguments.
<pjb> (contrarily to integer).
xlarsx has joined #commonlisp
<aeth> a CL that wanted to support all hardware might have to find a way to switch between the two, but they're both very clearly short-float, and 16-bit at that
<aeth> although the IEEE one is much closer to what short-float is expected to be, so the other one might make sense as a separate type
<pjb> The main problem is that CLHS specifies that float is an exclusive disjunction of short-float, single-float, double-float and long-float.
<aeth> it's long-float where things get messy
<pjb> and that real is a disjunction of ratio and float.
<pjb> It'd be easier if extensions were allowed to define additionnal subtypes of float and real.
<pjb> Said otherwise, embrace the extension path. Don't bother too much with what clhs says about that, and define what is convenient to support what you want to support.
<aeth> makes sense that this is one of the places where the CLHS would have the most issues. Very hardware-driven.
xlarsx has quit [Ping timeout: 268 seconds]
<aeth> fortunately there's just: IEEE half-float (i.e.short-float), IEEE single-float, IEEE double-float, IEEE quadruple-float, and IEEE octuple-float. Then there might be an alternate hardware half-float and hardware extended-float (where extended-precision is between double and quadruple!)
<aeth> and decimal-float just has 32, 64, and 128 in IEEE and is probably best thought of as a different type entirely.
<pjb> ieee:half-float sounds like a good type. 1.2hf0 doesn't sound bad either.
<aeth> and the only real mess is long-float is really meant to mean "the longest float available", which could be arbitrary, octuple, quadruple, (non-IEEE) extended, or double
<pjb> And you always can do (float 1.2 ieee:half-float-zero) to write conforming code.
Guest29 has quit [Quit: WeeChat 3.6]
igemnace has quit [Quit: WeeChat 3.6]
justHaunted is now known as _justHaunted
_justHaunted is now known as justHaunted
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
xlarsx has joined #commonlisp
Colere has quit [Remote host closed the connection]
xlarsx has quit [Read error: Connection reset by peer]
Colere has joined #commonlisp
xlarsx has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
les has quit [Quit: Adios]
les has joined #commonlisp
tyson2 has joined #commonlisp
xlarsx has quit [Ping timeout: 265 seconds]
rgherdt_ has quit [Remote host closed the connection]
akoana has joined #commonlisp
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
xlarsx has joined #commonlisp
jmdaemon has joined #commonlisp
xlarsx has quit [Ping timeout: 265 seconds]
<aeth> pjb: probably best just to use "i" instead of something else
<aeth> 1.2hf0 vs 1.2hi0
<aeth> since 'f' is single-float, not 's' (which is short float)
<aeth> that way you avoid e.g. 1ff0 or 1sf0
<aeth> "i" for IEEE
<aeth> and then you probably wind up with hi <=> s, fi <=> f, di <=> d. Then qi or even oi might be l. Or something else.
fourier has joined #commonlisp
<pjb> possibly. And that would extend nicely with decimal floats we discussed the other day.
<aeth> then the only issue is representing (probably x86) extended float as well as the alternate half float... and that's it for anything that hardware is probably going to represent
shka has quit [Ping timeout: 246 seconds]
tevo has quit [Ping timeout: 252 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hirez- has quit [Read error: Connection reset by peer]
hirez has joined #commonlisp
xlarsx has joined #commonlisp
thuna` has quit [Remote host closed the connection]
cognemo has quit [Ping timeout: 268 seconds]
xlarsx has quit [Ping timeout: 268 seconds]
random-nick has quit [Ping timeout: 264 seconds]
xlarsx has joined #commonlisp
xlarsx has quit [Ping timeout: 260 seconds]
drbluefall has joined #commonlisp
son0p has quit [Ping timeout: 268 seconds]