33 lines · cpp
1//===-- Unittests for fmul ------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "MulTest.h"10 11#include "src/math/fmul.h"12 13LIST_MUL_TESTS(float, double, LIBC_NAMESPACE::fmul)14 15TEST_F(LlvmLibcMulTest, SpecialInputs) {16 constexpr double INPUTS[][2] = {17 {0x1.0100010002p8, 0x1.fffcp14},18 {0x1.000000b92144p-7, 0x1.62p7},19 };20 21 constexpr float RESULTS[] = {22 0x1.00fdfep+23f,23 0x1.620002p0f,24 };25 26 constexpr size_t N = sizeof(RESULTS) / sizeof(RESULTS[0]);27 28 for (size_t i = 0; i < N; ++i) {29 float result = LIBC_NAMESPACE::fmul(INPUTS[i][0], INPUTS[i][1]);30 EXPECT_FP_EQ(RESULTS[i], result);31 }32}33