473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Interpolation without FPoint arithmetics

Hi,

Can somebody give me some hints how to do a line interpolation without using
floating point arithemtics?

The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

Is there a way to implement this not using any FP arithmetics in C? Perhaps
"scaling up" or sth like this?

Any help would be great

Thanks in advance
J. Ernst
Nov 14 '05 #1
3 3848
Jonas Ernst wrote:
The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600


y = 20*x ?

How is this related to the C language?

Nov 14 '05 #2
Jonas Ernst wrote:
Hi,

Can somebody give me some hints how to do a line interpolation without using
floating point arithemtics?
Yes.
The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

Is there a way to implement this not using any FP arithmetics in C? Perhaps
"scaling up" or sth like this?


Yes. Most early graphics-oriented devices had no FP. The BetaCom
devices I programmed (sold to Gould. What they did with BetaCom I don't
know.) were 4K and 8K 12-bit PDP-8's with no FP. They did quite well.
What we could do in PDP-8 assembler, you can do in C. Elementary
graphics texts would be a help to you.
Nov 14 '05 #3
Jonas Ernst wrote:
Hi,

Can somebody give me some hints how to do a line interpolation without using
floating point arithemtics?

The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

Is there a way to implement this not using any FP arithmetics in C? Perhaps
"scaling up" or sth like this?

Any help would be great

Thanks in advance
J. Ernst


1. Don't post separately to multiple newsgroups. If you are
going to crosspost, append them to the "Newsgroup:" section
of your post. For example, there are different replies to
your post in news:comp.lang.c++ than this one.
CC: news:comp.lang.c++ (for thread consistency)
Followup-To: news:comp.programming

2. Your issue is about an algorithm or the process of getting
something done (such as interpolation). The newsgroup
news:comp.programming is an excellent place for algorithmic
questions. Most all algorithms are language independent.

3. This also happens to be a mathematics issue, again independent
of the programming language. Also try a newsgroup with the
term "sci.math" in its name.

4. How do you want the interpolation performed?
Linear Interpolation?
Binomial Interpolation?
Other?

5. Your issue may also fall under the relm of "curve fitting",
which is the subject of determining the best equation to
describe a set of points. If you have the equation then
determining any other point is easy. However, determining
the equation is not always easy.
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Nov 14 '05 #4

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

Similar topics

8
by: Michele Simionato | last post by:
I was playing with string.Template in Python 2.4 and I came out with the following recipe: import sys from string import Template def merge(*dictionaries): """Merge from right (i.e. the...
6
by: Terence | last post by:
I need some clarification with pointer arithmetics on void *. Example 1: ======== char s; char *ptr = s; ptr += 1; // I assume ptr is increased by 1 byte, pointing to the 2nd element in the...
21
by: Milan Čermák | last post by:
Hi all, I'm about to write an arithmetics object library. It should contain classes like ShortInteger (for 32-bit longs), Double and Float as standard numeric type wrappers and LongInteger (really...
1
by: Jonas Ernst | last post by:
Hi, Can somebody give me some hints how to do a line interpolation without using floating point arithemtics? The function shall do a linear interpolation between 2 points (line interp?) and...
0
by: nept | last post by:
I'm working on an experimental image manipulation application and don't have a lot of experience in this area. I'm trying to scale up (zoom in on) an image on the form *without* having VB...
14
by: Charles Banas | last post by:
I'm not sure if this is the right place to ask about this, but I've seen several posts in the past regarding Akima's Bivariate Interpolations routines, and i'm wondering if someone can give me some...
55
by: Robotnik | last post by:
Hello All, I want to know if we could know the size of a structyure without the use of sizeof(). Any hints.
5
by: xandra | last post by:
i understood the concept of interpolation search. but i couldn't understand what would be the steps for that search. for example, if i'm searching for J in this file A A B E F H J M N N N N O P P...
0
by: MonkeeSage | last post by:
There are several string interpolation functions, as well as string.Template. But here's yet another. This one emulates ruby's inline interpolation syntax (using #{}), which interpolates strings as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.