Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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 logAny() 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 logAny() 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 (you 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 logAny(double x, double b) - This function returns the log base b of x. For example, logAny(8,2) should return 3 (because 2 to the 3rd power is 8 and thus 3 is the log base 2 of 8). int main(void) - Of course, you need to write a main(). Number 1: Tog base 2 - 0.000000 Tog base 4 = 0.000000 Tog base 8 = 0.000000 Tog base 16 = 0.000000 log base 32 = 0.000000 Number 2 : Tog base 2 - 1.000000 Tog base 4 = 0.500000 Tog base 8 = 0.333333 Tog base 16 = 0.250000 Tog base 32 = 0.200000 Number 4: Tog base 2 = 2.000000 Tog base 4 = 1.000000 Tog base 8 = 0.666667 log base 16 = 0.500000 log base 32 = 0.400000 Number 8: log base 2 = 3.000000 Tog base 4 = 1.500000 Tog base 8 = 1.000000 log base 16 = 0.750000 log base 32 = 0.600000 Number 16: log base 2 = 4.000000 log base 4 = 2.000000 log base 8 = 1.333333 log base 16 = 1.000000 log base 32 = 0.800000 Number 32: log base 2 = 5.000000 log base 4 = 2.500000 log base 8 = 1.666667 log base 16 = 1.250000 log base 32 = 1.000000 Number 64: log base 2 = 6.000000 log base 4 = 3.000000 log base 8 = 2.000000 log base 16 = 1.500000 log base 32 = 1.200000 Number 128: log base 2 = 7.000000 log base 4 = 3.500000 log base 8 = 2.333333

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_2

Step: 3

blur-text-image_3

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago