fixed-point

When to use Fixed Point these days

喜你入骨 提交于 2019-12-21 06:53:44
问题 For intense number-crunching i'm considering using fixed point instead of floating point. Of course it'll matter how many bytes the fixed point type is in size, on what CPU it'll be running on, if i can use (for Intel) the MMX or SSE or whatever new things come up... I'm wondering if these days when floating point runs faster than ever, is it ever worth considering fixed point? Are there general rules of thumb where we can say it'll matter by more than a few percent? What is the overview from

Compiling *.vhdl into a library, using Altera Quartus II

拈花ヽ惹草 提交于 2019-12-18 09:02:08
问题 I am trying to use 'Floating point and Fixed point package' as a part of my filter design in VHDL. I am using Altera Quartus II as the development environment. I downloaded the file package from the website: http://www.vhdl.org/fphdl/, now available at http://web.archive.org/web/20160305202256/http://www.vhdl.org/fphdl/ In their user guide, below is mentioned: 'fixed_float_types_c.vhdl', 'fixed_pkg_c.vhdl' and 'float_pkg_c.vhdl' should be compiled into a library called "ieee_proposed".

How can I perform 64-bit division with a 32-bit divide instruction?

故事扮演 提交于 2019-12-18 04:45:18
问题 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 neither directly usable nor easily modifiable. The V810 has built-in integer multiply/divide, but I want to use the 18.14 format mentioned in the above article.

Doing exact real number arithmetic with PHP

自作多情 提交于 2019-12-18 04:17:17
问题 What is fastest and most easy way of making basic arithmetic operations on strings representing real numbers in PHP? I have a string representing MySQL's DECIMAL value on which I want to operate and return the result to a database after that. I would like to avoid errors introduced by floating-point real number representation. Is there some standard library like Python's decimal? Are there any FOSS libraries you can recommend? Regards 回答1: You could use the BC math functions: http://www.php

Fast fixed point pow, log, exp and sqrt

瘦欲@ 提交于 2019-12-17 10:25:28
问题 I've got a fixed point class (10.22) and I have a need of a pow, a sqrt, an exp and a log function. Alas I have no idea where to even start on this. Can anyone provide me with some links to useful articles or, better yet, provide me with some code? I'm assuming that once I have an exp function then it becomes relatively easy to implement pow and sqrt as they just become. pow( x, y ) => exp( y * log( x ) ) sqrt( x ) => pow( x, 0.5 ) Its just those exp and log functions that I'm finding

Fixed point math in c#?

那年仲夏 提交于 2019-12-17 04:10:16
问题 I was wondering if anyone here knows of any good resources for fixed point math in c#? I've seen things like this (http://2ddev.72dpiarmy.com/viewtopic.php?id=156) and this (What's the best way to do fixed-point math?), and a number of discussions about whether decimal is really fixed point or actually floating point (update: responders have confirmed that it's definitely floating point), but I haven't seen a solid C# library for things like calculating cosine and sine. My needs are simple --

Fixed Point Cholesky Algorithm Advantages

空扰寡人 提交于 2019-12-13 16:16:54
问题 I am developing some code that can get its data from the HW in floating or fixed point. Currently we get that as floating point. The low layer APIs are all in fixed point. So we must pass data back as fixed point. The algorithm we are using is Cholesky. I am wondering why we must use floating point for Cholesky and not just get the data as fixed point. Are there any advantages in doing that? I would have thought that using floating point would have caused more rounding error. 回答1: The main

Avoid Overflow when Calculating π by Evaluating a Series Using 16-bit Arithmetic?

时间秒杀一切 提交于 2019-12-13 12:25:33
问题 I'm trying to write a program that calculates decimal digits of π to 1000 digits or more. To practice low-level programming for fun, the final program will be written in assembly, on a 8-bit CPU that has no multiplication or division, and only performs 16-bit additions. To ease the implementation, it's desirable to be able to use only 16-bit unsigned integer operations, and use an iterative algorithm. Speed is not a major concern. And fast multiplication and division is beyond the scope of

Converting SIGNED fractions to UNSIGNED fixed point for addition and multiplication

放肆的年华 提交于 2019-12-13 09:07:47
问题 How can we convert floating point numbers to their "fixed-point representations", and use their "fixed-point representations" in fixed-point operations such as addition and multiplication? The result in the fixed-point operation must yield to the correct answer when converted back to floating point. Say: (double)(xb_double) + (double)(xb_double) = ? Then we convert both addends to a fixed point representation (integer), (int)(xa_fixed) + (int)(xb_fixed) = (int) (xsum_fixed) To get (double)

Fixed Point Arithmetic in Chisel HDL

会有一股神秘感。 提交于 2019-12-13 02:24:03
问题 Are there any fixed point libraries in Chisel HDL which could be used to perform basic arithmetic operations such as add, subtract, multiply and divide? 回答1: I believe a Fixed class is under active development. Take a look at Fixed.scala in the Chisel repo. 来源: https://stackoverflow.com/questions/35237958/fixed-point-arithmetic-in-chisel-hdl