Question: Ocaml Programing. write a function power_pos : float -> int -> float, that raises its first argument to the power given in its second argument,

Ocaml Programing.

write a function power_pos : float -> int -> float, that raises its first argument to the power given in its second argument, provided its second argument is positive. So: power_pos 3. 2 = 9 Recall that *. is used for multiplication of floats.

write a function power : float -> int -> float, that raises its first argument to the power of its second. For example: power 3. (-2) = 0.11111111 Hint: a to the power -b is equal to 1 / (a to the power b). You may let 0 to the 0th power return 1.

write a function count_factors : int -> int, that counts the number of factors of a positive integer. For example: count_factors 6 = 4. (The factors are 1, 2, 3 and 6). You may need to use a helper function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!