[ruby-cvs:72868] shyouhei:r65768 (trunk): pack.c: cast from double to float can be undefined

shyouhei at ruby-lang.org shyouhei at ruby-lang.org
Fri Nov 16 18:04:34 JST 2018


shyouhei	2018-11-16 18:04:34 +0900 (Fri, 16 Nov 2018)

  New Revision: 65768

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65768

  Log:
    pack.c: cast from double to float can be undefined
    
    Generally speaking, a value of double is not always representable
    when demoted to a float. ISO C defines what to do when such
    conversion loses precision, but leaves it undefined when the
    value is completely out of range. (cf: ISO/IEC 9899:1990 section
    6.2.1.4).
    
    Because ruby do not have half-precision floating-point types this
    is not a frequent headache but for pack / unpack, there are
    specifiers that has something to do with C float types.  We have
    to explicitly care these situations.

  Modified files:
    trunk/pack.c


More information about the ruby-cvs mailing list