Skip to content

Commit

Permalink
Merge pull request #2257 from DARMA-tasking/2256-increase-time-sigfigs
Browse files Browse the repository at this point in the history
#2256: timing: add more significant figures
  • Loading branch information
nlslatt authored Mar 27, 2024
2 parents 26f702c + 5c7878a commit e3f0eb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/vt/timing/timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct formatter<::vt::TimeTypeWrapper> {
auto format(::vt::TimeTypeWrapper const& t, FormatContext& ctx) {
return fmt::format_to(
ctx.out(), "{}",
to_engineering_string(t.seconds(), 3, eng_exponential, "s")
to_engineering_string(t.seconds(), 5, eng_exponential, "s")
);
}
};
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/timing/test_timing.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,37 @@ using TestTiming = TestHarness;
TEST_F(TestTiming, test_time_formatting) {
{
TimeType const t = TimeType{15664645.400691890716};
EXPECT_EQ(fmt::format("{}", t), "15.7e6 s");
EXPECT_EQ(fmt::format("{}", t), "15.665e6 s");
}

{
TimeType const t = TimeType{4.0006918907165527344};
EXPECT_EQ(fmt::format("{}", t), "4.00e0 s");
EXPECT_EQ(fmt::format("{}", t), "4.0007e0 s");
}

{
TimeType const t = TimeType{0.0691890716552734423};
EXPECT_EQ(fmt::format("{}", t), "69.2e-3 s");
EXPECT_EQ(fmt::format("{}", t), "69.189e-3 s");
}

{
TimeType const t = TimeType{-0.0691890716552734423};
EXPECT_EQ(fmt::format("{}", t), "-69.2e-3 s");
EXPECT_EQ(fmt::format("{}", t), "-69.189e-3 s");
}

{
TimeType const t = TimeType{0.0006918907165527344};
EXPECT_EQ(fmt::format("{}", t), "692e-6 s");
EXPECT_EQ(fmt::format("{}", t), "691.89e-6 s");
}

{
TimeType const t = TimeType{0.0000006918907165527};
EXPECT_EQ(fmt::format("{}", t), "692e-9 s");
EXPECT_EQ(fmt::format("{}", t), "691.89e-9 s");
}

{
TimeType const t = TimeType{3.14};
EXPECT_EQ(fmt::format("{}", t), "3.14e0 s");
EXPECT_EQ(fmt::format("{}", t), "3.1400e0 s");
}
}

Expand Down

0 comments on commit e3f0eb9

Please sign in to comment.