Turn modified fdlibm into Jerry's own libm
* Rename modified fdlibm to jerry-libm
* Move third-party/fdlibm to jerry-libm
* Rename original fdlibm.h to jerry-libm-internal.h
* And remove it from the public headers.
* Rename jerry-libm's public header to math.h
* This also makes jerry-core sources include `<math.h>`. Therefore,
should anyone want to use a different libm implementation with
jerry, it becomes possible. (The same way as we provide a minimal
libc with standard headers, but should it be insufficient or
conflicting for someone, it can be replaced.)
* Drop `s_` prefix from jerry-libm sources
* The original fdlibm implementation had various prefixes (e.g., `k_`
for sources of kernel routines, and `w_` for wrapper routines), but
after the specialization of fdlibm to jerry, only `s_` remained.
Since it does not encode anything anymore, it can be dropped.
* Stylistic edits to jerry-libm's CMakeLists
* Align project name with other CMakeLists in the code base
* Move Jerry-LibM under Apache License
* Using the same approach as was used by linux-wireless when ath5k
driver license needed clarification. Solution was proposed by SFLC.
External mail for future reference: http://lwn.net/Articles/247806/
* Tests & checks
* Remove FD from the name of libm unit test-related files
* Make vera++ and cppcheck check jerry-libm
* Targets
* Speculative update of targets to use jerry-libm
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+10
-11
@@ -37,9 +37,8 @@ project (Jerry C ASM)
|
||||
endif()
|
||||
|
||||
|
||||
# Imported and third-party targets prefix
|
||||
# Imported targets prefix
|
||||
set(PREFIX_IMPORTED_LIB imported_)
|
||||
set(SUFFIX_THIRD_PARTY_LIB .third_party.lib)
|
||||
|
||||
# Architecture-specific compile/link flags
|
||||
foreach(FLAG ${FLAGS_COMMON_ARCH})
|
||||
@@ -372,8 +371,8 @@ endif()
|
||||
add_subdirectory(jerry-libc)
|
||||
endif()
|
||||
|
||||
# Jerry's fdlibm
|
||||
add_subdirectory(third-party/fdlibm)
|
||||
# Jerry's libm
|
||||
add_subdirectory(jerry-libm)
|
||||
|
||||
# Jerry's Core
|
||||
add_subdirectory(jerry-core)
|
||||
@@ -394,7 +393,7 @@ endif()
|
||||
|
||||
set(CORE_TARGET_NAME ${CORE_TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}})
|
||||
endforeach()
|
||||
set(FDLIBM_TARGET_NAME ${CORE_TARGET_NAME}.jerry-fdlibm${SUFFIX_THIRD_PARTY_LIB})
|
||||
set(LIBM_TARGET_NAME ${CORE_TARGET_NAME}.jerry-libm.lib)
|
||||
set(CORE_TARGET_NAME ${CORE_TARGET_NAME}.jerry-core)
|
||||
|
||||
set(DEFINES_JERRY )
|
||||
@@ -425,10 +424,10 @@ endif()
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${INCLUDE_EXTERNAL_LIBS_INTERFACE})
|
||||
if(("${PLATFORM}" STREQUAL "DARWIN") AND (NOT (CMAKE_COMPILER_IS_GNUCC)))
|
||||
target_link_libraries(${TARGET_NAME} ${CORE_TARGET_NAME} ${LIBC_TARGET_NAME}
|
||||
${FDLIBM_TARGET_NAME} ${PREFIX_IMPORTED_LIB}libclang_rt.osx)
|
||||
${LIBM_TARGET_NAME} ${PREFIX_IMPORTED_LIB}libclang_rt.osx)
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} ${CORE_TARGET_NAME} ${LIBC_TARGET_NAME}
|
||||
${FDLIBM_TARGET_NAME} ${PREFIX_IMPORTED_LIB}libgcc)
|
||||
${LIBM_TARGET_NAME} ${PREFIX_IMPORTED_LIB}libgcc)
|
||||
endif()
|
||||
|
||||
if("${PLATFORM}" STREQUAL "MCU")
|
||||
@@ -454,7 +453,7 @@ endif()
|
||||
add_custom_command(TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/${TARGET_NAME}
|
||||
COMMAND echo $<TARGET_FILE:${FDLIBM_TARGET_NAME}> > ${CMAKE_BINARY_DIR}/${TARGET_NAME}/list
|
||||
COMMAND echo $<TARGET_FILE:${LIBM_TARGET_NAME}> > ${CMAKE_BINARY_DIR}/${TARGET_NAME}/list
|
||||
COMMAND echo $<TARGET_FILE:${CORE_TARGET_NAME}> >> ${CMAKE_BINARY_DIR}/${TARGET_NAME}/list)
|
||||
|
||||
if(DEFINED EXTERNAL_BUILD_ENTRY_FILE)
|
||||
@@ -499,7 +498,7 @@ endif()
|
||||
if (${USE_JERRY_LIBC})
|
||||
set(LIBC_TARGET_NAME unittests.jerry-libc.${PLATFORM_L}.lib)
|
||||
endif ()
|
||||
set(FDLIBM_TARGET_NAME unittests.jerry-fdlibm${SUFFIX_THIRD_PARTY_LIB})
|
||||
set(LIBM_TARGET_NAME unittests.jerry-libm.lib)
|
||||
|
||||
add_executable(${TARGET_NAME} ${SOURCE_UNIT_TEST_MAIN})
|
||||
set_property(TARGET ${TARGET_NAME}
|
||||
@@ -510,10 +509,10 @@ endif()
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${INCLUDE_LIBC_INTERFACE})
|
||||
|
||||
if(("${PLATFORM}" STREQUAL "DARWIN") AND (NOT (CMAKE_COMPILER_IS_GNUCC)))
|
||||
target_link_libraries(${TARGET_NAME} ${CORE_TARGET_NAME} ${LIBC_TARGET_NAME} ${FDLIBM_TARGET_NAME}
|
||||
target_link_libraries(${TARGET_NAME} ${CORE_TARGET_NAME} ${LIBC_TARGET_NAME} ${LIBM_TARGET_NAME}
|
||||
${PREFIX_IMPORTED_LIB}libclang_rt.osx)
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} ${CORE_TARGET_NAME} ${LIBC_TARGET_NAME} ${FDLIBM_TARGET_NAME}
|
||||
target_link_libraries(${TARGET_NAME} ${CORE_TARGET_NAME} ${LIBC_TARGET_NAME} ${LIBM_TARGET_NAME}
|
||||
${PREFIX_IMPORTED_LIB}libgcc)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ project (JerryCore C ASM)
|
||||
PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_JERRY} ${C_FLAGS_JERRY} ${FLAGS_COMMON_${BUILD_MODE}}")
|
||||
target_compile_definitions(${TARGET_NAME}.jerry-core PRIVATE ${DEFINES_JERRY})
|
||||
target_include_directories(${TARGET_NAME}.jerry-core PRIVATE ${INCLUDE_CORE})
|
||||
target_include_directories(${TARGET_NAME}.jerry-core PRIVATE ${INCLUDE_FDLIBM})
|
||||
target_include_directories(${TARGET_NAME}.jerry-core PRIVATE ${INCLUDE_LIBM})
|
||||
target_include_directories(${TARGET_NAME}.jerry-core SYSTEM PRIVATE ${INCLUDE_LIBC_INTERFACE})
|
||||
target_include_directories(${TARGET_NAME}.jerry-core SYSTEM PRIVATE ${INCLUDE_EXTERNAL_LIBS_INTERFACE})
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-exceptions.h"
|
||||
@@ -22,7 +24,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "fdlibm-math.h"
|
||||
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-exceptions.h"
|
||||
@@ -21,7 +23,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "fdlibm-math.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
@@ -25,7 +27,6 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "fdlibm-math.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
@@ -24,7 +26,6 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "fdlibm-math.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
||||
# Copyright 2015-2016 University of Szeged.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
project (Jerry_LibM C)
|
||||
|
||||
# Compiler / linker flags
|
||||
# TODO: Reduce the below list of warning/error disablings as much as possible
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_JERRY} ${C_FLAGS_JERRY}")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=parentheses")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=sign-compare")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=sign-conversion")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=strict-aliasing")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=unknown-pragmas")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=missing-declarations")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=maybe-uninitialized")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=unused-but-set-variable")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=unused-variable")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=conversion")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-sign-conversion")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-sign-compare")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-parentheses")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-maybe-uninitialized")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-unknown-pragmas")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-unused-but-set-variable")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-unused-variable")
|
||||
|
||||
# Include directories
|
||||
set(INCLUDE_LIBM ${CMAKE_SOURCE_DIR}/jerry-libm/include)
|
||||
set(INCLUDE_LIBM ${INCLUDE_LIBM} PARENT_SCOPE)
|
||||
|
||||
# Source directories
|
||||
file(GLOB SOURCE_LIBM *.c)
|
||||
|
||||
add_custom_target (jerry-libm-all)
|
||||
|
||||
# Targets declaration
|
||||
function(declare_targets_for_build_mode BUILD_MODE)
|
||||
set(TARGET_NAME ${BUILD_MODE_PREFIX_${BUILD_MODE}})
|
||||
|
||||
function(declare_target_with_modifiers ) # modifiers are passed in ARGN implicit argument
|
||||
foreach(MODIFIER ${ARGN})
|
||||
set(TARGET_NAME ${TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}})
|
||||
endforeach()
|
||||
|
||||
add_library(${TARGET_NAME}.jerry-libm.lib STATIC ${SOURCE_LIBM})
|
||||
set_property(TARGET ${TARGET_NAME}.jerry-libm.lib
|
||||
PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_LIBM}")
|
||||
target_include_directories(${TARGET_NAME}.jerry-libm.lib PRIVATE ${INCLUDE_LIBM})
|
||||
|
||||
if("${BUILD_MODE}" STREQUAL "UNITTESTS")
|
||||
target_include_directories(${TARGET_NAME}.jerry-libm.lib INTERFACE ${INCLUDE_LIBM})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
foreach(MODIFIERS_LIST ${MODIFIERS_LISTS})
|
||||
separate_arguments(MODIFIERS_LIST)
|
||||
|
||||
declare_target_with_modifiers(${MODIFIERS_LIST})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
declare_targets_for_build_mode(DEBUG)
|
||||
declare_targets_for_build_mode(RELEASE)
|
||||
declare_targets_for_build_mode(UNITTESTS)
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)e_acos.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_acos.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* acos(x)
|
||||
*
|
||||
* Method:
|
||||
@@ -36,8 +53,6 @@
|
||||
* Function needed: sqrt
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
|
||||
#define pi 3.14159265358979311600e+00 /* 0x400921FB, 0x54442D18 */
|
||||
#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)e_asin.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_asin.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* asin(x)
|
||||
*
|
||||
* Method:
|
||||
@@ -41,8 +58,6 @@
|
||||
* if |x|>1, return NaN with invalid signal.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
|
||||
#define huge 1.000e+300
|
||||
#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)s_atan.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_atan.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* atan(x)
|
||||
*
|
||||
* Method:
|
||||
@@ -32,8 +49,6 @@
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
static const double atanhi[] =
|
||||
{
|
||||
4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)e_atan2.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_atan2.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* atan2(y,x)
|
||||
*
|
||||
* Method:
|
||||
@@ -38,8 +55,6 @@
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define tiny 1.0e-300
|
||||
#define zero 0.0
|
||||
#define pi_o_4 7.8539816339744827900E-01 /* 0x3FE921FB, 0x54442D18 */
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)s_ceil.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_ceil.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* ceil(x)
|
||||
* Return x rounded toward -inf to integral value
|
||||
*
|
||||
@@ -21,8 +38,6 @@
|
||||
* Inexact flag raised if x not equal to ceil(x).
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define huge 1.0e300
|
||||
|
||||
double
|
||||
@@ -0,0 +1,40 @@
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_copysign.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* copysign(x,y) returns a value with the magnitude of x and
|
||||
* with the sign bit of y.
|
||||
*/
|
||||
|
||||
double
|
||||
copysign (double x, double y)
|
||||
{
|
||||
__HI (x) = (__HI (x) & 0x7fffffff) | (__HI (y) & 0x80000000);
|
||||
return x;
|
||||
} /* copysign */
|
||||
@@ -1,15 +1,32 @@
|
||||
|
||||
/* @(#)e_exp.c 1.6 04/04/22 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_exp.c 1.6 04/04/22
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* exp(x)
|
||||
* Returns the exponential of x.
|
||||
*
|
||||
@@ -73,8 +90,6 @@
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
static const double halF[2] =
|
||||
{
|
||||
0.5,
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_fabs.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* fabs(x) returns the absolute value of x.
|
||||
*/
|
||||
|
||||
double
|
||||
fabs (double x)
|
||||
{
|
||||
__HI (x) &= 0x7fffffff;
|
||||
return x;
|
||||
} /* fabs */
|
||||
@@ -0,0 +1,42 @@
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_finite.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* finite(x) returns 1 is x is finite, else 0;
|
||||
* no branching!
|
||||
*/
|
||||
|
||||
int
|
||||
finite (double x)
|
||||
{
|
||||
int hx;
|
||||
|
||||
hx = __HI (x);
|
||||
return (unsigned) ((hx & 0x7fffffff) - 0x7ff00000) >> 31;
|
||||
} /* finite */
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)s_floor.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_floor.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* floor(x)
|
||||
* Return x rounded toward -inf to integral value
|
||||
*
|
||||
@@ -21,8 +38,6 @@
|
||||
* Inexact flag raised if x not equal to floor(x).
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define huge 1.0e300
|
||||
|
||||
double
|
||||
@@ -1,24 +1,39 @@
|
||||
|
||||
/* @(#)e_fmod.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_fmod.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* fmod(x,y)
|
||||
* Return x mod y in exact arithmetic
|
||||
*
|
||||
* Method: shift and subtract
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
static const double Zero[] = { 0.0, -0.0, };
|
||||
|
||||
#define one 1.0
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef JERRY_FDLIBM_MATH_H
|
||||
#define JERRY_FDLIBM_MATH_H
|
||||
#ifndef JERRY_LIBM_MATH_H
|
||||
#define JERRY_LIBM_MATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@@ -79,4 +79,4 @@ double fmod (double, double);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* !__cplusplus */
|
||||
#endif /* !JERRY_FDLIBM_MATH_H */
|
||||
#endif /* !JERRY_LIBM_MATH_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_isnan.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* isnan(x) returns 1 is x is nan, else 0;
|
||||
* no branching!
|
||||
*/
|
||||
|
||||
int
|
||||
isnan (double x)
|
||||
{
|
||||
int hx, lx;
|
||||
|
||||
hx = (__HI (x) & 0x7fffffff);
|
||||
lx = __LO (x);
|
||||
hx |= (unsigned) (lx | (-lx)) >> 31;
|
||||
hx = 0x7ff00000 - hx;
|
||||
return ((unsigned) (hx)) >> 31;
|
||||
} /* isnan */
|
||||
@@ -1,15 +1,33 @@
|
||||
|
||||
/* @(#)fdlibm.h 1.5 04/04/22 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)fdlibm.h 1.5 04/04/22
|
||||
*/
|
||||
|
||||
#ifndef JERRY_LIBM_INTERNAL_H
|
||||
#define JERRY_LIBM_INTERNAL_H
|
||||
|
||||
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
|
||||
but these catch some common cases. */
|
||||
|
||||
@@ -29,28 +47,6 @@
|
||||
#define __LO(x) *(1 + (int *) &x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ANSI/POSIX
|
||||
*/
|
||||
|
||||
#define MAXFLOAT ((float) 3.40282346638528860e+38)
|
||||
|
||||
#define HUGE MAXFLOAT
|
||||
|
||||
/*
|
||||
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
|
||||
* (one may replace the following line by "#include <values.h>")
|
||||
*/
|
||||
|
||||
#define X_TLOSS 1.41484755040568800000e+16
|
||||
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
/*
|
||||
* ANSI/POSIX
|
||||
*/
|
||||
@@ -81,3 +77,5 @@ extern int finite (double);
|
||||
*/
|
||||
extern double copysign (double, double);
|
||||
extern double scalbn (double, int);
|
||||
|
||||
#endif /* !JERRY_LIBM_INTERNAL_H */
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)e_log.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_log.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* log(x)
|
||||
* Return the logrithm of x
|
||||
*
|
||||
@@ -62,8 +79,6 @@
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define zero 0.0
|
||||
#define ln2_hi 6.93147180369123816490e-01 /* 3fe62e42 fee00000 */
|
||||
#define ln2_lo 1.90821492927058770002e-10 /* 3dea39ef 35793c76 */
|
||||
@@ -1,15 +1,32 @@
|
||||
|
||||
/* @(#)e_pow.c 1.5 04/04/22 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_pow.c 1.5 04/04/22
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* pow(x,y) return x**y
|
||||
*
|
||||
* n
|
||||
@@ -55,8 +72,6 @@
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
static const double one = 1.0;
|
||||
static const double bp[] =
|
||||
{
|
||||
@@ -1,23 +1,38 @@
|
||||
|
||||
/* @(#)s_scalbn.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)s_scalbn.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* scalbn(x,n) returns x* 2**n computed by exponent
|
||||
* manipulation rather than by actually performing an
|
||||
* exponentiation or a multiplication.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define two54 1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */
|
||||
#define twom54 5.55111512312578270212e-17 /* 0x3C900000, 0x00000000 */
|
||||
#define huge 1.0e+300
|
||||
@@ -1,16 +1,33 @@
|
||||
|
||||
/* @(#)e_sqrt.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)e_sqrt.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
/* sqrt(x)
|
||||
* Return correctly rounded sqrt.
|
||||
*
|
||||
@@ -82,8 +99,6 @@
|
||||
* Other methods: see the appended file at the end of the program below.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#define one 1.0
|
||||
#define tiny 1.0e-300
|
||||
|
||||
@@ -1,24 +1,39 @@
|
||||
|
||||
/* @(#)k_rem_pio2.c 1.3 95/01/18 */
|
||||
/* @(#)e_rem_pio2.c 1.4 95/01/18 */
|
||||
/* @(#)k_sin.c 1.3 95/01/18 */
|
||||
/* @(#)k_cos.c 1.3 95/01/18 */
|
||||
/* @(#)k_tan.c 1.5 04/04/22 */
|
||||
/* @(#)s_sin.c 1.3 95/01/18 */
|
||||
/* @(#)s_cos.c 1.3 95/01/18 */
|
||||
/* @(#)s_tan.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
/* Copyright 2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is based on work under the following copyright and permission
|
||||
* notice:
|
||||
*
|
||||
* Copyright (C) 1993, 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* @(#)k_rem_pio2.c 1.3 95/01/18
|
||||
* @(#)e_rem_pio2.c 1.4 95/01/18
|
||||
* @(#)k_sin.c 1.3 95/01/18
|
||||
* @(#)k_cos.c 1.3 95/01/18
|
||||
* @(#)k_tan.c 1.5 04/04/22
|
||||
* @(#)s_sin.c 1.3 95/01/18
|
||||
* @(#)s_cos.c 1.3 95/01/18
|
||||
* @(#)s_tan.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
#include "jerry-libm-internal.h"
|
||||
|
||||
#define zero 0.00000000000000000000e+00 /* 0x00000000, 0x00000000 */
|
||||
#define half 5.00000000000000000000e-01 /* 0x3FE00000, 0x00000000 */
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2015 Samsung Electronics Co., Ltd.
|
||||
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -86,7 +86,7 @@ LINKFLAGS_eagle.app.v6 = \
|
||||
-L./libs \
|
||||
-ljerrycore \
|
||||
-ljerryentry \
|
||||
-lfdlibm \
|
||||
-ljerrylibm \
|
||||
$(DEP_LIBS_eagle.app.v6) \
|
||||
./libs/lib_a-setjmp.o \
|
||||
-Wl,--end-group
|
||||
@@ -96,7 +96,7 @@ DEPENDS_eagle.app.v6 = \
|
||||
$(LD_FILE) \
|
||||
$(LDDIR)/eagle.rom.addr.v6.ld \
|
||||
./source/jerry_targetjs.h \
|
||||
./libs/libfdlibm.a \
|
||||
./libs/libjerrylibm.a \
|
||||
./libs/libjerrycore.a \
|
||||
./libs/libjerryentry.a
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2015 Samsung Electronics Co., Ltd.
|
||||
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -74,8 +74,7 @@ jerry:
|
||||
make -C $(INTERM) $(TYPE).external
|
||||
cp `cat $(INTERM)/$(TYPE).external/list` $(OUTPUT)/.
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-core.a $(COPYTARGET)/libjerrycore.a
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-fdlibm.third_party.lib.a \
|
||||
$(COPYTARGET)/libfdlibm.a
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-libm.lib.a $(COPYTARGET)/libjerrylibm.a
|
||||
cp $(INTERM)/lib$(TYPE).external-entry.a $(OUTPUT)/.
|
||||
cp $(OUTPUT)/lib$(TYPE).external-entry.a $(COPYTARGET)/libjerryentry.a
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ index caf8e32..dadaceb 100644
|
||||
+ _jerry_text_start = ABSOLUTE(.);
|
||||
+ *\libjerryentry.a:*(.text*)
|
||||
+ *\libjerrycore.a:*(.text*)
|
||||
+ *\libfdlibm.a:*(.text*)
|
||||
+ *\libjerrylibm.a:*(.text*)
|
||||
+ _jerry_text_end = ABSOLUTE(.);
|
||||
+
|
||||
+ } >irom0_0_seg :irom0_0_phdr
|
||||
|
||||
@@ -51,7 +51,7 @@ jerry:
|
||||
make -C $(INTERM) $(TYPE).external
|
||||
cp `cat $(INTERM)/$(TYPE).external/list` $(OUTPUT)/.
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-core.a $(COPYTARGET)/libjerrycore.a
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-fdlibm.third_party.lib.a $(COPYTARGET)/libfdlibm.a
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-libm.lib.a $(COPYTARGET)/libjerrylibm.a
|
||||
|
||||
|
||||
js2c:
|
||||
|
||||
@@ -24,7 +24,7 @@ make -f targets/mbedk64f/Makefile.mbedk64f jerry
|
||||
|
||||
Two files will be generated at `targets/mbedk64f/libjerry`
|
||||
* libjerrycore.a
|
||||
* libfdlibm.a
|
||||
* libjerrylibm.a
|
||||
|
||||
#### Building mbed binary
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2015 Samsung Electronics Co., Ltd.
|
||||
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,6 @@ set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS}
|
||||
# link jerryscript
|
||||
set(LJPATH ${CMAKE_CURRENT_LIST_DIR}/../libjerry)
|
||||
set(LJFILES "")
|
||||
set(LJFILES ${LJFILES} ${LJPATH}/libfdlibm.a)
|
||||
set(LJFILES ${LJFILES} ${LJPATH}/libjerrylibm.a)
|
||||
set(LJFILES ${LJFILES} ${LJPATH}/libjerrycore.a)
|
||||
target_link_libraries(${MBEDMODULE} ${LJFILES})
|
||||
|
||||
@@ -51,8 +51,7 @@ all:
|
||||
make -C $(INTERM) $(TYPE).external
|
||||
cp `cat $(INTERM)/$(TYPE).external/list` $(OUTPUT)/.
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-core.a $(COPYTARGET)/libjerrycore.a
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-fdlibm.third_party.lib.a \
|
||||
$(COPYTARGET)/libfdlibm.a
|
||||
cp $(OUTPUT)/lib$(TYPE).jerry-libm.lib.a $(COPYTARGET)/libjerrylibm.a
|
||||
cp $(INTERM)/lib$(TYPE).external-entry.a $(OUTPUT)/.
|
||||
cp $(OUTPUT)/lib$(TYPE).external-entry.a $(COPYTARGET)/libjerryentry.a
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ Make will copy three library files to `nuttx/nuttx/lib` folder
|
||||
```
|
||||
libjerryentry.a
|
||||
libjerrycore.a
|
||||
libfdlibm.a
|
||||
libjerrylibm.a
|
||||
```
|
||||
|
||||
In NuttX, if you run `make clean`, above library files are also removed so you
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#include "fdlibm-math.h"
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unit test for fdlibm
|
||||
* Unit test for jerry-libm
|
||||
*/
|
||||
|
||||
#include "test-common.h"
|
||||
@@ -77,7 +77,7 @@ main (int __attr_unused___ argc,
|
||||
char __attr_unused___ **argv)
|
||||
{
|
||||
#define INF INFINITY
|
||||
#include "test-fdlibm.inc.h"
|
||||
#include "test-libm.inc.h"
|
||||
|
||||
return passed ? 0 : 1;
|
||||
} /* main */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Generated by tools/gen-test-fdlibm.sh
|
||||
* Generated by tools/gen-test-libm.sh
|
||||
* DO NOT EDIT!!!
|
||||
*/
|
||||
check_double ("acos (0.0)", acos (0.0), 1.57079632679489655800E+00);
|
||||
Vendored
-76
@@ -1,76 +0,0 @@
|
||||
# Copyright 2015 Samsung Electronics Co., Ltd.
|
||||
# Copyright 2015 University of Szeged.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
project (jerry_fdlibm C)
|
||||
|
||||
# Compiler / linker flags
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_JERRY} ${C_FLAGS_JERRY}")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=parentheses")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=sign-compare")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=sign-conversion")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=strict-aliasing")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=unknown-pragmas")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=missing-declarations")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=maybe-uninitialized")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=unused-but-set-variable")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=unused-variable")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-error=conversion")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-sign-conversion")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-sign-compare")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-parentheses")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-maybe-uninitialized")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-unknown-pragmas")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-unused-but-set-variable")
|
||||
set(COMPILE_FLAGS_FDLIBM "${COMPILE_FLAGS_FDLIBM} -Wno-unused-variable")
|
||||
|
||||
# Include directories
|
||||
set(INCLUDE_FDLIBM ${CMAKE_SOURCE_DIR}/third-party/fdlibm/include)
|
||||
set(INCLUDE_FDLIBM ${INCLUDE_FDLIBM} PARENT_SCOPE)
|
||||
|
||||
# Source directories
|
||||
file(GLOB SOURCE_FDLIBM *.c)
|
||||
|
||||
add_custom_target (jerry-fdlibm-all)
|
||||
|
||||
# Targets declaration
|
||||
function(declare_targets_for_build_mode BUILD_MODE)
|
||||
set(TARGET_NAME ${BUILD_MODE_PREFIX_${BUILD_MODE}})
|
||||
|
||||
function(declare_target_with_modifiers ) # modifiers are passed in ARGN implicit argument
|
||||
foreach(MODIFIER ${ARGN})
|
||||
set(TARGET_NAME ${TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}})
|
||||
endforeach()
|
||||
|
||||
add_library(${TARGET_NAME}.jerry-fdlibm${SUFFIX_THIRD_PARTY_LIB} STATIC ${SOURCE_FDLIBM})
|
||||
set_property(TARGET ${TARGET_NAME}.jerry-fdlibm${SUFFIX_THIRD_PARTY_LIB}
|
||||
PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_FDLIBM}")
|
||||
target_include_directories(${TARGET_NAME}.jerry-fdlibm${SUFFIX_THIRD_PARTY_LIB} PRIVATE ${INCLUDE_FDLIBM})
|
||||
|
||||
if("${BUILD_MODE}" STREQUAL "UNITTESTS")
|
||||
target_include_directories(${TARGET_NAME}.jerry-fdlibm${SUFFIX_THIRD_PARTY_LIB} INTERFACE ${INCLUDE_FDLIBM})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
foreach(MODIFIERS_LIST ${MODIFIERS_LISTS})
|
||||
separate_arguments(MODIFIERS_LIST)
|
||||
|
||||
declare_target_with_modifiers(${MODIFIERS_LIST})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
declare_targets_for_build_mode(DEBUG)
|
||||
declare_targets_for_build_mode(RELEASE)
|
||||
declare_targets_for_build_mode(UNITTESTS)
|
||||
Vendored
-25
@@ -1,25 +0,0 @@
|
||||
|
||||
/* @(#)s_copysign.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/* copysign(x,y) returns a value with the magnitude of x and
|
||||
* with the sign bit of y.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
double
|
||||
copysign (double x, double y)
|
||||
{
|
||||
__HI (x) = (__HI (x) & 0x7fffffff) | (__HI (y) & 0x80000000);
|
||||
return x;
|
||||
} /* copysign */
|
||||
Vendored
-24
@@ -1,24 +0,0 @@
|
||||
|
||||
/* @(#)s_fabs.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/* fabs(x) returns the absolute value of x.
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
double
|
||||
fabs (double x)
|
||||
{
|
||||
__HI (x) &= 0x7fffffff;
|
||||
return x;
|
||||
} /* fabs */
|
||||
Vendored
-27
@@ -1,27 +0,0 @@
|
||||
|
||||
/* @(#)s_finite.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/* finite(x) returns 1 is x is finite, else 0;
|
||||
* no branching!
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
int
|
||||
finite (double x)
|
||||
{
|
||||
int hx;
|
||||
|
||||
hx = __HI (x);
|
||||
return (unsigned) ((hx & 0x7fffffff) - 0x7ff00000) >> 31;
|
||||
} /* finite */
|
||||
Vendored
-30
@@ -1,30 +0,0 @@
|
||||
|
||||
/* @(#)s_isnan.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/* isnan(x) returns 1 is x is nan, else 0;
|
||||
* no branching!
|
||||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
int
|
||||
isnan (double x)
|
||||
{
|
||||
int hx, lx;
|
||||
|
||||
hx = (__HI (x) & 0x7fffffff);
|
||||
lx = __LO (x);
|
||||
hx |= (unsigned) (lx | (-lx)) >> 31;
|
||||
hx = 0x7ff00000 - hx;
|
||||
return ((unsigned) (hx)) >> 31;
|
||||
} /* isnan */
|
||||
@@ -25,9 +25,10 @@ fi
|
||||
|
||||
JERRY_CORE_DIRS=`find jerry-core -type d`
|
||||
JERRY_LIBC_DIRS=`find jerry-libc -type d`
|
||||
JERRY_LIBM_DIRS=`find jerry-libm -type d`
|
||||
|
||||
INCLUDE_DIRS=()
|
||||
for DIR in $JERRY_CORE_DIRS $JERRY_LIBC_DIRS
|
||||
for DIR in $JERRY_CORE_DIRS $JERRY_LIBC_DIRS $JERRY_LIBM_DIRS
|
||||
do
|
||||
INCLUDE_DIRS=("${INCLUDE_DIRS[@]}" "-I$DIR")
|
||||
done
|
||||
@@ -38,4 +39,4 @@ cppcheck -j$CPPCHECK_JOBS --force \
|
||||
--error-exitcode=1 \
|
||||
--exitcode-suppressions=tools/cppcheck/suppressions-list \
|
||||
"${INCLUDE_DIRS[@]}" \
|
||||
jerry-core jerry-libc *.c *h tests/unit
|
||||
jerry-core jerry-libc jerry-libm *.c *h tests/unit
|
||||
|
||||
+2
-1
@@ -17,9 +17,10 @@
|
||||
|
||||
JERRY_CORE_FILES=`find ./jerry-core -name "*.c" -or -name "*.h"`
|
||||
JERRY_LIBC_FILES=`find ./jerry-libc -name "*.c" -or -name "*.h"`
|
||||
JERRY_LIBM_FILES=`find ./jerry-libm -name "*.c" -or -name "*.h"`
|
||||
JERRY_MAIN_FILES=`find . -maxdepth 1 -name "*.c" -or -name "*.h"`
|
||||
UNIT_TEST_FILES=`find ./tests/unit -name "*.c" -or -name "*.h"`
|
||||
|
||||
vera++ -r tools/vera++ -p jerry \
|
||||
-e --no-duplicate \
|
||||
$JERRY_CORE_FILES $JERRY_LIBC_FILES $JERRY_MAIN_FILES $UNIT_TEST_FILES
|
||||
$JERRY_CORE_FILES $JERRY_LIBC_FILES $JERRY_LIBM_FILES $JERRY_MAIN_FILES $UNIT_TEST_FILES
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
operatorEqVarError
|
||||
noConstructor
|
||||
duplicateExpression
|
||||
wrongmathcall:tests/unit/test-fdlibm.inc.h
|
||||
wrongmathcall:tests/unit/test-libm.inc.h
|
||||
variableScope:jerry-libm/*.c
|
||||
invalidPointerCast:jerry-libm/*.c
|
||||
unreadVariable:jerry-libm/*.c
|
||||
|
||||
// FIXME: false positive in cppcheck 1.61 (will disappear once distro ships with 1.69)
|
||||
variableScope:jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
# limitations under the License.
|
||||
|
||||
make -C tools/unit-tests build
|
||||
tools/unit-tests/gen-test-fdlibm >tests/unit/test-fdlibm.inc.h
|
||||
tools/unit-tests/gen-test-libm >tests/unit/test-libm.inc.h
|
||||
make -C tools/unit-tests clean
|
||||
@@ -16,7 +16,7 @@
|
||||
CC=gcc
|
||||
LDFLAGS=-lm
|
||||
|
||||
GENS=gen-test-fdlibm
|
||||
GENS=gen-test-libm
|
||||
|
||||
.PHONY: build
|
||||
build: $(GENS)
|
||||
@@ -25,5 +25,5 @@ build: $(GENS)
|
||||
clean:
|
||||
rm -f $(GENS)
|
||||
|
||||
gen-test-fdlibm: gen-test-fdlibm.c
|
||||
gen-test-libm: gen-test-libm.c
|
||||
$(CC) $< -o $@ $(LDFLAGS)
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Unit test generator for fdlibm.
|
||||
* Unit test generator for jerry-libm.
|
||||
* To be compiled separately from the rest of jerry and to be linked to a trusted libm.
|
||||
* Its output should be redirected to test-fdlibm.inc.h.
|
||||
* Its output should be redirected to test-libm.inc.h.
|
||||
*
|
||||
* Example:
|
||||
* gcc gen-test-fdlibm.c -o gen-test-fdlibm -lm
|
||||
* ./gen-test-fdlibm >test-fdlibm.inc.h
|
||||
* gcc gen-test-libm.c -o gen-test-libm -lm
|
||||
* ./gen-test-libm >test-libm.inc.h
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
@@ -34,7 +34,7 @@ int
|
||||
main (int argc, char **args)
|
||||
{
|
||||
printf ("/*\n"
|
||||
" * Generated by tools/gen-test-fdlibm.sh\n"
|
||||
" * Generated by tools/gen-test-libm.sh\n"
|
||||
" * DO NOT EDIT!!!\n"
|
||||
" */\n");
|
||||
|
||||
@@ -211,7 +211,7 @@ main (int argc, char **args)
|
||||
GEN_DBL_TEST (ceil (-7.37e+19));
|
||||
|
||||
/* copysign tests */
|
||||
/* SKIPPED: not declared in fdlibm-math.h
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
GEN_DBL_TEST (copysign (0.0, 0.0));
|
||||
GEN_DBL_TEST (copysign (0.0, -0.0));
|
||||
GEN_DBL_TEST (copysign (-0.0, 0.0));
|
||||
@@ -314,7 +314,7 @@ main (int argc, char **args)
|
||||
GEN_DBL_TEST (fabs (-7.37e+19));
|
||||
|
||||
/* finite tests */
|
||||
/* SKIPPED: not declared in fdlibm-math.h
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
GEN_INT_TEST (finite (0.0));
|
||||
GEN_INT_TEST (finite (-0.0));
|
||||
GEN_INT_TEST (finite (1.0));
|
||||
@@ -553,7 +553,7 @@ main (int argc, char **args)
|
||||
GEN_DBL_TEST (pow (0.7, 1.2));
|
||||
|
||||
/* scalbn tests */
|
||||
/* SKIPPED: not declared in fdlibm-math.h
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
GEN_DBL_TEST (scalbn (0.0, 0));
|
||||
GEN_DBL_TEST (scalbn (-0.0, 0));
|
||||
GEN_DBL_TEST (scalbn (0.0, 1));
|
||||
Reference in New Issue
Block a user