joymaproundvalues 23 March 2025 by Joyeuse ----------------- A C program that processes .map files (or any file) on Windows. It “rounds” numeric tokens in the file according to the following rules: 1. By default (with no -p flag), if a token is written in standard notation (i.e. without an 'e' or 'E'): - If a run of at least three consecutive zeros is found in its fractional part (after at least one nonzero digit), the token is truncated at that point. For example: - "-0.61000000009" becomes "-0.61" - "3.2901920001" becomes "3.290192" - Otherwise, if a run of at least three consecutive nines is found in the fractional part, the token is rounded to the number of decimals preceding the run. For example: - "-0.9749999999999998" becomes "-0.975" - If neither condition is met, the token remains unchanged. For tokens in scientific notation (containing 'e' or 'E'): - If fabs(val) < 1e-6, output "0"; otherwise, leave unchanged. 2. With the optional precision flag (-precision or -p), every numeric token is rounded to the specified number of decimal places using standard rounding. For example, with “-p 4” the token “2.123456789” becomes “2.1235”. 3. File/Directory handling: - No argument: processes all .map files in the current directory. - A directory path: processes all .map files in that directory. - A full file path: processes that file regardless of extension. 4. Flags: - -verbose : show line‐by‐line changes. - -silent or -s : do not prompt for commit and do not pause for key input. 5. Timing and user confirmation: - The program prints the number of edits and processing time (seconds+milliseconds) for each file. - If changes were made and not in silent mode, it prompts “Press Y to commit …”. - If no prompt was given (either because no edits occurred or silent mode is active), the program pauses for a key input before closing (unless silent mode is enabled).