[PATCH] D146900: [docs][LangRef] Added minor update inside the `frem`. Fix : #61653

Tiwari Abhinav Ashok Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 26 07:36:03 PDT 2023


aabhinavg added inline comments.


================
Comment at: llvm/docs/LangRef.rst:9603
 This is the same output as a libm '``fmod``' function, but without any
 possibility of setting ``errno``. The remainder has the same sign as the
 dividend.
----------------
RKSimon wrote:
> This doesn't seem to match with what you've added above - is x86 setting errno?
the ‘frem’ instruction is commonly used in the implementation of mathematical functions in the standard C library, known as libm. The libm library provides a wide range of mathematical functions, such as trigonometric functions, logarithmic functions, exponential functions, and more.

The implementation of these functions often involves the use of the ‘frem’ instruction to calculate remainders, which are used in various computations. For example, the implementation of the trigonometric function ‘sine’ typically involves computing the remainder of the angle divided by 2π, which can be done using the ‘frem’ instruction.

Overall, the ‘frem’ instruction is a fundamental building block for many mathematical functions in libm and is a crucial part of many numerical computations in general.

‘frem’ instruction itself does not set ‘errno’ on x86 systems, but errors can be detected by checking the result of the instruction or examining the floating-point status flags.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146900/new/

https://reviews.llvm.org/D146900



More information about the llvm-commits mailing list