//===-- strtofloatingpoint comparison test --------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // #include "src/__support/str_float_conv_utils.h" #include <stdlib.h> // #include "src/__support/FPUtil/FPBits.h" #include <cstdint> #include <fstream> #include <iostream> #include <string> // The intent of this test is to read in files in the format used in this test // dataset: https://github.com/nigeltao/parse-number-fxx-test-data // The format is as follows: // Hexadecimal representations of IEEE754 floats in 16 bits, 32 bits, and 64 // bits, then the string that matches to them. // 3C00 3F800000 3FF0000000000000 1.0 // By default, float_comp_in.txt is used as the test set, but once built this // file can be run against the larger test set. To do that, clone the repository // with the dataset, then navigate to the compiled binary of this file (it // should be in llvm_project/build/bin). Run the following command: // ./libc_str_to_float_comparison_test <path/to/dataset/repo>/data/* // It will take a few seconds to run. static inline uint32_t hexCharToU32(char in) { … } // Fast because it assumes inStr points to exactly 8 uppercase hex chars static inline uint32_t fastHexToU32(const char *inStr) { … } // Fast because it assumes inStr points to exactly 8 uppercase hex chars static inline uint64_t fastHexToU64(const char *inStr) { … } int checkFile(char *inputFileName, int *totalFails, int *totalBitDiffs, int *detailedBitDiffs, int *total) { … } int main(int argc, char *argv[]) { … }