I would have assumed that GL_FIXED was faster, but the iPhone docs actually say to use GL_FLOAT because GL_FIXED has to be converted to GL_FLOAT. Is it the same on Android? I suppose it varies by phone, but what about recent popular ones (Nexus One, Droid/Milestone, etc.)?
Bonus points: This appears to be completely undocumented (e.g. s...
Assume this much:
I'm using a 16.16 fixed point system.
System is 32 bit.
CPU has no floating point processor.
Overflow is pretty imminent for multiplication for anything larger than 1.0 * 0.4999
To make one last assumption... lets say the values I'm working will not be so high as to cause overflow in this operation...
//assume that in...
I am looking for a free C++ fixed point library (Mainly for use with embedded devices, not for arbitrary precision math). Basically, the requirements are:
No unnecessary runtime overhead: whatever can be done at compile time, should be done at compile time.
Ability to transparently switch code between fixed and floating point, with no ...
Hi,
I am trying to learn about combinators and I am having trouble understand the example given at (Y overriding self-application). I think I am beginning to grasp the concept but I am still far from understanding.
I would like to translate the following code to Python:
(define (U f) (f f))
(define (fib-nr f)
(lambda...
Newbie ARM assembler question. I am writing my first arm assembler program and I am trying to code this C fragment.
int x = somevalue1 << 12; // s19.12
int y = somevalue2 << 12; // s19.12
int a = somevalue3 << 12; // s19.12
int b = somevalue4 << 12; // s19.12
int c = somevalue4 << 12; // s19.12
long long acc = (long long) a * b;...
Hi, I am thinking recently on how floating point math works on computers and is hard for me understand all the tecnicals details behind the formulas. I would need to understand the basics of addition, subtraction, multiplication, division and remainder. With these I will be able to make trig functions and formulas.
I can guess something...
Most examples of the use of fixed point combinators involve functions that take integers to integers (e.g. factorial). In many cases the fixed point of a function over the real numbers will end up being an arbitrary rational or perhaps irrational number (a famous example is the logistic map http://en.wikipedia.org/wiki/Logistic_map). In ...
I am confused about something. I wanted to generate an example (in Clojure) demonstrating how a fixed point combinator could be used to evaluate the fixed point of a sequence that mathematically converges after an infinite number of applications but would, in fact, converge after a finite number of steps due to finite precision of floati...
Hi, I'm trying to multiply A*B in 16-bit fixed point, while keeping as much accuracy as possible. A is 16-bit in unsigned integer range, B is divided by 1000 and always between 0.001 and 9.999. It's been a while since I dealt with problems like that, so:
I know I can just do A*B/1000 after moving to 32-bit variables, then strip back to...
Hi
Can anyone please let me know What will be the difference between these approcahes when I convert fixed to float and float to fixed.
a)
int a=32767;
float b = 32765*(1/32767) // 16 bit scaling factor
int c = b*32767;
b)
int a=32767;
float b = 32765*(1/1.0) // scaling factor=1
int c = b*1;
a)
int a=32767;
float b = 32765*(1/0x800...
This is (AFAIK) a specific question within this general topic.
Here's the situation:
I have an embedded system (a video game console) based on a 32-bit RISC microcontroller (a variant of NEC's V810). I want to write a fixed-point math library. I read this article, but the accompanying source code is written in 386 assembly, so it's nei...
I have a 64-bit timestamp unpacked from a file with binary data, where the top 32 bits are the number of seconds and the bottom 32 bits are the fraction of the second. I'm stuck with how to actually convert the bottom 32 bits into a fraction without looping through it bit-by-bit.
Any suggestions?
For reference, the number 4ca1f350 948...
I have a double variable in C++ and want to print it out to the screen as a fixed decimal point number.
Basically I want to know how to write a function that takes a double and a number of decimal places and prints out the number to that number of decimal places, zero padding if necessary.
For example:
convert(1.235, 2)
would print ...
Hi
I need to convert from fixed point signed Q8 format to fixed point signed Q4 format in c. I assume that I can just do a bitshift by four, is this correct? Do I need to take into account the sign bit?
Update: This is for an ARM11 architecture, but I would prefer a non-architecture specific solution.
Thanks
...
I created a structure to represent a fixed-point positive number. I want the numbers in both sides of the decimal point to consist 2 bytes.
typedef struct Fixed_t {
unsigned short floor; //left side of the decimal point
unsigned short fraction; //right side of the decimal point
} Fixed;
Now I want to add two fixed point number...