beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
aelius has joined #picolisp
beneroth has quit [Read error: Connection reset by peer]
z4k4ri4 has quit [Ping timeout: 276 seconds]
z4k4ri4 has joined #picolisp
rob_w has joined #picolisp
<tankf33der> morning all
<tankf33der> abu[7]: i am using log function from math.l first time
<abu[7]> Hi tankf33der
<tankf33der> is it works only on scl 6 ?
<abu[7]> Any scale up to about 15 is OK (more is not supported by double float)
<tankf33der> Then I will be restoring scl for this and then raising it back. I need a very large scl
<tankf33der> fast Newton-Raphson long division
<abu[7]> I see
<abu[7]> As ever, the scale must be set before @lib/math.l is loaded
<tankf33der> Maybe I should implement my own code because of this to bypass this limitation
<abu[7]> Which limitation do you mean?
<tankf33der> i need log call in the middle of bigger function
<abu[7]> (scl 16 (load "@lib/math.l"))
<abu[7]> Then just call as usual
<tankf33der> sure. i thought this ugly. anyway thanks.
<abu[7]> ok
<tankf33der> I understood why I wanted to make my own wrapper. I need log3 anyway.
<abu[7]> and log2
<abu[7]> a division
<abu[7]> "log" is base e
<abu[7]> of logs of the bases
<abu[7]> e.g. log(99) / log(2)
<tankf33der> yeap.
<abu[7]> So a wrapper with direct native calls is good
<tankf33der> ok. i will show you code later before tests.
<abu[7]> Good
<tankf33der> afk
<tankf33der> abu[7]: me again
<tankf33der> is it true that i can set scl only once?
<abu[7]> No, you can sat any time as often ass you want
<abu[7]> Just math.l has read macros which depend on *Scl
<tankf33der> let me show you simple code.
<tankf33der> creating paste
<tankf33der> as i can see (scl 10) is not set
<tankf33der> what did i miss
<tankf33der> ?
<abu[7]> I said you need to set *Scl before (load "@lib/math.l")
<abu[7]> see the first line in math.l
<tankf33der> ah, before. ok then
<abu[7]> *Scl is only I/O
<abu[7]> (println *Scl 1.0) doen not work
<abu[7]> 1.0 is expanded at read time
<tankf33der> i forgot this - read time.
<abu[7]> ☺
<abu[7]> *Scl is only for I/O of "."
<abu[7]> It is not really needed
<tankf33der> abu[7]: http://pb1n.de/?7804c3
<tankf33der> I came up with this approach
<tankf33der> is this ok? :/
<abu[7]> No
<abu[7]> You don't need *Scl at all in the first expr
<abu[7]> (let ..
<abu[7]> What exactly is the goal?
<abu[7]> I would not fiddle so much with *Scl
<abu[7]> call 'scl' before you read a module, to have 1.0 expanded
<abu[7]> may be different for different modules
<tankf33der> whole programm run inside scl 100 or bigger, but mike should run inside scl 10
<abu[7]> Good
<abu[7]> But *run* does not really care about *Scl
<abu[7]> just I/O
<abu[7]> and output is done with 'format'
<abu[7]> which also does not need *Scl
<tankf33der> i thought i would save scl inside mike and return in exit
<abu[7]> 'scl' saves by itself
<tankf33der> hm
<abu[7]> (scl 100 (load "xxx.l"))
<abu[7]> (scl 100 (load "xxx.l"))
<abu[7]> (scl 10 (load "yyy.l"))
<abu[7]> I think there is no need to fiddle with *Scl
<tankf33der> and then i can call (mike) from yyy.l and will be scl 10?
<abu[7]> Runtime does not need scale
<abu[7]> only I0
<abu[7]> if mike reads
<abu[7]> output is format
<abu[7]> 'format'
<abu[7]> If you read data ouside "xxx.l", you can do (scl 100 (my-reading-data))
<abu[7]> if the data contain "."
<tankf33der> no reading then. only calculations
<abu[7]> so no *Scl needed at all
<abu[7]> (scl 100) (load "@lib/math.l") (de mike ...
<abu[7]> In other source files you may use 10
<abu[7]> no problem
<abu[7]> It is all only about reading 1.0 -> 10000000000
<abu[7]> or other constants like PI
<tankf33der> but this is ok, right? (* 4 (** 10 *Scl)) ?
<abu[7]> Yes, but it is unnecessary runtime overhead
<tankf33der> i knew it
<abu[7]> and it doen not need *Scl
<abu[7]> you can use a normal local variable
<abu[7]> or constant
<tankf33der> ok
<abu[7]> Can you show the structure of your modules
<abu[7]> ?
<abu[7]> ako skeleton
<abu[7]> where is scale 100 and where 10
beneroth has joined #picolisp
<tankf33der> there is skeleton only. this working code will be (newton) function and i stuck with (mike) function. inside (newton) scl will depend on input number
<tankf33der> typing...
<tankf33der> on bigger input value N and D for division scl will be dynamic -> (scl (bytes N))
<abu[7]> ok, but this does not switch *Scl, right?
<abu[7]> btw, 'round' behaves dynamically depending on *Scl
<tankf33der> like this ^^^
<abu[7]> and 'mike' does I/O depending on *Scl?
<abu[7]> otherwise setting it at runtime is not needed
<tankf33der> no, just log3 of P/log2(99)
<abu[7]> I think I never called 'scl' *inside* a function
<tankf33der> in first file if i set scl 20 division will be wrong.
<abu[7]> I you only calculate, *Scl has no effect
<tankf33der> ok
<abu[7]> (%@ "log" 1.0 "Dbl1") is (%@ "log" 10000000 "Dbl1")
<abu[7]> expanded at read time
<tankf33der> this one i understand.
<abu[7]> yeah
<abu[7]> log works only up to 15 anyway
<abu[7]> float hardware
<tankf33der> yea
<tankf33der> thats why i need lower scl inside mike
<abu[7]> I see
<abu[7]> anyway, just call (scl 100) in one place and (scl 10) in another
<abu[7]> but you need to div or mul values if you communicate values between the modules
<tankf33der> ok. i will try asap.
<abu[7]> I'm away for one or two hours
<tankf33der> good. no hurry.
<abu[7]> :)
rob_w has quit [Remote host closed the connection]
soweli_iki has quit [Remote host closed the connection]
corecheckno has joined #picolisp
soweli_iki has joined #picolisp