Skip to content

The size of ac_fixed changes between signed and unsigned #18

@agustinhurquiza

Description

@agustinhurquiza

I am observing that the ac_fixed sizes change when I use unsigned 32 bits.

Here is an example:

ac_fixed<32, 16, true> x = 3.14;
std::cout << "Sizeof: " << sizeof(x) << " bytes\n";
[Out] Sizeof: 4 bytes

ac_fixed<32, 16, false> x = 3.14;
std::cout << "Sizeof: " << sizeof(x) << " bytes\n";
[Out] Sizeof: 8 bytes

This happens in version AC Datatypes v4.4.1

I'm not sure this is a bug, but I did find this effect strange, forcing me to change my code to accommodate this.

Compilation Info:

* Oracle Linux Server release 7.9
* g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)
* g++ example.cpp -o run -I ../include/ -O3 -Werror -Wall -g -std=c++11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions