search for: obase

Displaying 18 results from an estimated 18 matches for "obase".

Did you mean: base
2015 Aug 31
2
[OT] GNU bc base conversion
On Aug 31, 2015, at 10:05 AM, Mike - st257 <silvertip257 at gmail.com> wrote: > > On Mon, Aug 31, 2015 at 11:15 AM, Warren Young <wyml at etr-usa.com> wrote: > >> ibase=A and obase=A > > Not sure how this helps me with my most recent example of bin_to_hex where > the ibase within the define clause wasn't honored. That?s because your bin_to_hex function is erroneously assuming that its input is just a string of digits that has no base interpretation, so that it...
2015 Aug 31
0
[OT] GNU bc base conversion
...ug 31, 2015 at 1:06 PM, Warren Young <wyml at etr-usa.com> wrote: > On Aug 31, 2015, at 10:05 AM, Mike - st257 <silvertip257 at gmail.com> wrote: > > > > On Mon, Aug 31, 2015 at 11:15 AM, Warren Young <wyml at etr-usa.com> wrote: > > > >> ibase=A and obase=A > > > > Not sure how this helps me with my most recent example of bin_to_hex > where > > the ibase within the define clause wasn't honored. > > That?s because your bin_to_hex function is erroneously assuming that its > input is just a string of digits that has no...
2015 Aug 28
2
[OT] GNU bc base conversion
...forth. No doubt the syntax is in some way wrong, but when I test from the CLI and the right values are returned, I have to wonder. Other than a few other define statements, the only other option I have set is scale=5 in my bcrc. In reference to the order of (o|i)base parameters, I have specified obase before ibase [0]. [0] http://docstore.mik.ua/orelly/unix/upt/ch49_03.htm See below for my examples. Thanks! ]$ echo "bin_to_dec(1001)" | bc 1001 # should be decimal 9 ]$ echo "obase=10; ibase=2; 1001" | bc 9 ]$ grep bin_to_dec ~/.bcrc define bin_to_dec(b) { obase=10; ibase...
2015 Aug 31
2
[OT] GNU bc base conversion
...Aug 31, 2015, at 6:55 AM, Mike - st257 <silvertip257 at gmail.com> wrote: > > I suppose my only options for this are to use shell functions or write a > script using a language that handles things properly (sanely?). No, there?s a fairly common hack around this problem: ibase=A and obase=A *always* means ?base 10? regardless of the current base, due to a quirk in the way values for these settings are interpreted. Thus you can always force your way back to sanity. My objection is that this is even necessary in the first place.
2015 Aug 28
3
[OT] GNU bc base conversion
On Aug 28, 2015, at 9:50 AM, Gordon Messmer <gordon.messmer at gmail.com> wrote: > > On 08/28/2015 07:15 AM, Mike - st257 wrote: >> Thoughts as to why my BC functions aren't properly converting between bases? >> >> Decimal to binary or hex works fine, but not binary or hex to decimal and >> so forth. > > I'm not an expert in bc, so I might be
2015 Aug 31
0
[OT] GNU bc base conversion
...ion is simply too late. ibase affects how bc > interprets input. > Thanks Gordon. Big bummer given that behavior. :-/ I had (and did test) definitions for other conversions (though I didn't post them), but this one also drives it home. ~]$ grep bin_to_hex ~/.bcrc define bin_to_hex(b) { obase=16; ibase=2; return b; } ~]$ echo "bin_to_hex(10101011)" | bc 9A2113 # so we're sending in a string with implied base10 ... sure enough matches what BC errantly decided to do ~]$ echo "obase=16; 10101011" | bc 9A2113 ~]$ echo "obase=16; ibase=2; 10101011" | bc AB...
2005 Jan 12
4
hashing filters
...add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.0/16 hashkey mask 0x000000ff at 12 link 2: tc class add dev eth0 parent 1:2 classid 1:3 htb rate 128Kbit ceil 128Kbit j=0; while [ $j -le 254 ] do i=0; while [ $i -le 254 ] do hexi=`echo "obase=16; $i" | bc` tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi: match ip dst 192.168.$j.$i flowid 1:3 i=$((i+1)) done j=$((j+1)) done somewhere at 192.168.8.7/32 it appears on the screen this message RTNETLINK answers: File exists We have...
2012 Feb 17
3
Regain play analysis patches
...mples > > To generate raw unsigned samples using bc(1) for example: > > samplerate = 1000; > duration = 2; > bitspersample = 24; > > samplerange = 2 ^ (bitspersample-1) - 1; > samplemidpoint = 2 ^ (bitspersample-1); > > pi = 4 * a(1); > > scale = 18; > obase = 16; > > for (ix = 0; ix < duration * samplerate; ++ix) { > ? sample = samplemidpoint + samplerange * s(2 * pi * ix / samplerate); > ? s = scale; > ? scale = 0; > ? sample /= 1; > ? sample; > ? scale = s; > } > > > > Are you ok with bc(1) ? Yes, bc lo...
2015 Aug 31
1
[OT] GNU bc base conversion
...or. :-/ I suppose that depends on what you're trying to accomplish. Most conversions you can do entirely within bash, if that's your goal. function dec_to_hex () { printf '%x\n' $1; } function hex_to_dec() { printf '%d\n' $(( 16#$1 )); } function hex_to_bin() { echo 'obase=2;' $(( 16#$1 )) | bc; } $ dec_to_hex 10 a $ hex_to_dec a 10 $ hex_to_bin a 1010
2007 Jul 06
1
ferret (0.11.4-mswin32) w/ acts as ferret
i''m indexing a table from some legacy db via a nightly executed script/runner command (LegacyInfobase.rebuild_index). but very often newer documents don''t show up in search results for quite some days. when running it manually from console for diagnosis it mostly stops with this error (but not always): [This was fast-saved 1 times. Some information is lost] IOError: IO Error occured: c...
2005 Nov 10
1
R-help: conversion of long decimal numbers into hexadecimal
Hi there, could somebody help me to convert a decimal number into a hexadecimal number? I know that there is the function "sprintf", but the numbers I want to convert consist of 20 or more numbers. "Spintf" is not able to convert these big numbers. Thanks for any help. Antje [[alternative HTML version deleted]]
2012 Feb 15
4
Regain play analysis patches
Brian Willoughby wrote: > What about using the C library sin() and cos() functions to generate > the test audio instead of sox? I did not see a description of how > the test files are generated, so maybe this is easy or maybe it is > hard. The benefit of shipping the test audio generation source code > around with the FLAC sources is that the tests won't break when
2015 Aug 28
0
[OT] GNU bc base conversion
...s simply too late. ibase affects how bc interprets input. So "echo "bin_to_dec(1001)" | bc" is going to interpret the value of 1001 while reading it from input, not after passing it to a function where ibase is reset. Supporting that theory: $ bc ... define bin_to_dec(b) { obase=10; ibase=2; return b; } bin_to_dec(1001) 1001 Decimal to binary and hex work correctly because decimal input is the default. Since ibase is already 10, those values are interpreted the way you want, but not because you're setting ibase in your function.
2015 Aug 31
0
[OT] GNU bc base conversion
...M, Mike - st257 <silvertip257 at gmail.com> wrote: > > > > I suppose my only options for this are to use shell functions or write a > > script using a language that handles things properly (sanely?). > > No, there?s a fairly common hack around this problem: ibase=A and obase=A > *always* means ?base 10? regardless of the current base, due to a quirk in > the way values for these settings are interpreted. Thus you can always > force your way back to sanity. > Not sure how this helps me with my most recent example of bin_to_hex where the ibase within the de...
2012 Feb 17
0
Regain play analysis patches
...bc(1) to compute the raw samples 2. Use perl(1) to compute the raw samples To generate raw unsigned samples using bc(1) for example: samplerate = 1000; duration = 2; bitspersample = 24; samplerange = 2 ^ (bitspersample-1) - 1; samplemidpoint = 2 ^ (bitspersample-1); pi = 4 * a(1); scale = 18; obase = 16; for (ix = 0; ix < duration * samplerate; ++ix) { ? sample = samplemidpoint + samplerange * s(2 * pi * ix / samplerate); ? s = scale; ? scale = 0; ? sample /= 1; ? sample; ? scale = s; } Are you ok with bc(1) ??? Or would you prefer perl(1) ??? Or something else ? Earl ----- Origina...
2012 Feb 20
0
Regain play analysis patches
...mples > > To generate raw unsigned samples using bc(1) for example: > > samplerate = 1000; > duration = 2; > bitspersample = 24; > > samplerange = 2 ^ (bitspersample-1) - 1; > samplemidpoint = 2 ^ (bitspersample-1); > > pi = 4 * a(1); > > scale = 18; > obase = 16; > > for (ix = 0; ix < duration * samplerate; ++ix) { > ? sample = samplemidpoint + samplerange * s(2 * pi * ix / samplerate); > ? s = scale; > ? scale = 0; > ? sample /= 1; > ? sample; > ? scale = s; > } > > > > Are you ok with bc(1) ? Yes, bc lo...
2011 Mar 30
1
1.2 problem 'dovecot -n' vs dovecot.conf
To elaborate, if there is a database associated with this setup it is really fubar. note: tail of dovecot -n lda: postmaster_address: postmaster mail_plugins: sieve quota_full_tempfail: yes deliver_log_format: msgid=%m: %$ rejection_reason: Your message to <%t> was automatically rejected:%n%r auth default: mechanisms: plain login passdb: driver: pam userdb: driver:
2009 May 06
2
convert large integers to hex
Hi, I'm wondering if someone has solved the problem of converting very large integers to hex. I know about format.hexmode and as.hexmode, but these rely on integers. The numbers I'm working with are overflowing and losing precision. Here's an example: x <- "6595137340052185552" # stored as character as.integer(x) # warning about inaccurate conversion