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

123
Views
¿Pueden las funciones matemáticas estándar manejar el infinito correctamente?
int main() { double inf = INFINITY; double pi = acos(-1.0); printf("[1]: %f %f\n", atan(inf) / pi, atan(-inf) / pi); printf("[2]: %f %f\n", tan(inf) / pi, tan(-inf) / pi); return 0; }

salidas

 [1]: 0.500000 -0.500000 [2]: -nan -nan

¿Este comportamiento está definido por la norma? ¿Es [2] un comportamiento indefinido? sin especificar?

Quiero estar seguro de que al menos [1] es un resultado garantizado.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Ambos son comportamientos bien definidos. Citando de http://en.cppreference.com

  • broncearse

    Si el argumento es ±0, se devuelve sin modificar.
    Si el argumento es ±∞, se devuelve NaN y se genera FE_INVALID.
    Si el argumento es NaN, se devuelve NaN.

  • un bronceado

    Si el argumento es ±0, se devuelve sin modificar.
    Si el argumento es +∞, se devuelve +π/2.
    Si el argumento es -∞, se devuelve -π/2.
    Si el argumento es NaN, se devuelve NaN.

over 4 years ago · Santiago Trujillo 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!