Sponsored Content
Full Discussion: taking the Log2 values
Top Forums Shell Programming and Scripting taking the Log2 values Post 302340970 by KenJackson on Tuesday 4th of August 2009 08:31:27 PM
Old 08-04-2009
I don't know awk, but if you can take a log, you can take a base 2 log.

Given that you know X and you want to know log2 X:
Code:
log2 X = Y
2 ** (log2 X) = X = 2 ** Y
log X = Y log 2
Y = log X / log 2

Or roughly

log2 X = 3.322 log X

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Converting Binary decimal coded values to Ascii Values

Hi All, Is there any command which can convert binary decimal coded values to ascii values... i have bcd values like below оооооооооооо0о-- -v - Pls suggest a way to convert this. Thanks, Deepti.Gaur (3 Replies)
Discussion started by: gaur.deepti
3 Replies

2. UNIX for Dummies Questions & Answers

Please help me in taking the values from a file

i have a script, whcih takes values from a file and assign it to one variable. this text value contains name of few object. value contains line by lie. i.e. one after another. when i am assaign the value of this text file to a variable, it accept the value as one liner instead of one by one.... (3 Replies)
Discussion started by: jin
3 Replies

3. Shell Programming and Scripting

How to pick values from column based on key values by usin AWK

Dear Guyz:) I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z). I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Discussion started by: repinementer
16 Replies

4. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

5. Shell Programming and Scripting

Taking sum up all values inside the file

Hi, Taking sum up all values inside the file by using the below command: paste -sd+ filenmae | bc Getting some error like "0705-001: building space exceeded on line1 stdin" The original data looks like SPACE SPACE SPACE 0.123 JOBNAME1 SPACE SPACE 20.325 JOBNAME2 SPACE SPACE... (2 Replies)
Discussion started by: NareshN
2 Replies

6. Shell Programming and Scripting

Converting odd values to even values(or vice-versa) located in a column

Hello All, I have a below data in a .csv file where all rows where col1 is A, col2 is odd numbers, similarly even numbers for all rows where col1 is B. Note that my data has some other columns(not shown here) too (around 100) after col2. Tool,Data A,1 A,3 A,5 .... so on B,2 B,4 .... ... (4 Replies)
Discussion started by: ks_reddy
4 Replies

7. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

8. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

9. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies

10. Shell Programming and Scripting

Taking key values from one file and extracting values from another file

Hi, I have two files with values in both. File1: cat 2 3 dog 4 5 elephant 6 7 camel 2 3 File2: ----+--gkf;ajf= ---+---- +----- cat -------=----+ 3 | 4 ----- dog ------++-- 5 | 9 ----++-- elephant | 5 | 7 ---++ camel ------ ++++_---- || 8 | 9 I want the final file as: cat 4... (1 Reply)
Discussion started by: npatwardhan
1 Replies
LOG(3)							   BSD Library Functions Manual 						    LOG(3)

NAME
log, log2, log10, log1p, -- logarithm functions SYNOPSIS
#include <math.h> double log(double x); long double logl(long double x); float logf(float x); double log2(double x); long double log2l(long double x); float log2f(float x); double log10(double x); long double log10l(long double x); float log10f(float x); double log1p(double x); long double log1pl(long double x); float log1pf(float x); DESCRIPTION
The log() function computes the value of the natural logarithm of argument x. The log2() function computes the value of the logarithm of argument x to base 2. The log10() function computes the value of the logarithm of argument x to base 10. If x is nearly zero, then the common expression log(1 + x) will not be able to produce accurate results, as most (or all) of the information in x will be lost by addition. Instead, use log1p(x) to perform the same computation without undue loss of accuracy. If you find yourself using this function, you are likely to also be interested in the expm1() function. SPECIAL VALUES
log(+-0), log2(+-0), and log10(+-0) return -infinity and raise the "divide-by-zero" floating-point exception. log(1), log2(1), and log10(1) return +0. log(x), log2(x), and log10(x) return a NaN and raise the "invalid" floating-point exception for x < 0. log(+infinity), log2(+infinity), and log10(+infinity) return +infinity. log1p(+-0) returns +-0. log1p(-1) returns -infinity and raises the "divide-by-zero" floating-point exception. log1p(x) returns a NaN and raises the "invalid" floating-point exception for x < -1. log1p(+infinity) returns +infinity. VECTOR OPERATIONS
If you need to apply the log() functions to SIMD vectors or arrays, using the following functions provided by the Accelerate.framework may give significantly better performance: #include <Accelerate/Accelerate.h> vFloat vlogf(vFloat x); vFloat vlog1pf(vFloat x); vFloat vlog10f(vFloat x); void vvlogf(float *y, const float *x, const int *n); void vvlog(double *y, const double *x, const int *n); void vvlog1pf(float *y, const float *x, const int *n); void vvlog1p(double *y, const double *x, const int *n); void vvlog10f(float *y, const float *x, const int *n); void vvlog10(double *y, const double *x, const int *n); void vvlog2f(float *y, const float *x, const int *n); void vvlog2(double *y, const double *x, const int *n); SEE ALSO
exp(3), pow(3), math(3) STANDARDS
The log(), log2(), log10,() and log1p() functions conform to ISO/IEC 9899:2011. 4th Berkeley Distribution August 16, 2012 4th Berkeley Distribution
All times are GMT -4. The time now is 06:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy