Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
web api c# returns another value for data type long with angular

I am making an http get call from an Angular client to a web api .net Framework 4.7

I have a service that returns me an object with values, including a property of type "long", the issue is that when I debug the response in the api, it returns a number 9997773333333335 (which is what I expect) but when I get to browser translates it to 9997773333333336

In summary:

long data type, in the database it remains as 9997773333333335 but when receiving the response in the front it arrives as 9997773333333336.

Can someone explain to me why this happens? are you doing a rounding? How could I avoid it?

Fact: the field in the DB is a Bigint.

backend response:

BACKEND RESPONSE

Frontend result:

FRONTEND RESULT

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is that the numbers you are using are larger than Number.MAX_SAFE_INTEGER. JavaScript can't accurately represent integers this large using the Number type, so errors like what you are seeing are to be expected.

Try passing these values to the front-end as strings rather than longs. If you need to do any calculation with them client-side, convert these strings to BigInts first.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!