Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

screenshot the code, thank you! Description For the lab assignment, you are to write a function to calculate the logarithm of a number for an

image text in transcribed

image text in transcribed

image text in transcribed

screenshot the code, thank you!

Description For the lab assignment, you are to write a function to calculate the logarithm of a number for an arbitrary base. This function should be named anyLog() and it should take parameters of the number whose log you wish to calculate, and the base to be used. in order to test your any log() function, you must go through the integers from 1 through 8192 doubling your counter each time (i.e., 1,2,4,8,16,32,...,8192). For each of the selected integers, you should display that number on a line and then the following logs of that number on indented lines below it: the log base 2, log base 4, log base 8, log base 16, and log base 32. See the sample output for an example, Basic Requirements (vou will lose points if you don't have these Your program should have a comment header at the top of the file that provides the lab number, the course, the semester, the author, and the date when the program was written. This comment header should be nicely formatted and easy to read. All code should be indented properly and should be easy to read. Functions You Must Write You may write any functions you wish to implement this program, in addition to the following functions. However, you must implement the following functions: double anyLog(double base, double x) - This function returns the log base bofx. For example, anyLog(8,2) should return 3 (because 2 to the 3 power is 8 and thus 3 is the log base 2 of 8). int main(void) - Of course, you need to write a main(). Sample Output jimr@JimRHadesCanyon:-/CS1050/SP2020/labs/1ab4$ compile x-lab4.c jimr@JimRHadesCanyon:-/CS1050/SP2020/labs/1ab4$ ./a.out Number 1: Tog base 2 = 0.000000 log base 4 = 0.000000 log base 8 = 0.000000 log base 16 = 0.000000 log base 32 = 0.000000 Number 2: log base 2 = 1.000000 log base 4 = 0.500000 u l og base 8 = 0.333333 log base 16 = 0.250000 log base 32 = 0.200000 Number 4: log base 2 = 2.000000 log base 4 = 1.000000 log base 8 = 0.666667 log base 16 = 0.500000 log base 32 = 0.400000 Number 8: log base 2 = 3.000000 log base 4 = 1.500000 log base 8 = 1.000000 Tog base 16 = 0.750000 Tog base 32 = 0.600000 Number 16: Tog base 2 = 4.000000 log base 4 = 2.000000 log base 8 = 1.333333 Tog base 16 = 1.000000 Tog base 32 = 0.800000 Number 32: log base 2 = 5.000000 Tog base 4 = 2.500000 Tog base 8 = 1.666667 Tog base 16 = 1.250000 Tog base 32 = 1.000000 Number 64: Tog base 2 = 6.000000 Tog base 4 = 3.000000 Tog base 8 = 2.000000 Tog base 16 = 1.500000 Tog base 32 = 1.200000 Number 128: Tog base 2 = 7.000000 Tog base 4 = 3.500000 Tog base 8 = 2.333333 log base 16 = 1.750000 Tog base 32 = 1.400000 Number 256: log base 2 = 8.000000 log base 4 = 4.000000 Tog base 8 = 2.666667 Tog base 16 = 2.000000 log base 32 = 1.600000 Number 512: Tog base 2 = 9.000000 log base 4 = 4.500000 log base 8 = 3.000000 log base 16 = 2.250000 log base 32 = 1.800000 Number 1024: log base 2 = 10.000000 log base 4 = 5.000000 Tog base 8 = 3.333333 log base 16 = 2.500000 log base 32 = 2.000000 Number 2048: log base 2 = 11.000000 log base 4 = 5.500000 log base 8 = 3.666667 log base 16 = 2.750000 Tog base 32 = 2.200000 Number 4096: Tog base 2 = 12.000000 log base 4 = 6.000000 Tog base 8 = 4.000000 log base 16 = 3.000000 log base 32 = 2.400000 Number 8192: Tog base 2 = 13.000000 Tog base 4 = 6.500000 Tog base 8 = 4.333333 Tog base 16 = 3.250000 log base 32 = 2.600000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago