~ubuntu-branches/ubuntu/maverick/clamav/maverick-backports

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/utils/fpcmp/fpcmp.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran, Stephen Gran, Michael Tautschnig
  • Date: 2010-04-26 21:41:18 UTC
  • mfrom: (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100426214118-i6lo606wnh7ywfj6
Tags: 0.96+dfsg-4
[ Stephen Gran ]
* Fixed typo in clamav-milter's postinst

[ Michael Tautschnig ]
* Fixed typo in clamav-freshclam's postinst (closes: #579271)
* Debconf translation updates
  - Portuguese (closes: #579068)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===- fpcmp.cpp - A fuzzy "cmp" that permits floating point noise --------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
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.
 
12
//
 
13
//===----------------------------------------------------------------------===//
 
14
 
 
15
#include "llvm/Support/CommandLine.h"
 
16
#include "llvm/Support/FileUtilities.h"
 
17
#include <iostream>
 
18
using namespace llvm;
 
19
 
 
20
namespace {
 
21
  cl::opt<std::string>
 
22
  File1(cl::Positional, cl::desc("<input file #1>"), cl::Required);
 
23
  cl::opt<std::string>
 
24
  File2(cl::Positional, cl::desc("<input file #2>"), cl::Required);
 
25
 
 
26
  cl::opt<double>
 
27
  RelTolerance("r", cl::desc("Relative error tolerated"), cl::init(0));
 
28
  cl::opt<double>
 
29
  AbsTolerance("a", cl::desc("Absolute error tolerated"), cl::init(0));
 
30
}
 
31
 
 
32
int main(int argc, char **argv) {
 
33
  cl::ParseCommandLineOptions(argc, argv);
 
34
 
 
35
  std::string ErrorMsg;
 
36
  int DF = DiffFilesWithTolerance(sys::PathWithStatus(File1), 
 
37
                                  sys::PathWithStatus(File2),
 
38
                                  AbsTolerance, RelTolerance, &ErrorMsg);
 
39
  if (!ErrorMsg.empty())
 
40
    std::cerr << argv[0] << ": " << ErrorMsg << "\n";
 
41
  return DF;
 
42
}
 
43