472,348 Members | 1,265 Online

# 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 1437

This thread has been closed and replies have been disabled. Please start a new discussion.

### Similar topics

 0 by: peter leonard | last post by: Hi, This is a basic question but I can't figure out what is wron - even after reading the documentation. I have a script that normalizes strings.... 1 by: ferran | last post by: Hi, does anybody know how to convert in C++ from base 10 to any other base without loosing the decimal part of the actual value? I came up with... 7 by: kaming | last post by: Dear all, I found that I can't update or delete a DB2 record with timestamp using Access through ODBC. The Access complains "No current record"... 5 by: Steffen | last post by: Hi, is it possible to have two fractions, which (mathematically) have the order a/b < c/d (a,b,c,d integers), but when (correctly) converted... 12 by: Rob T | last post by: I'm storing a date/time into a SQL table of type datetime. I need it to be precise so the value is stored to the 1000th of a second. ie "insert... 2 by: Just Me | last post by: I need a numerical updown control that displays fractions. If the increment is 1/16 it would display 1/16, 1/32, 3/16, 1/4... I thought I might... 15 by: farah727rash | last post by: Hi everyone, I have this problem and I don't know what's wrong with my program. I am trying to enter my two variables height and weight as fraction... 28 by: FAQ server | last post by: ----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal... 2 by: blamp | last post by: Im writing a fraction calculator program I finished the program but keep getting an error on the do while function. can someone help heres the... 0 by: better678 | last post by: Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented... 1 by: Kemmylinns12 | last post by: Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and... 0 by: Naresh1 | last post by: What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge... 0 by: antdb | last post by: Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was... 0 by: Matthew3360 | last post by: Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ... 0 by: AndyPSV | last post by: HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable... 0 by: Arjunsri | last post by: I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and... 0 by: Matthew3360 | last post by: Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web... 0 by: Oralloy | last post by: Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...