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 8908575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:12:56+00:00 2026-06-15T03:12:56+00:00

I have an expression from the strCal string strcal value is @((24 – 18)

  • 0

I have an expression from the strCal string strcal value is @”((24 – 18) / 87) * 100″
I want to have the result correct to 4 decimal so I retrieve the result using floatValue method

But instead of 6.8966 I get 0

This is my code

NSString *strCal=[NSString stringWithFormat:@"   
                      ((%d%@)%@)%@",number,strMinus,strDivide,strMultiple];
    NSExpression *exp=[NSExpression expressionWithFormat:strCal];
    float result=[[exp expressionValueWithObject:nil context:nil] floatValue];
    NSLog(@"result:%f",result);

result:0.000000

  • 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-15T03:12:57+00:00Added an answer on June 15, 2026 at 3:12 am

    I found it myself by converting the 87 in the string strCal to float value like below

    @”((24 – 18) / 87.00) * 100″

    why because means the either the dividend or divisor has to be in float so that the compiler(LLVM) output the answer in float

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this expression: var result = from pav in ProductAttributes join id in
I have a Java regular expression that captures stack exceptions from a string: ((?s).+(?:Exception|Error)[^\n]++(?:\s+at
I have this regular expression: var from = result.match(/^From\:(.*)/m)[1].replace(/^\s+/, ''); The problem is that
I'm trying to retrieve a particular string with the Regex Expression from a sentence.
I have a XAML file that I exported from Expression Design. I would like
I have the following linq expression pulling all data from my database: var items
I have a query: SELECT ID FROM requests WHERE date <operator> <expression> I need
I have a expression: Select (2345789 * 39.456) / 100 The output is 925554.5078400
I would have expected delegates generated from expression trees to achieve roughly the same
I have an expression which matches the question mark in a url query string

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.