Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

ALTFP_SINCOS - cosine mode

I'm running Quartus 11.0sp1

I think I found an error for the ALTFP_SINCOS megafunction in cosine mode.

For negative inputs the result comes out with the wrong sign.

Example: cos(-0.1) = -0.995.

Since cosine is an even function i.e., cos(x) = cos(-x) it is not that hard to workaround this problem.

I have a question about the workaround/fix (solution id: rd12212011_626) for the ALTFP_SINCOS megafunction in sine mode.

To workaround this, change the <altfp_sincos_variant_file_name>.vhd file, line 22850 as follows:

Change from:

wire_mantissanorm_add_datab <= ( "0000000000000000000000" & mantissanormnode_w(12));

Change to:

wire_mantissanorm_add_datab <= ( "0000000000000000000000" & mantissanormnode_w(11));

Am I supposed to make the same change in cosine mode?

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    How do you get 0.1 into ALTFP_SINCOS?

    I try it with declaration

    real rho = 0.1;

    But ALTFP_SINCOS cannot accept with real number.

    Thanks for your reading, waiting for your reply!