1 //===- fpcmp.cpp - A fuzzy "cmp" that permits floating point noise --------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // fpcmp is a tool that basically works like the 'cmp' tool, except that it can
11 // tolerate errors due to floating point noise, with the -r and -a options.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Support/CommandLine.h"
16 #include "llvm/Support/FileUtilities.h"
24 File1(cl::Positional, cl::desc("<input file #1>"), cl::Required);
26 File2(cl::Positional, cl::desc("<input file #2>"), cl::Required);
29 RelTolerance("r", cl::desc("Relative error tolerated"), cl::init(0));
31 AbsTolerance("a", cl::desc("Absolute error tolerated"), cl::init(0));
34 int main(int argc, char **argv) {
35 cl::ParseCommandLineOptions(argc, argv);
38 int DF = DiffFilesWithTolerance(File1, File2, AbsTolerance, RelTolerance,
40 if (!ErrorMsg.empty())
41 std::cerr << argv[0] << ": " << ErrorMsg << "\n";