[NOOB] Finding Information (was: real noob question)

  • On Jan 18, 2009, at 1:06 AM, Rob Keniger wrote:

    > On 18/01/2009, at 11:18 AM, Darren Stuart wrote:
    >
    >> Hi there, sorry for the real noobish question but I can't figure
    >> this out or find an answer.
    >>
    >> I have a variable called myMoney and its a NSDecimalNumber and I
    >> want to set init it with the value of 23.30.
    >>
    >> NSDecimalNumber *myMoney =  [[NSDecimalNumber alloc] init];
    >>
    >> If this is the wrong place to post this sort of question please can
    >> someone point to such a place.
    >>
    >> Kind Regards
    >>
    >> Darren
    >
    > You can't find an answer - have you had a look at the documentation?
    > It's right there.
    >
    > http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes
    /NSDecimalNumber_Class/Reference/Reference.html


    Sometimes to the newbie it may seem astounding that experienced Cocoa
    programmers can snap back with specific references. These are not
    really that difficult to find. Might I suggest an address to keep in
    mind for searching for information:

    http://developer.apple.com/cocoa

    Then use the search box in the upper right.

    In regard to the OP's query, I entered "creating a decimal number"
    The lead result is the NSDecimalNumberHandler Class Reference, as a
    PDF, as documented for iPhone, and as having the link Rob reported
    above.
  • On 19/01/2009 9:47 AM, Stuart Malin wrote:
    >> You can't find an answer - have you had a look at the documentation?
    >> It's right there.
    >>
    >> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes
    /NSDecimalNumber_Class/Reference/Reference.html

    >>
    >
    > Sometimes to the newbie it may seem astounding that experienced Cocoa
    > programmers can snap back with specific references. These are not
    > really that difficult to find. Might I suggest an address to keep in
    > mind for searching for information:
    >
    > http://developer.apple.com/cocoa

    Excellent tip! Also check out http://developer.apple.com/mac/ (Which I
    seem to have automatic access to because I signed up to the iphone dev site)

    -jacob
  • On 19 Jan 2009, at 00:21, Stuart Malin <stuart...> wrote:
    > On Jan 18, 2009, at 1:06 AM, Rob Keniger wrote:
    >
    >> On 18/01/2009, at 11:18 AM, Darren Stuart wrote:
    >>
    >>> Hi there, sorry for the real noobish question but I can't figure
    >>> this out or find an answer.
    >>>
    >>> I have a variable called myMoney and its a NSDecimalNumber and I
    >>> want to set init it with the value of 23.30.
    >>>
    >>> NSDecimalNumber *myMoney =  [[NSDecimalNumber alloc] init];
    >>>
    >>> If this is the wrong place to post this sort of question please can
    >>> someone point to such a place.
    >>>
    >>> Kind Regards
    >>>
    >>> Darren
    >>
    >> You can't find an answer - have you had a look at the documentation?
    >> It's right there.
    >>
    >> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes
    /NSDecimalNumber_Class/Reference/Reference.html

    >
    > Sometimes to the newbie it may seem astounding that experienced Cocoa
    > programmers can snap back with specific references. These are not
    > really that difficult to find. Might I suggest an address to keep in
    > mind for searching for information:
    >
    > http://developer.apple.com/cocoa
    >
    > Then use the search box in the upper right.
    >
    > In regard to the OP's query, I entered "creating a decimal number"
    > The lead result is the NSDecimalNumberHandler Class Reference, as a
    > PDF, as documented for iPhone, and as having the link Rob reported
    > above.

    I too followed up on the example link which took me to the top of the
    NSDecimalNumber Class reference document. Scrolling down the first
    thing I came accross under Tasks was "Creating a Decimal Number" and
    just beneath that a link to
    + decimalNumberWithDecimal:
    which looked exactly like what the OP was asking for, viz:
    <>
    Creates and returns an NSDecimalNumber object equivalent to a given
    NSDecimal structure.
    + (NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)decimal>
    </>

    Ah, and look perhaps I don't need to use an alloc....
    Now with all respect to the writers of this documentation, my first
    question is "what is a decimal structure?". Now I think I know what a
    "decimal structure" might be,  namely a number written using the
    decimal notation - is that with or without decimal points?
    I followed up on  NSDecimal and obtained:
    <>
    NSDecimal
    Used to describe a decimal number.
    typedef struct {
        signed int _exponent:8;
        unsigned int _length:4;
        unsigned int _isNegative:1;
        unsigned int _isCompact:1;
        unsigned int _reserved:18;
        unsigned short _mantissa[NSDecimalMaxSize];
    } NSDecimal;
    </>

    Scareeeeeee!!!! and nothing like what I thought it might be.
    Of course, I should have seen the bracketed NSDecimal in front of the
    "decimal" alerting me to the fact that this was either a cocoa object
    or C struct, and hence the use of the word "structure". Indeed the
    very use of an unsusual word like structure should have alerted me to
    the fact that this was not an english language construct that was
    being denoted but rather a "data structure" or more accurately a
    struct data type. But as you can see, even after a year and a half of
    looking through this documentation I am still able to make basic
    mistakes in literacy. I have had reason to think about this quite
    frequently and have come to the conclusion that there is nothing
    simple or straightforward about writing easy to use technical manuals.
    One of the main problems it seems to me occurs when I'm trying to get
    quickly to an answer and rather than read and digest every word of the
    manual (how many hours might that take?) I scan looking for key words
    that I hope will take me in the desired direction. It often seems to
    me that we fail to take human psychology sufficiently into account
    when designing such documents And somewhere in all that searching
    through a manual I think we can get waylaid by phoenomena not unlike
    those relating to "inattentional blindness" or "change blindness". For
    instance take a look at this video to see just how fragile is our
    ability to attend.

    http://www.youtube.com/watch?v=voAntzB7EwE&eurl

    and the set of videos here
    http://viscog.beckman.uiuc.edu/djs_lab/demos.html

    with discussions of the phenomena here
    http://www.skepdic.com/inattentionalblindness.html
    http://www.skepdic.com/changeblindness.html

    and of the unwelcome effects of this in the inspection of complex
    systems
    http://www.inspect-ny.com/vision/vision.htm

    O.K. lets leave that and go back to  see if we can find something that
    looks a bit more like the OP's number : 23.30.

    The next heading beneath "Creating a Decimal Number" is "Initializing
    a Decimal Number" and head of the list is
    <>
    – initWithDecimal:
    </>

    That looks promising.. but
    <>
    initWithDecimal:
    Returns an NSDecimalNumber object initialized to represent a given
    decimal.
    - (id)initWithDecimal:(NSDecimal)decimal>
    </>

    No good: there's that NSDecimal again, but note that this time it is
    not described as a structure but as a "decimal" !!!!
    Back to the top of the list:
    <>
    Initializing a Decimal Number
        * – initWithDecimal:
        * – initWithMantissa:exponent:isNegative:
        * – initWithString:
        * – initWithString:locale:
    </>

    But there is nothing here that looks anything like it would allow me
    to intialise with a numeric value like 23.30.
    What about – initWithString: could we write something like this:
    x = [decimalObject initWithString:"23.30"];

    Looks good
    <>
    - (id)initWithString:(NSString *)numericString
    </>

    But to check that this is the method for us follow the link that comes
    with NSString and which takes us to the top of its class reference.
    Well there's a lot to get through there before we get to the list of
    Tasks and even then...

    I'll stop here. My point is that learning a system via the manual is
    not the easiest thing in the world and just pointing people at
    specific pages in the manual though helpful is not always necessarily
    the best way of doing things. The fact is that Cocoa is a very
    sophisticated system which allows for very sophisticated programming
    usage and it is the manner of that usage which is frequently less than
    obvious in the documentation and which is frequently essential to
    one's ability to understand what is being described.

    So what is a simple answer to the OP's question?
    Does x = [decimalObject initWithString:"23.30"]; actually work?

    Go into XCode and sdo XCode->New Project -> Cocoa project and modify
    main so it looks like this

    int main(int argc, char *argv[])
    {
        NSDecimalNumber *myDecimalObj    = [[NSDecimalNumber
    alloc]initWithString:@"23.30"];
        NSLog(@"myDecimalObj doubleValue=%6.3f",[myDecimalObj
    doubleValue]);

    }
    and Run. Here is the log
    2009-01-19 12:25:06.479 test[384:10b] myDecimalObj doubleValue=23.300

    Yep. It works. Now I know. But is that what the OP was actually after
    or was the 23.3 simply an example of a  numeric value? Even now I'm
    not clear whether I could create a decimal number with a double , e.g.
    something like
    cGFloatValue = 23.3;
    NSDecimalNumber *myDecimalObj    = [[NSDecimalNumber
    alloc]initWithDouble: cGFloatValue];

    Quickly returning to the NSDecimalNumber documentation I see nothing
    obvious, not without a few contortions. Why is there no simple
    initialisation of this kind I wonder? So why would one want to use
    NSDecimalNumber anyway, just as a means of converting string input or
    formatting strings in the output? No idea. Where would I use this
    "object-oriented wrapper for doing base-10 arithmetic"?  Is it to
    handle really long numbers? e.g.
    http://www.dzone.com/links/cocoa_tutorial_dont_be_lazy_with_nsdecimalnumber
    .html


    But then
    http://cocoawithlove.com/2008/05/square-root-numerical-fun-with.html
    says "Sadly, NSDecimalNumber does not appear to be written for the
    mathematically or scientifically inclined. Its operators are mostly
    limited to basic arithmetic".

    One of those imponderable mysteries I guess. But someone must have
    thought it worthwhile.... so why not say so in the documentation?

    Julius

    http://juliuspaintings.co.uk
  • On Jan 19, 2009, at 6:10 AM, julius wrote:

    > I too followed up on the example link which took me to the top of
    > the NSDecimalNumber Class reference document. Scrolling down the
    > first thing I came accross under Tasks was "Creating a Decimal
    > Number" and just beneath that a link to
    > + decimalNumberWithDecimal:
    > which looked exactly like what the OP was asking for, viz:
    > <>
    > Creates and returns an NSDecimalNumber object equivalent to a given
    > NSDecimal structure.
    > + (NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)decimal>
    > </>
    > Ah, and look perhaps I don't need to use an alloc....
    > Now with all respect to the writers of this documentation, my first
    > question is "what is a decimal structure?".
    >
    Typically here I would either click the link to NSDecimal in the
    method declaration, or go to the Companion Guide listed at the top of
    the API reference.
    Or ... (see below)

    > I followed up on  NSDecimal and obtained:
    > [...]
    > Scareeeeeee!!!! and nothing like what I thought it might be.
    >

    So either back to NSDecimalNumber, or to the Companion Guide.

    > I have had reason to think about this quite frequently and have come
    > to the conclusion that there is nothing simple or straightforward
    > about writing easy to use technical manuals.
    >

    Indeed.

    > One of the main problems it seems to me occurs when I'm trying to
    > get quickly to an answer and rather than read and digest every word
    > of the manual
    >

    I have had reason to think about this quite frequently and have come
    to the conclusion that, when documentation is written, it should be
    padded with extraneous words and phrases that readers can safely ignore.

    > O.K. lets leave that and go back to  see if we can find something
    > that looks a bit more like the OP's number : 23.30.
    > The next heading beneath "Creating a Decimal Number" is
    > "Initializing a Decimal Number" and head of the list is
    > <>
    > – initWithDecimal:
    > </>
    > That looks promising.. but
    > <>
    > initWithDecimal:
    > Returns an NSDecimalNumber object initialized to represent a given
    > decimal.
    > - (id)initWithDecimal:(NSDecimal)decimal>
    > </>
    >
    > No good: there's that NSDecimal again, but note that this time it is
    > not described as a structure but as a "decimal" !!!!
    > Back to the top of the list:
    > <>
    > Initializing a Decimal Number
    > * – initWithDecimal:
    > * – initWithMantissa:exponent:isNegative:
    > * – initWithString:
    > * – initWithString:locale:
    > </>
    >
    > But there is nothing here that looks anything like it would allow me
    > to intialise with a numeric value like 23.30.
    >
    It's not clear why, throughout, you have ignored:
    (a) initWithMantissa:exponent:isNegative:
    (b) "Inherits from NSNumber : NSValue : NSObject"

    In this case, (b) might have actually lead you astray(*), but it
    should have been in your search path.

    (*) <http://www.cocoabuilder.com/archive/message/cocoa/2009/1/10/227253>
    (You did search the archives as well, didn't you?)

    > I'll stop here.
    >
    Why?
    At this stage, although you should actually have found an answer, you
    should have at least looked at the Companion Guide and if that didn't
    address the issue you should have sent in feedback using either the
    form at the bottom of each documentation page or using Radar.

    > My point is that learning a system via the manual is not the easiest
    > thing in the world and just pointing people at specific pages in the
    > manual though helpful is not always necessarily the best way of
    > doing things.
    >
    Looking at just the API reference pages is typically as useful a way
    to learn about Cocoa as using a dictionary to learn a foreign
    language.  If you want to learn about how methods etc. are used in
    context, then turn to the Companion Guides.

    > One of those imponderable mysteries I guess. But someone must have
    > thought it worthwhile.... so why not say so in the documentation?
    >
    All the references to Companion Guide above notwithstanding, as it
    happens, this isn't well addressed in the Guide.  Please either send
    feedback or file a Radar (<http://bugreport.apple.com/>) to have this
    addressed.

    mmalc
  • On Jan 19, 2009, at 11:17 AM, mmalc Crawford wrote:

    >
    > On Jan 19, 2009, at 6:10 AM, julius wrote:
    >>
    >> But there is nothing here that looks anything like it would allow
    >> me to intialise with a numeric value like 23.30.
    >>
    > It's not clear why, throughout, you have ignored:
    > (a) initWithMantissa:exponent:isNegative:

    In my case, when I went through almost exactly the same gyration that
    julius describes a while ago, I didn't know what a mantissa was, and I
    have a decent math and engineering background.  I'm sure it is buried
    in the depths of some textbook that I haven't seen for 10 years, but
    it's not something that springs to mind.

    I'm not sure this is a documentation failure as much as a language
    failure, at least in this case.  Why isn't there an initWithInt: or
    initWithFloat: like in some other cases?  THAT would have resulted in
    the documentation page leading to the correct answer.  Mantissa?  Come
    on.  I guess the initWithString: is easy enough, but my brain doesn't
    mix-n-match strings and numbers very well, so it didn't occur to me to
    try.

    Brian
  • On Jan 19, 2009, at 11:57 AM, Brian Slick wrote:
    > On Jan 19, 2009, at 11:17 AM, mmalc Crawford wrote:
    >> On Jan 19, 2009, at 6:10 AM, julius wrote:
    >>> But there is nothing here that looks anything like it would allow
    >>> me to intialise with a numeric value like 23.30.
    >> It's not clear why, throughout, you have ignored:
    >> (a) initWithMantissa:exponent:isNegative:
    > In my case, when I went through almost exactly the same gyration
    > that julius describes a while ago, I didn't know what a mantissa
    > was, and I have a decent math and engineering background.
    >
    Discussion
    The arguments express a number in a type of scientific notation that
    requires the mantissa to be an integer. So, for example, if the number
    to be represented is 1.23, it is expressed as 123x10^–2—mantissa is
    123; exponent is –2; and isNegative, which refers to the sign of the
    mantissa, is NO.

    <http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes
    /NSDecimalNumber_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDec
    imalNumber/initWithMantissa:exponent:isNegative:
    >

    <http://www.google.com/search?hl=en&client=safari&rls=en-us&sa=X
    &oi=spell&resnum=1&ct=result&cd=1&q=mantissa&spell=
    1
    >
    -> <http://en.wikipedia.org/wiki/Significand>

    mmalc
  • On 01/19/2009 11:57 AM, "Brian Slick" <brianslick...> wrote:

    > I'm not sure this is a documentation failure as much as a language
    > failure, at least in this case.  Why isn't there an initWithInt: or
    > initWithFloat: like in some other cases?  THAT would have resulted in
    > the documentation page leading to the correct answer.  Mantissa?  Come
    > on.  I guess the initWithString: is easy enough, but my brain doesn't
    > mix-n-match strings and numbers very well, so it didn't occur to me to
    > try.
    >
    > Brian

    NSDecimalNumber inherits from NSNumber.
  • On 19 Jan 2009, at 16:17, mmalc Crawford wrote:

    >
    > On Jan 19, 2009, at 6:10 AM, julius wrote:
    >
    >> I too followed up on the example link which took me to the top of
    >> the NSDecimalNumber Class reference document. Scrolling down the
    >> first thing I came accross under Tasks was "Creating a Decimal
    >> Number" and just beneath that a link to
    >> + decimalNumberWithDecimal:
    >> which looked exactly like what the OP was asking for, viz:
    >> <>
    >> Creates and returns an NSDecimalNumber object equivalent to a given
    >> NSDecimal structure.
    >> + (NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)decimal>
    >> </>
    >> Ah, and look perhaps I don't need to use an alloc....
    >> Now with all respect to the writers of this documentation, my first
    >> question is "what is a decimal structure?".
    >>
    > Typically here I would either click the link to NSDecimal in the
    > method declaration, or go to the Companion Guide listed at the top
    > of the API reference.
    > Or ... (see below)
    >
    >> I followed up on  NSDecimal and obtained:
    >> [...]
    >> Scareeeeeee!!!! and nothing like what I thought it might be.
    >>
    >
    > So either back to NSDecimalNumber,

    > or to the Companion Guide.
    True, I don't go there as often as perhaps I should.
    Following up on your suggestion I just did and went directly to the
    “Using Decimal Numbers” part of the document
    http://developer.apple.com/documentation/Cocoa/Conceptual/NumbersandValues/
    Articles/DecimalNumbers.html#/

    /apple_ref/doc/uid/20000176-CJBCAGDI

    where it says
    <>
    Using Decimal Numbers

    NSDecimalNumber is an immutable subclass of NSNumber that provides an
    object-oriented wrapper for doing base-10 arithmetic. An instance can
    represent any number that can be expressed as mantissa x 10 exponent
    where mantissa is a decimal integer up to 38 digits long, and exponent
    is an integer between -128 and 127.
    </>
    and goes on to talk of calculation errors and the
    NSDecimalNumberBehaviors protocol. It does not however illuminate what
    I perceived as the OP's need for a way of doing something essentially
    like [myDecimalNumberObj setValue: 23.3].
    >
    >
    >> I have had reason to think about this quite frequently and have
    >> come to the conclusion that there is nothing simple or
    >> straightforward about writing easy to use technical manuals.
    >>
    >
    > Indeed.
    >
    >
    >> One of the main problems it seems to me occurs when I'm trying to
    >> get quickly to an answer and rather than read and digest every word
    >> of the manual
    >>
    >
    > I have had reason to think about this quite frequently and have come
    > to the conclusion that, when documentation is written, it should be
    > padded with extraneous words and phrases that readers can safely
    > ignore.
    I appreciate the irony but it misses the point that on many occasions
    we really do just need a straight answer to a simple question.
    Sometimes such an answer exists and sometimes it does not. Sometimes
    to ask a particular question demonstrates sufficient ignorance to
    suppose that it is a text book and not a manual one should be reading.
    In the case of a text book a bit of redundancy is very useful
    especially if it addresses the fact that each person has their own way
    of learning. One would not expect much redundancy in a technical
    manual but an excellently designed manual would consider the different
    users and the different ways in which the information it contains
    might be needed. For instance, one may contrast the need to understand
    how something works from the need to find the correct switch to turn
    the thing on.

    I suppose there must be a good reason for there not being a simple way
    of assigning a value to one of these NSDecimalNumber objects but I
    could find no such reason in the documentation and its absence just
    appears so intuitively unreasonable that one is loth to stop searching
    (see below for why in this case a search would ultimately have been
    successful). NSDecimalNumber appears to be used for arithmetic and as
    a wrapper. I've had sufficient similar difficulties in the past with
    wanting to wrap numbers to have ended up writing my own wrappers. So I
    have a notion of the frustration one might feel in such cases.

    >
    >
    >
    >> O.K. lets leave that and go back to  see if we can find something
    >> that looks a bit more like the OP's number : 23.30.
    >> The next heading beneath "Creating a Decimal Number" is
    >> "Initializing a Decimal Number" and head of the list is
    >> <>
    >> – initWithDecimal:
    >> </>
    >> That looks promising.. but
    >> <>
    >> initWithDecimal:
    >> Returns an NSDecimalNumber object initialized to represent a given
    >> decimal.
    >> - (id)initWithDecimal:(NSDecimal)decimal>
    >> </>
    >>
    >> No good: there's that NSDecimal again, but note that this time it
    >> is not described as a structure but as a "decimal" !!!!
    >> Back to the top of the list:
    >> <>
    >> Initializing a Decimal Number
    >> * – initWithDecimal:
    >> * – initWithMantissa:exponent:isNegative:
    >> * – initWithString:
    >> * – initWithString:locale:
    >> </>
    >>
    >> But there is nothing here that looks anything like it would allow
    >> me to intialise with a numeric value like 23.30.
    >>
    > It's not clear why, throughout, you have ignored:
    > (a) initWithMantissa:exponent:isNegative:
    > (b) "Inherits from NSNumber : NSValue : NSObject"
    >
    > In this case, (b) might have actually lead you astray(*), but it
    > should have been in your search path.
    Well, i always look for the simplest answer first, e.g.
    initWithDouble:. Not finding that, I look for the next simplest, in
    this case I went for the string option.

    Why would I not have considered initWithMantissa:exponent:isNegative:?
    Well my first thought is that now instead of having to deal with one
    value I have to handle three. That tells me I'm getting into
    complexities I would rather avoid. In the case of a literal such as
    23.3 is easy enough to express is as mantissa exponent  though one
    still needs to be careful and there are consequences for code
    readability. In the more general case of myCGFloatValue say, that
    feels less inviting.

    As to "inherits from NSNumber" wow!  No. That was not the first place
    I would have gone to look for an answer but now that I have, wow
    indeed! Thank you very much. I'm still not used to going up and down
    the inheritance hierarchy. That's what comes of not having been
    brought up long term on OO.

    int main(int argc, char *argv[])
    {
        NSDecimalNumber *myDecimalObj    = [[NSDecimalNumber
    alloc]initWithString:@"23.30"];
        NSLog(@"myDecimalObj doubleValue=%6.3f",[myDecimalObj
    doubleValue]);

        CGFloat myCGFloatValue = 43.4;
        NSDecimalNumber *myOtherDecimalObj    = [[NSDecimalNumber
    alloc]initWithFloat:myCGFloatValue];
        NSLog(@"myOtherDecimalObj doubleValue=%6.3f",[myOtherDecimalObj
    doubleValue]);
    }
    Result:
    2009-01-19 20:00:36.655 test[3242:10b] myDecimalObj doubleValue=23.300
    2009-01-19 20:00:36.656 test[3242:10b] myOtherDecimalObj
    doubleValue=43.400
    Most excellent.
      Thanks again.

    > >
    > (You did search the archives as well, didn't you?)
    Well, I am not the OP here and I was just taking a quick look at the
    problem and reporting on the possibility that actually finding the
    answer was not of the easiest as indeed it was increasingly appearing
    to be.

    I have just taken a look at the link and it  indicates there is no
    easy answer. (except of course that there is and it is NSNumber! I had
    written most of this before taking the advised look at the hierarchy)
    >
    >
    >
    >> I'll stop here.
    >>
    > Why?
    because it was not actually I who needed the answer but the OP and I
    had other things to do. I merely was making the point that with the
    best will in the world, the documentation is not always
    straightforward. And how many times is it that it is the smallest of
    things that impede our progress.
    >
    > At this stage, although you should actually have found an answer,
    > you should have at least looked at the Companion Guide and if that
    > didn't address the issue you should have sent in feedback using
    > either the form at the bottom of each documentation page or using
    > Radar.
    As far as I can see in this case the companion guide does not take one
    far towards answering the OP's question.
    >
    >
    >
    >> My point is that learning a system via the manual is not the
    >> easiest thing in the world and just pointing people at specific
    >> pages in the manual though helpful is not always necessarily the
    >> best way of doing things.
    >>
    > Looking at just the API reference pages is typically as useful a way
    > to learn about Cocoa as using a dictionary to learn a foreign
    > language.  If you want to learn about how methods etc. are used in
    > context, then turn to the Companion Guides.
    Yes but as I just said they don't always answer or help answer the
    questions one needs answering.
    >
    >
    >
    >> One of those imponderable mysteries I guess. But someone must have
    >> thought it worthwhile.... so why not say so in the documentation?
    >>
    > All the references to Companion Guide above notwithstanding, as it
    > happens, this isn't well addressed in the Guide.  Please either send
    > feedback or file a Radar (<http://bugreport.apple.com/>) to have
    > this addressed.
    On this issue of feedback and bug reports. I would not feel it right
    to submit a bug report since i don't think of this as a bug. I have
    frequently returned feedback along the lines of "an example would be
    nice" or "how then does one do x!!!" but now do it rarely. There is
    just so much of it.

    Why then should I have spent so much time on this issue? I much
    appreciate this list and the advice volunteered and sympathise with
    the feelings of irritation that must be occasioned by people who could
    perhaps have looked closer at the documentation or have not looked at
    it at all. Nevertheless I sometimes feel the need to restate the
    obvious: learning the system is not easy and sometimes the manual does
    not give up its secrets readily. And as in the present instance it can
    sometimes be the tiniest of things that stops one getting to the answer.

    And thanks for the BIG HINT.
    I'll definitely put that lesson into
    http://juliuspaintings.co.uk/cgi-bin/paint_css/animatedPaint/animatedPaint.
    pl


    Wow!
    All the best
    Julius

    http://juliuspaintings.co.uk
  • On Mon, Jan 19, 2009 at 2:57 PM, Brian Slick <brianslick...> wrote:
    > I'm not sure this is a documentation failure as much as a language failure,
    > at least in this case.  Why isn't there an initWithInt: or initWithFloat:
    > like in some other cases?  THAT would have resulted in the documentation
    > page leading to the correct answer.  Mantissa?  Come on.

    I really don't see the problem with this. While Apple generally does a
    good job of insulating you from the details of how things work
    underneath, you still have to know *something* about how things are
    built. NSDecimalNumber is fundamentally built around mantissa and
    exponent. Thinking the document is inadequate because it relies on
    these concepts would be like thinking that the NSString documentation
    is inadequate because it relies on the concept of "character".

    There are basically only three ways to make a variable NSDecimalNumber
    that are mentioned in the documentation. If faced with this problem,
    it sure seems to me that it would be worth investigating all of them
    before giving up.

    Mike
previous month january 2009 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Go to today