JuliaLang/julia

Proposal: expose flags set by floating-point exceptions

开放

#2,976 创建于 2013年4月30日

 (13 条评论) (0 个反应) (0 位负责人)Julia (5,773 个派生)batch import
help wantedmaths

仓库指标

星标
 (48,709 个星标)
PR 合并指标
 (平均合并 20天 6小时) (30 天内合并 157 个 PR)

描述

There is currently no Base function that allows users to check for the flags set by floating-point operations.1 This does not allow the user to compute in a fully IEEE-compatible manner and could decrease code legibility should the user be forced to test implicitly for a raised flag by inspecting the consequences of the computation.

This continues a discussion started in #2085, and extends the concept of overflow checking proposed for integers in #855.

  • Detect the five flags raised by floating-point exceptions
    • Invalid
    • Division by zero
    • Overflow
    • Underflow
    • Inexact
  • Allow the floating-point rounding mode to be set:
    • round to nearest, ties round to the nearest even digit in the required position
    • round to nearest, ties round away from zero
    • round up toward Inf
    • round down toward -Inf
    • round toward 0
  • [ ] Honor the difference between quiet and signaling NaNs
  • Expose similar flag-handling behavior from MPFR

cc: @andrioni @JeffBezanson

贡献者指南