Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:18:56+00:00 2026-06-03T10:18:56+00:00

Trying to store currency, that can be in the negative/postive, with decimals. I’ve done

  • 0

Trying to store currency, that can be in the negative/postive, with decimals. I’ve done much searching and found that using Decimal type in the model is the best way. That doesn’t seem to be signed thought. I see you can store a signed integer (no decimals). But I can’t find any info on storing a signed, decimal number.

Since I’m not finding anything, I’m guessing you can’t.
If so, how do you go about storing this kind of info? Create a boolean attribute that describes if the amount is neg/pos?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:19:00+00:00Added an answer on June 3, 2026 at 10:19 am

    The “Decimal” type in CoreData uses the SQLite “Decimal” storage class, which is backed by the “Real” storage class.

    This will support negative numbers at the store level:

    sqlite> .tables
    test
    sqlite> .schema
    CREATE TABLE test (pk integer primary_key, d double, f float, r real);
    sqlite> insert into test (d,f,r) values (-1.0, -1.5, -1.252853);
    sqlite> select * from test;
    |-1.0|-1.5|-1.252853
    

    As you can see, SQLite correctly stores the value.

    In your objective C code you will be working with the NSNumber class, which can be instantiated with negative decimals using the following code:

    [NSDecimalNumber numberWithDouble:-1.57];
    [NSDecimalNumber numberWithFloat:-1.57];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to store an array value so that I can reuse when Sub
I'm using NSDecimalNumber to store a value for currency. I'm trying to write a
I am trying to store information that can be shared from one screen to
I'm trying to store a password in a file that I'd like to retrieve
I am trying to store a large amount of boolean information that is determined
I am trying to store currency values in sqlite database in android. I don't
I'm trying to add currency picker in header of my magento store. I have
I trying to store some settings in NSUserDefaults, but It seems that the app
When trying to store a file I get the following: TypeError: can't convert nil
I'm trying to store MediumBlob data in MySQL using java. But I have no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.