Ticket #12089: 0001-Fix-Errors-in-Why-Homogeneous-Systems.patch

File 0001-Fix-Errors-in-Why-Homogeneous-Systems.patch, 1.4 KB (added by Chris Lesiak <chris.lesiak@…>, 7 years ago)

Patch

  • doc/units.qbk

    From 62665bb2942152e023cec00387912a2f7b00ed4a Mon Sep 17 00:00:00 2001
    From: Chris Lesiak <chris.lesiak@licor.com>
    Date: Tue, 22 Mar 2016 10:26:04 -0500
    Subject: [PATCH] Fix Errors in Why Homogeneous Systems
    
    The FAQ entry on homogeneous systems asks the reader to consider the
    following:
    
    cout << sin(asin(180.0 * degrees));
    
    There are two problems with this:
    1.  It won't compile because asin does not take an angle.
    2.  Even with the order of asin and sin swapped, the example is
        confusing because it isn't clear if the results should be
        180 degrees, or 0 degrees.
    
    Improve the explanation by swapping sin and asin and using 90 degrees.
    ---
     doc/units.qbk | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/doc/units.qbk b/doc/units.qbk
    index 618212f..0c7345f 100644
    a b radians instead...)  
    12041204
    12051205Consider the following code:
    12061206
    1207     cout << sin(asin(180.0 * degrees));
     1207    cout << asin(sin(90.0 * degrees));
    12081208
    12091209What should this print?  If only heterogeneous
    1210 systems are available it would print 3.14159+ rad
    1211 Why?  Well, `asin` would return a `quantity<dimensionless>`
     1210systems are available it would print 1.5708 rad
     1211Why?  Well, `sin` would return a `quantity<dimensionless>`
    12121212effectively losing the information that degrees
    12131213are being used.  In order to propogate this extra information
    12141214we need homogeneous systems.