00:34
TCZ has quit [Quit: Leaving]
01:26
reepca has quit [Read error: Connection reset by peer]
01:26
reepca has joined #forth
01:28
boru` has joined #forth
01:28
boru has quit [Disconnected by services]
01:28
boru` is now known as boru
02:12
<
MrMobius >
quiet in here again
02:12
<
MrMobius >
ive been watching the svfig videos
02:13
<
MrMobius >
theres some pretty good stuff on there
02:23
WickedShell has quit [Remote host closed the connection]
03:09
<
MrMobius >
whats up tabemann
03:09
<
crc >
I'm sure the channel will get active again...
03:10
<
tabemann >
not a whole lot
03:10
<
tabemann >
just wondering how I can convert some C code that I was given into Forth
03:10
<
tabemann >
for implementing log2
03:11
<
tabemann >
it's supposed to be faster than how I'm currently implementing ln (and ln can be implemented with log2), but I can't say I really understand the code
03:15
<
MrMobius >
is it cordic by chance?
03:15
<
MrMobius >
converting is hard without really understanding everything it's doing
03:16
<
MrMobius >
I think you need an extra division and multiply to convert logs iirc
03:19
<
tabemann >
the method I'm using isn't CORDIC
03:20
<
tabemann >
the thing is that it involves calculating e^x at each step, which is apparently expensive
03:26
<
MrMobius >
how are you dong e^x then if not cordic?
03:26
<
MrMobius >
taylor expansion or something?
03:38
<
tabemann >
I honestly don't remember which algorithm I am using, because this is based on older code I wrote for a different Forth implementation
03:38
<
tabemann >
I'd have to look up the expansions, but I wouldn't be suprised if it were Taylor or Maclaurin
04:24
Keshl has quit [Read error: Connection reset by peer]
04:25
Keshl has joined #forth
04:31
Keshl has quit [Read error: Connection reset by peer]
04:32
Keshl has joined #forth
05:00
gravicappa has joined #forth
05:00
<
KipIngram >
What are we computing?
05:00
<
KipIngram >
Sorry - coming in late here.
05:01
<
KipIngram >
Ah - log2?
05:28
reepca has quit [Ping timeout: 256 seconds]
05:49
rdrop-exit has joined #forth
05:51
Lord_Nightmare has joined #forth
05:56
<
rdrop-exit >
log2 Floor of binary logarithm.
*** N.B. log2 of 0 is -1.
***
05:57
<
rdrop-exit >
clog2 Ceiling of binary logarithm.
*** N.B. clog2 of 0 is 0.
***
05:57
<
rdrop-exit >
: log2 ( u -- n ) #lead-0s 63 \- ;inline
05:57
<
rdrop-exit >
: clog2 ( u -- u' ) dup 0<> + #lead-0s 64 \- ;inline
05:57
<
rdrop-exit >
(assuming 64-bit Forth)
06:25
rdrop-exit has quit [Quit: Lost terminal]
06:44
xek_ has joined #forth
07:28
gravicappa has quit [Ping timeout: 272 seconds]
07:38
xek_ has quit [Ping timeout: 272 seconds]
07:59
gravicappa has joined #forth
08:09
gravicappa has quit [Ping timeout: 256 seconds]
08:22
dys has joined #forth
09:11
proteusguy has quit [Ping timeout: 256 seconds]
09:24
proteusguy has joined #forth
09:40
xek has joined #forth
10:03
reepca has joined #forth
10:05
xek has quit [Ping timeout: 272 seconds]
10:18
reepca has quit [Ping timeout: 258 seconds]
10:23
reepca has joined #forth
10:27
reepca has quit [Read error: Connection reset by peer]
10:45
xek has joined #forth
10:49
TCZ has joined #forth
11:08
gravicappa has joined #forth
11:25
<
KipIngram >
Why do we go to the trouble to handle zero at all? Logarithms of zero aren't defined.
11:38
dave0 has quit [Quit: dave's not here]
12:14
xek has quit [Ping timeout: 272 seconds]
12:23
TCZ has quit [Quit: Leaving]
13:13
Zarutian_HTC has quit [Ping timeout: 258 seconds]
13:17
xek has joined #forth
13:23
TCZ has joined #forth
13:44
rdrop-exit has joined #forth
13:46
<
rdrop-exit >
It's just in certain cases
13:47
<
rdrop-exit >
it's just convenient in certain cases
13:48
<
rdrop-exit >
you can save one Forth instruction on clog2 if you prefer to ignore it
13:48
<
rdrop-exit >
it makes no difference in the floored log2
13:56
<
rdrop-exit >
Here's a version of ceiling log2 without the artificial value at 0:
13:56
<
rdrop-exit >
: clog2 ( u -- u' ) #lead-0s 65 \- ;inline
13:57
<
rdrop-exit >
oops that's totally wrong
13:59
<
rdrop-exit >
better stick with the original:
13:59
<
rdrop-exit >
: clog2 ( u -- u' ) dup 0<> + #lead-0s 64 \- ;inline
14:02
<
rdrop-exit >
feel free to ignore the pseudo values at 0 if you have no use for them
14:03
TCZ has quit [Quit: Leaving]
14:03
<
rdrop-exit >
The floored version is also fine as it is:
14:03
<
rdrop-exit >
: log2 ( u -- n ) #lead-0s 63 \- ;inline
14:07
<
rdrop-exit >
2 2** Raise 2 to a power.
14:07
<
rdrop-exit >
4 pwr2 Floor power of 2, round down to closest power of 2
14:07
<
rdrop-exit >
5 <= <u>.
14:07
<
rdrop-exit >
7 cpwr2 Ceiling power of 2, round up to the closest power of 2
14:07
<
rdrop-exit >
8 >= <u>.
14:08
<
rdrop-exit >
0 source Arithmetic - Powers of 2
14:08
<
rdrop-exit >
2 : 2** ( 0..3f -- 1<<0..3f ) 1 swap lshift ;inline
14:08
<
rdrop-exit >
4 : pwr2 ( u -- u' ) log2 2** ;inline
14:08
<
rdrop-exit >
6 : cpwr2 ( u -- u' ) clog2 2** ;inline
14:08
<
rdrop-exit >
c addressing Number of address bits needed to address a memory of
14:08
<
rdrop-exit >
d size <u>.
14:09
<
rdrop-exit >
c : addressing ( u -- #bits ) clog2 ;inline
14:15
<
rdrop-exit >
#bits Number of significant bits of <u>.
14:15
<
rdrop-exit >
: #bits ( u -- # ) log2 0 max 1+ ;inline
14:15
<
rdrop-exit >
#bytes Number of significant bytes of <u>, i.e. radix 256.
14:15
<
rdrop-exit >
: #bytes ( u -- # ) log2 0 max 3 rshift 1+ ;inline
14:25
<
rdrop-exit >
#decimals Number of significant decimal digits of <u>.
14:26
<
rdrop-exit >
: #decimals ( u -- # ) lg 0 max 1+ ;inline
14:27
<
rdrop-exit >
The definition of #decimals above makes the same assumption about the common logarithm being "pseudo" defined as -1 at zero
14:36
<
rdrop-exit >
good night Forthwrights
14:36
rdrop-exit has quit [Quit: Lost terminal]
15:36
Zarutian_HTC has joined #forth
15:57
gravicappa has quit [Ping timeout: 240 seconds]
16:15
proteus-guy has joined #forth
16:48
ovf has quit [Disconnected by services]
16:49
ovf_ has joined #forth
16:55
Blue_flame has quit [*.net *.split]
16:55
jimt[m] has quit [*.net *.split]
16:56
dys has quit [Ping timeout: 244 seconds]
16:56
siraben has quit [Write error: Connection reset by peer]
17:00
siraben has joined #forth
17:08
jimt[m] has joined #forth
17:08
Blue_flame has joined #forth
18:54
TCZ has joined #forth
18:57
xek has quit [Ping timeout: 246 seconds]
19:02
gravicappa has joined #forth
19:18
Zarutian_HTC has quit [Ping timeout: 256 seconds]
20:07
xek has joined #forth
20:33
dave0 has joined #forth
20:36
xek has quit [Ping timeout: 246 seconds]
20:46
X-Scale` has joined #forth
20:47
X-Scale has quit [Ping timeout: 264 seconds]
20:47
X-Scale` is now known as X-Scale
21:25
TCZ has quit [Quit: Leaving]
21:27
gravicappa has quit [Ping timeout: 246 seconds]
21:51
X-Scale` has joined #forth
21:52
X-Scale has quit [Ping timeout: 246 seconds]
21:52
X-Scale` is now known as X-Scale
22:03
lchvdlch has joined #forth
22:04
lchvdlch has left #forth [#forth]
22:37
clog has quit [Ping timeout: 260 seconds]
22:50
WickedShell has joined #forth
23:02
Zarutian_HTC has joined #forth
23:42
TCZ has joined #forth