4 Replies - 676 Views - Last Post: 16 August 2017 - 03:02 PM Rate Topic: -----

#1 BlazeDaBlur  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-August 17

Error: double found: int required

Posted 16 August 2017 - 02:32 PM

What I'm trying to do is make a double [double pi = 3.14] and when I do that, my [int saV1 = 2 * pi * er] and [int saV2 = 2 * pi * er * h] give me the following error: loss of precision. Should I make all of my [int] become [double] or is there a better, and simpler way to do this.
Is This A Good Question/Topic? 0
  • +

Replies To: Error: double found: int required

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13493
  • View blog
  • Posts: 53,899
  • Joined: 12-June 08

Re: Error: double found: int required

Posted 16 August 2017 - 02:33 PM

What language?
Was This Post Helpful? 0
  • +
  • -

#3 BlazeDaBlur  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-August 17

Re: Error: double found: int required

Posted 16 August 2017 - 02:34 PM

View Postmodi123_1, on 16 August 2017 - 02:33 PM, said:

What language?

java
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6379
  • View blog
  • Posts: 25,775
  • Joined: 12-December 12

Re: Error: double found: int required

Posted 16 August 2017 - 02:42 PM

Moved to Java forum.

Copy and paste your code, between code tags, rather than embedding them within text. Then you can tell us what line the error refers to. Also quote the error message exactly.
Was This Post Helpful? 0
  • +
  • -

#5 NormR  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 644
  • View blog
  • Posts: 4,844
  • Joined: 25-December 13

Re: Error: double found: int required

Posted 16 August 2017 - 03:02 PM

Quote

loss of precision.

if the value: 1.765 is assigned to an int variable
the .765 part of the value would be lost.
The compiler's error message was warning you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1