mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
refactor: IWYU applied to the source files
`alternative_namespaces` examples left out as I consider them a subject for removal in the nearest future.
This commit is contained in:
@ -24,7 +24,6 @@
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/isq/si/typographic/length.h>
|
||||
#include <units/isq/si/us/length.h>
|
||||
#include <units/isq/si/volume.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
@ -112,29 +111,29 @@ void calcs_comparison()
|
||||
"when adding two values of the same very big\n"
|
||||
"or very small type:\n\n";
|
||||
|
||||
length<femtometre,float> L1A = 2._q_fm;
|
||||
length<femtometre,float> L2A = 3._q_fm;
|
||||
length<femtometre,float> LrA = L1A + L2A;
|
||||
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n",L1A,L2A,LrA);
|
||||
length<femtometre, float> L1A = 2._q_fm;
|
||||
length<femtometre, float> L2A = 3._q_fm;
|
||||
length<femtometre, float> LrA = L1A + L2A;
|
||||
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, LrA);
|
||||
|
||||
std::cout << "The single unit method must convert large\n"
|
||||
"or small values in other units to the base unit.\n"
|
||||
"This is both inefficient and inaccurate\n\n";
|
||||
|
||||
length<metre,float> L1B = L1A;
|
||||
length<metre,float> L2B = L2A;
|
||||
length<metre,float> LrB = L1B + L2B;
|
||||
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n",L1B,L2B,LrB);
|
||||
length<metre, float> L1B = L1A;
|
||||
length<metre, float> L2B = L2A;
|
||||
length<metre, float> LrB = L1B + L2B;
|
||||
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, LrB);
|
||||
|
||||
std::cout << "In multiplication and division:\n\n";
|
||||
|
||||
area<square_femtometre,float> ArA = L1A * L2A;
|
||||
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n",L1A,L2A,ArA);
|
||||
area<square_femtometre, float> ArA = L1A * L2A;
|
||||
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, ArA);
|
||||
|
||||
std::cout << "similar problems arise\n\n";
|
||||
|
||||
area<square_metre,float> ArB = L1B * L2B;
|
||||
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n",L1B,L2B,ArB);
|
||||
area<square_metre, float> ArB = L1B * L2B;
|
||||
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, ArB);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user