473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3891
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.progr amming

2. Your issue is about an algorithm or the process of getting
something done (such as interpolation). The newsgroup
news:comp.progr amming 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.l earn.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
1767
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 rightmost dictionary has the precedence).""" merg = {} for d in dictionaries:
6
1220
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 array, right? Example 2:
21
2015
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 long numbers, not only 64-bit) and Fraction (to express high precission). All these classes may inherit from abstract class Number. I got stuck...
1
366
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 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
0
2753
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 automatically interpolate & soften it. What I'm looking for is the Photoshop equivelent of setting image interpolation to 'Nearest Neighbor' vs. 'Bicubic'. ...
14
5189
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 ideas or PD code I can put to use right away. At the moment, I'm maintaining a contour calculation and plotting program for radio wave...
55
3134
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
3792
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 P P P R R R R T T T Z Z Z Z Z Z Z i know that i have to look in the begining of this file. but what is the steps to find j/ thank you for your help
0
1280
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 well as expressions. NB. It uses eval(), so only use it in trusted contexts! import sys, re def interp(string): locals =...
0
7918
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.