Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

JAVA "to the power of"

Name: Anonymous 2011-12-10 17:01

Sup /prog/?

I know this is a retarded question, but I need some help with a method I need to write. The method parameters are a double and an int (a and b, respectively)

I need to write a for loop in the method that raises a (the double) to the power of b (the int)

How the fuck do I do this?? Normally this wouldn't be a problem, but I'm burnt out from finals

Name: >>14 2011-12-11 1:26

Oops, mispaste:
let powpow a b =
    let rec powpow a b c =
        if b < 1 then c
        else powpow a (b - 1) (c *. a) in
    let negpow a b = 1.0 /. (powpow a (-b) 1.0) in
    if b < 0 then negpow a b
    else powpow a b 1.0;;


>>16
Nice negatives powers.
let powpow a b =
    let rec powpow a b c =
        if b < 1 then c
        else powpow a (b - 1) (c *. a) in
    powpow a b 1.0;;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List