Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequency ratio is not constructed correctly from time ratio #140

Open
pavelkryukov opened this issue Dec 9, 2024 · 0 comments
Open

Frequency ratio is not constructed correctly from time ratio #140

pavelkryukov opened this issue Dec 9, 2024 · 0 comments

Comments

@pavelkryukov
Copy link

pavelkryukov commented Dec 9, 2024

Describe the bug
Frequency ratio is not constructed correctly from time ratio

To Reproduce

#include "include/SI/frequency.h"

#include <iostream>

int main()
{
    // Creating 1 millisecond
    auto t = SI::milli_seconds_t<double>(1.);

    // 1 beat per 1 millisecond is 1 kHz
    auto f = 1. / t;

    // Expecting to see 1 as f should contain 1 kHz
    std::cout << f.as<SI::kilo_hertz_t>().value() << std::endl;

    return 0;
}

Output: 1e-06

Expected behavior
Expected to see 1 on the screen.

Additional context
Reproduced with g++-10 --std=c++20.
It appears to me that f contains 1 mHz insted of 1 kHz, thus converting to 1 kHz turns to be 1e-06

@pavelkryukov pavelkryukov changed the title Time ratio is not constructed correctly from frequency ratio Frequency ratio is not constructed correctly from time ratio Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant