On Thu, Mar 15, 2012 at 8:48 AM, Laurent <[email protected]> wrote:
>
>> and it would not make very much sense to provide a method for this
>> class to test for integrality, since every such element is an Integer
>> by definition.  I suspect that in your intended application, A will be
>> the result of come computation resulting in a real number, and you
>> want to test whether it is (at least approximately) integral.  Here
>> are some ideas:
>
>
> You are guessing almost right.
> In my case A is an user-given angle value that will be passed to
> trigonometric functions.
> I want to guess if the user gave radiant or degree.
> My first test if
>
> if "pi" in repr(A)
>
> I cannot believe that someone will provide an angle with "pi" in degree. In
> that case, I deal with A as radian.
>
> Then my second test is to see if A is integer. One almost never deal with
> integer radian. So if the A is integer, I will deal with it as degree.
>
> I'm expecting some problems with degree values given as
> pi/2 * 180/pi
> (result of a conversion)
>
>
> But well, up to now my function works :)

You'd want to make sure this behavior is well documented, otherwise it
could have unexpected behavior (e.g. what happens if you try to plot
it? Is 10.5 treated as a degree or radian?)

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to