Search
Sunday, 6th of October 2019, 17:09:29 UTC
17:18:39
|3b|
is there any useful equivalent of modular arithmetic for things like (truncate double-float)?
17:19:05
stassats
|3b|: just declare the type?
17:19:42
|3b|
i mean where (ldb (byte 64 0) (truncate df)) would be faster, and give defined results
17:20:48
|3b|
ACTION is talking about a hypothetical alternative to the safety 0 stuff above
17:22:04
|3b|
no idea there is any way to truncate a double faster even if you know you only want the low N bits of result though
17:26:44
pkhuong
|3b|: regular hardware conversion
17:29:40
|3b|
yeah, looks like probably get some other value from hardware
17:32:50
stassats
you can compare and cut the exponent
17:33:12
stassats
after 53 it's just some set bits shifted left
17:33:27
pkhuong
better than consing a bignum I guess
17:33:49
stassats
not only consing a bignum, but running bignum-to-float
17:35:08
stassats
or wait, shouldn't it just shift too?
17:35:34
pkhuong
i hope that's what it does...
17:35:59
stassats
so it's just a question of inlining
17:36:30
pkhuong
will modarith do the right needed with the variable shift?
17:43:59
stassats
nope, it works with variable shifts, but not arbitrary
17:46:54
stassats
integer-decode-float is also clunky
17:48:21
stassats
but let's pivot to making (declare (fixnum x n)) (ldb (byte 16 0) (ash x n)) work
17:52:36
stassats
i need to untangle my understanding of the modarith before i make it even more of a mess
17:53:07
stassats
like, what's the deal with ash-left-mod64 being transformed to (%primitive fast-ash-left-mod64/unsigned=>unsigned integer count)?
17:53:31
stassats
is the problem that we can't restrict a vop on (unsigned-byte 6) because it's not a primitive type?
17:55:38
stassats
(just added a new primitive type today, INTEGER, wonder what are the broader consequences and wouldn't it be better to operate on types)
17:55:54
stassats
there's already tn-ref-type, but of limited use
17:56:23
stassats
not to consolidate all the distinct hacks into something more generic and sensible
21:24:44
stassats
managed to do (declare (fixnum x) ((and unsigned-byte fixnum) n)) (ldb (byte 16 0) (ash x n))
21:32:16
stassats
have to define a new set of vops, so tedious
21:34:25
stassats
ok, i won't, don't want to roll them back either to the left/right variants
21:35:09
stassats
the explosion of modular vops is bothersome
21:35:53
stassats
is it all just to change their type derivers? could lvar-attached type derivers help here?
21:37:09
stassats
that's beyond the scope of today, but i really should investigate lvar-centered optimizations, it might solve a lot of problems
Monday, 7th of October 2019, 5:09:29 UTC