the function dec2bin () - Messages
20221227 Dec2bin.sm (4 KiB) downloaded 59 time(s).
Also needed:
* set string length (ie leading zeros), and
* functions for bit field testing.
algo(col) was designed to recover matrix col(s) string(s) to values.
Cheers ... Jean.
Maths Convert-dec2bin.sm (18 KiB) downloaded 63 time(s).
Interesting, thanks Jean.
Do you know a way to implement a fixed 9-bit binary counter in SMath (or display a decimal counter in fixed-length binary)? This is probably a bit too esoteric to be a feature request...
WroteThe source was repurposed from Razonar.
Interesting, thanks Jean.
Do you know a way to implement a fixed 9-bit binary counter in SMath (or display a decimal counter in fixed-length binary)? This is probably a bit too esoteric to be a feature request...
Sorry Collab: I have no idea yet how to counts pulse.
From recollection, such demand was not honored.
Cheers ... Jean.
You want a 9bit binary representation similar to 8084 cpu registers.
I must admit it is a highly specific request.
I should have been more clear in my request.
I'm after a 9-bit long bit-field count that I can test each bit (ie each bit has a 2^n position in the whole count) so that as the count progresses. This way each of the 9 tests will have been performed half the tests in the 0 branch and half in the 1 branch.
If it is 0 then do x, otherwise do y type of thing.
The application is worst-case circuit analysis: https://k6jca.blogspot.com/2012/07/monte-carlo-and-worst-case-circuit.html
Half the tests with the +% tolerance applied the other half with the -ve tolerance applied.
WroteIf I understood correctly;
You want a 9bit binary representation similar to 8084 cpu registers.
I must admit it is a highly specific request.
Very close, thanks overloard.
I'm after an asynchronous 9-bit ripple-style counter that I can bit-test (or equivalent) 9 times during each loop, each time to do one of two actions half the time (ie calculated with each extreme of the tolerance) for worst-case circuit analysis.
This may be better achieved via dec2bin() with a constant 9-bit length output so that the 2^n check work consistently (ie string position tests).
FYI (reference only): https://k6jca.blogspot.com/2012/07/monte-carlo-and-worst-case-circuit.html. The need is for X-Y style visualization that LTSpice can't provide.
Wrote...
This may be better achieved via dec2bin() with a constant 9-bit length output so that the 2^n check work consistently (ie string position tests).
...
Hi. Something like this?
bin_counter.sm (9 KiB) downloaded 55 time(s).
Best regards.
Alvaro.
dec2bin(p,q) where p is the bit-field length and q is the decimal number to be converted.
Check the converted string's length and then pad the front with zeros to suit.
WroteWrote...
This may be better achieved via dec2bin() with a constant 9-bit length output so that the 2^n check work consistently (ie string position tests).
...
Hi. Something like this?
bin_counter.sm (9 KiB) downloaded 55 time(s).
Best regards.
Alvaro.
Cripes Alvaro. Good to see your 'calibrated-crystal-ball' and 'mind-reading skills' are as good as your awesome maths/coding skills!
WroteMaybe this can be useful.
Regards
dec2bin.sm (3 KiB) downloaded 52 time(s).
Perfect! Thank you overlord
A much better idea is a column vector with each of the 9 (ie n#) elements being either a one or a zero.
WroteA much better idea is a column vector
This was what I coded first, after that I made it to string.
Here is what you have asked for.
Regards
dec2bin.sm (6 KiB) downloaded 57 time(s).
WroteI spoke too soon! Bit-testing don't work so well on a string.
A much better idea is a column vector with each of the 9 (ie n#) elements being either a one or a zero.
Maybe, that's what you are looking for ?
Maths Convert num2str EXTENDED.sm (6 KiB) downloaded 60 time(s).
-
New Posts
-
No New Posts