From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 11C8319C026F for ; Fri, 20 Nov 2015 07:24:40 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id F32FDB5D847 for ; Fri, 20 Nov 2015 07:55:29 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 06BFD18CC7B2 for ; Fri, 20 Nov 2015 07:55:30 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8C7C412046A; Fri, 20 Nov 2015 07:55:28 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 485DD120440 for ; Fri, 20 Nov 2015 07:55:24 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=DEtzGmYWHxPti0nhYmBsmbFR7oM=; b=TT51oInpk/LCMTZU5L IsOuDz16VtxcbZ1SApgyk6Yh7uVrCDh+CtVfUCXUrRr2weROP8DBvfYYq87YoBhs Kvn+efisSrDlvPi9A+nbxW8QjC/l8vGdu+j1BGgfO7j6mJU9NBbecfpuX4JOTPuX 9xXzn43Ijlwi1wmNzt4md3sm0= Received: by filter0886p1mdw1.sendgrid.net with SMTP id filter0886p1mdw1.31678.564E535826 2015-11-19 22:55:20.315891486 +0000 UTC Received: from herokuapp.com (ec2-54-204-92-183.compute-1.amazonaws.com [54.204.92.183]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id tLP6LjUdRZ-vVshsFwDlDQ for ; Thu, 19 Nov 2015 22:55:20.397 +0000 (UTC) Date: Thu, 19 Nov 2015 22:55:20 +0000 From: akr@fsij.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 46257 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11716 X-Redmine-Issue-Author: niroyb X-Redmine-Sender: akr X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4rIqidPbJlWkkz2n+doemTjUbswE/tRavcUY Z8tvpjlwMpkcrUidUbm7zKZKaDM/eqy/oXzaieWOA7Sotu4KdEElMS7DPSxFo6HUk2AYD7UpO0/P2u SUdDGPOLzQ7jJPpc9sjKE2f26YI4zYhVCdP6 X-ML-Name: ruby-core X-Mail-Count: 71592 Subject: [ruby-core:71592] [Ruby trunk - Bug #11716] [Rejected] Truncation error in Time xmlschema with fraction_digits. X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11716 has been updated by Akira Tanaka. Status changed from Open to Rejected It's because 1447961542.26 is actually 1447961542.2599999904632568359375. ``` % ruby -e 'p "%.1000g" % 1447961542.26' "1447961542.2599999904632568359375" ``` If 1447961542.26 is exactly given as rational, xmlschema(2) generates ".26" as the fractional part. ``` % ruby -rtime -e 'p Time.at(1447961542.26).xmlschema(2)' "2015-11-20T04:32:22.25+09:00" % ruby -rtime -e 'p Time.at(1447961542.26r).xmlschema(2)' "2015-11-20T04:32:22.26+09:00" ``` ---------------------------------------- Bug #11716: Truncation error in Time xmlschema with fraction_digits. https://bugs.ruby-lang.org/issues/11716#change-54975 * Author: Nick R * Status: Rejected * Priority: Normal * Assignee: * ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- It looks like xmlschema with the fraction_digits parameter truncates the fractional second part. Sometimes it truncates too much. ex : 1447961542.26 with 2 fraction digits gives 1447961542.25 instead of 1447961542.26 Could be due to floating point representation. But tests seem to indicate otherwise. `$ irb $ require 'time' => true $ Time.at(1447961542.26).xmlschema(2) => "2015-11-19T11:32:22.25-08:00" $ Time.at(1447961542.269).xmlschema(2) => "2015-11-19T11:32:22.26-08:00" $ Time.at(1447961542.259).xmlschema(2) => "2015-11-19T11:32:22.25-08:00" $ Time.at(1447961542.25).xmlschema(2) => "2015-11-19T11:32:22.25-08:00" $ 1447961542.26*100.floor => 144796154226.0 ` -- https://bugs.ruby-lang.org/