Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

468
Vistas
Is there a way that double d + 1 == d in java

I'm just curious if there's a way that d + 1 == d. If d is a double. Maybe someone can share some knowledge with me.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Yes, certainly.

class Main {  
  public static void main(String args[]) { 
    System.out.println(1.0e52 + 1); 
  } 
}

prints

1.0E52

This will actually be true for numbers with absolute value at least 253, because the mantissa of a double has 52 bits of precision.

over 4 years ago · Santiago Trujillo Denunciar

0

Absolutely. For very large (or small) doubles (or Double.POSITIVE_INFINITY), floating point precision won't be enough to store the 1 difference and d + 1 == d will be true.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda