fixed-point

VDHL sfixed decoding code does not work properly

Deadly 提交于 2019-12-04 06:19:46
问题 I am using David bishop's fixed point library to do some math in vhdl. and i need to decode the final value into integers. the method i have followed as below, and i do get fine value for fractional part but the decimal value is not correct. i could not find the issue yet. in decimal part 1st two digits are wrong. xx 8374.839923 xx numbers are wrong always. when i perform this, i get 2 74334.738295 for 1 74334.738295 inside architecture, inside process i do declare these variables, variable

Why aren't fixed-point types included in C99?

﹥>﹥吖頭↗ 提交于 2019-12-04 03:23:30
Thankfully, the complex type modifier was introduced into C99 standard. What I don't understand is why it was decided to omit support for fixed point arithmetic (specifically, support fractional types like 1.15 {signed} or 0.32 {unsigned}) where these types are so fundamental to DSP programming? Does GCC support these through an extension? It's been discussed/proposed (e.g., in N938 , N953 ) but those papers have only proposed it as extensions, not additions to the main standard. Those seem to have led to its inclusion in N1169 , which is a draft of TR 18037 ("Extensions to support embedded

.NET - Why is there no fixed point numeric data type in C#?

末鹿安然 提交于 2019-12-04 01:13:19
问题 It seems like there would be a ton of uses for a fixed point data type. Why is there not one in .NET? Note: I understand we can create our own classes/structs to suit our fixed point purposes and needs. That's not my question. I want to know WHY MS decided not to include a fixed point numeric data type. 回答1: Decimal (base-10 floating point) was deemed to be good enough. 回答2: You're looking for the little-known System.Data.SqlTypes.SqlDecimal class. 回答3: One problem probably has to do with the

Adding Library to VHDL Project

拜拜、爱过 提交于 2019-12-03 23:07:05
I am trying to use fixed point numbers in my VHDL project, but I keep having trouble implementing the library (found here http://www.eda-stds.org/fphdl/fixed_pkg_c.vhdl ). The error I receive when trying to simulate is this <ufixed> is not declared My question is how exactly should a library be implemented so it can be used? As of now I have added it to the project in the IEEE_PROPOSED library, but it is not working. All source code can be found here https://github.com/srohrer32/beamformer/tree/fixed_num , under the hdl folder and libraries folder. Are you using modelsim? Are you using a

When to use Fixed Point these days

流过昼夜 提交于 2019-12-03 22:19:22
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 35,000 feet of numerical performance? (BTW, i'm assuming a general CPU as found in most computers, not

Invert 4x4 matrix - Numerical most stable solution needed

爱⌒轻易说出口 提交于 2019-12-03 09:14:30
问题 I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact). With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me so far, but when dealing with fixed point numbers I get an unacceptable precision loss due to all of the multiplications used. Note: In fixed point arithmetic I always throw away some of the least significant bits of immediate results. So - What

What do you use for fixed point representation in C++?

我的梦境 提交于 2019-12-03 08:37:35
问题 I'm looking for a fixed-point standard to use for financial data, do you know any that is worth trying? Do you have any experience on the performance of that hand-made fixed-point classes? 回答1: Dr.Dobb's has an article about a possible implementation of fixed-point arithmetic type in C++. Check this out. 回答2: Ouch. Financial systems are tricky, your main problem is not fixed point math, the problem are the rounding errors. You can have a nice spreadsheet full with maverlous calculations with

Advantages and disadvantages of floating point and fixed point representations [closed]

旧街凉风 提交于 2019-12-03 08:37:30
Closed . This question needs to be more focused. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it focuses on one problem only by editing this post . I have been trying for the last three days to understand the exact differences between floating and fixed point representations. I am confused reading the material and I'm unable to decide what is right and what is wrong. One of the problems is with the meaning of few technical terms like 'precision', 'mantissa', 'denormalised', 'underflows' etcetera. Can anyone give the differences with

How to use expr on float?

泪湿孤枕 提交于 2019-12-02 22:06:53
I know it's really stupid question, but I don't know how to do this in bash: 20 / 30 * 100 It should be 66.67 but expr is saying 0 , because it doesn't support float. What command in Linux can replace expr and do this equalation? As reported in the bash man page: The shell allows arithmetic expressions to be evaluated, under certain circumstances...Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. You can multiply by 100 earlier to get a better, partial result: let j=20*100/30 echo $j 66 Or by a higher multiple of 10

Convert a double to fixed decimal point in C++

喜夏-厌秋 提交于 2019-12-01 18:02:06
问题 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 out 1.24 and convert(1, 3) would print out 1.000 so the function works as convert(number as double, number of decimal places) and simply prints out the required