Forum Discussion
Altera_Forum
Honored Contributor
16 years agoHello,
--- Quote Start --- Yes I looked in that - it is cleary written. you are right about hardware precision, but in fact it is possible to do double floating point math if no fp floatig point custom instruction hardware is used with Nios/e --- Quote End --- Yes, the type of processor (e/s/f) does not change the behaviour related to float/double operations (at least I don't see it anywhere). Do you get the same results with all the type of processor ? Else after reading again the doc, I find that your results are quiet strange. In Nios II Processor Reference Handbook, they say : --- Quote Start --- All the floating-point custom instructions are single-precision operations. Double-precision operations are implemented in software. By default, the Nios II compiler treats floating-point constants as double-precision numbers. To use the floating-point custom instructions for operations with floating-point constants, append an “f” to the constant. This tells the compiler to treat the constant as a single-precision floating-point value, rather than promote the other variables in your equation to double precision numbers. | Example Code | Precision | Floating-Point Custom Instruction Usage | | y = x × 4.67; | Double | No | | y = x × 4.67f; | Single | Yes | --- Quote End --- In your program, your variables and your constants are all double, so even if you add the floating point custom instruction (as in your case 2 and B), it should not be use it and all the calculus should be in double precision.