On 7/1/07, baptiste Augui<ba208 / exeter.ac.uk> wrote:
> yep, i do want (-2/3). Oh, i see, is 2/3 == 1 for Ruby?? OMG this is
> mad !
>
> thanks, it works now!
>
> <code>
> radius=0.045
> aspectRatio=[]
> longAxis=[]
> shortAxis=[]
>
> 0.5.step(1, 0.1) { |x| aspectRatio << x.to_s }
>
> longAxis=aspectRatio.collect{ |x|  radius*((x.to_f)**(-2/3.to_f)) }
> aspectRatio.each_index { |x| shortAxis << longAxis[x].to_f*aspectRatio
> [x].to_f}
> puts longAxis
> puts shortAxis
>
> </code>
>
> any easier / more elegant way to do all this ?
>
>
> thanks,
>
> baptiste

Instead of (-2/3.to_f) , you could use (-2.0/3). By using a float
literal rather than an integer literal, you will get float division
rather than integer division.

-A