469,312 Members | 2,493 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,312 developers. It's quick & easy.

Need help with list of fractions

Hi-
I have a list of floats. The list will always be 2^x+1 values, sorted,
between 0 and 1.

The smallest list would be [0, 0.5, 1].

I need a function that can get a list of any length, and return a new
list. For example:
foo([0, 1/2.0, 1]) [0, 1/3.0, 2/3.0, 1]
foo([0, 1/4.0, 1/2.0, 3/4.0, 1])

[0, 1/5.0, 2/5.0, 3/5.0, 4/5.0, 1]

The output list will have 1 more element than the input list.

I can't (be bothered to) figure out how foo should work internally. Maybe
somebody can help? This stuff is not my strong suit.




Jul 18 '05 #1
0 1393

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by peter leonard | last post: by
1 post views Thread by ferran | last post: by
5 posts views Thread by Steffen | last post: by
12 posts views Thread by Rob T | last post: by
15 posts views Thread by farah727rash | last post: by
2 posts views Thread by blamp | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.