While working on the project "Build an API-Tracer", which is finally done and published, I came across this "issue".
Is this considered a bug? Or not. To my understanding it is a bug.
This code will give FLT_MAX as result, but shouldnt it give LONG_MAX as result??
Here is the output from my shiny new API-Tracer...
Why do you think it should give the result LONG_MAX? FLT_MAX is twenty orders of magnitude greater than LONG_MAX (FLT_MAX: 3.402823e+38 ; LONG_MAX: 9.223372e+18).
long is 64 bits: 1 sign bit + 63 integer bits (the magnitude is determined by integer bits)
So, LONG_MAX ≈ 2^63 (9.223372036854775808e+18)
float is 32 bits: 1 sign bit + 8 exponent bits + 23 mantissa bits (the magnitude is determined by 2^(exponent bits - 1))
So, FLT_MAX ≈ 2^ (2^7) ≈ 2^128 (3.40282366e+38)
double is 64 bits: 1 sign bit + 11 exponent bits + 52 mantissa bits (the magnitude is determined by 2^(exponent bits - 1))
So, DBL_MAX ≈ 2^ (2^10) ≈ 2^1024 (1.7976931348623158e+308)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
While working on the project "Build an API-Tracer", which is finally done and published, I came across this "issue".
Is this considered a bug? Or not. To my understanding it is a bug.
This code will give FLT_MAX as result, but shouldnt it give LONG_MAX as result??
Here is the output from my shiny new API-Tracer...