Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print Fixed Decimals using errs() in llvm

How to print fixed point decimals using errs() output stream of llvm.

For example if now if am doing errs()<<3.3; it is showing in scientific notation. I want it in decimal notation. I don't want to print with cout, but with errs

like image 851
coder hacker Avatar asked Sep 15 '25 18:09

coder hacker


1 Answers

You can use the format function from include/llvm/Support/Format.h to create C-printf-like strings:

errs() << format("%.3f\n", 3.3);

etc.

like image 195
Eli Bendersky Avatar answered Sep 17 '25 20:09

Eli Bendersky