<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>9574</bug_id>
          
          <creation_ts>2010-04-22 01:47:09 +0000</creation_ts>
          <short_desc>Floating point number tolerance</short_desc>
          <delta_ts>2010-10-05 12:58:55 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML Canvas 2D Context (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NEEDSINFO</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>LC</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jatinder Mann [MSFT]">jmann</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>35203</commentid>
    <comment_count>0</comment_count>
    <who name="Jatinder Mann [MSFT]">jmann</who>
    <bug_when>2010-04-22 01:47:09 +0000</bug_when>
    <thetext>http://lists.w3.org/Archives/Public/public-canvas-api/2010AprJun/0005.html

From: public-canvas-api-request@w3.org [mailto:public-canvas-api-request@w3.org] On Behalf Of Jatinder Mann
Sent: Wednesday, April 14, 2010 12:01 PM
To: public-canvas-api@w3.org
Subject: Floating point number tolerance

I  came across an issue regarding floating point numbers. The specification doesn&apos;t clearly define how close two floating point numbers have to be before they are considered the same number. 

For example, the following code may result in either a tiny arc or a complete circle, depending on how the user agent implement floating point tolerance:

0 ctx.lineWidth = 1; 
1 var diff = 0.01;
2 ctx.beginPath(); 
3 ctx.arc(100, 100, 100, 0, 2*Math.PI-diff, true); 
4 ctx.stroke();

In my testing, Chrome, Firefox, Opera and Safari all show a tiny arc with this code. 

If the diff variable is changed to 0.001, all the above mentioned browsers show nothing. However, if the diff variable is changed to 0.00000001 Chrome, Firefox and Safari will show a full circle (treat the number as 0). Opera on the other hand will show a full circle when the diff variable is 0.0000000000000001.

This same issue of tolerance applies to serialization of color, strokeRect(), closePath()  and arc() functions. The spec should define how close two numbers need to be before they are considered the same number.

Thank you,
Jatinder

Jatinder Mann | Microsoft Program Manager | jmann@microsoft.com</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37110</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-07-27 20:51:51 +0000</bug_when>
    <thetext>Philip mentions:
http://lists.w3.org/Archives/Public/public-html/2008Apr/0770.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38699</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-09-08 22:19:41 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale:

In the case of arc(), the spec is defined in terms of the difference between the angles, so I don&apos;t see how the code above could ever give a small arc, for any small value of diff.

In general, though, isn&apos;t this defined by IEEE 754? I don&apos;t understand what you want the spec to say.

I can&apos;t work out the relevance of this to serialization of color, strokeRect(), and closePath().</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>