I've seen this finance calculation code at my friend's computer :
double Total = ...
double Paid = ...
double Wating_For_Details = ...
double Decuctibles = ...
double Rejected = ...
Well , the moment I saw this , I told him that double
is represented at base 2
and can NOT represent finance calculation. use decimal
instead.
great.
But the moment I change it to double Ive encountered :
Attempted to divide by zero.
HUH ?
Apparently - using double
, when dividing with 0.0
it does NOT throws exception :
But returns NAN
.
While my code (using decimal
) does throw exception ( when Total
is zero
)
And so I ask :
I checked 0.0==0
and it returns true. so why I'm not getting exception but NAN
? I know thats how it should be but where is the common sence of not throwing exception when dividing double by zero ?
It tells a server to "listen" for and accept connections from any IP address. On PCs and client devices. A 0.0. 0.0 address indicates the client isn't connected to a TCP/IP network, and a device may give itself a 0.0. 0.0 address when it is offline.
In the context of routing, 0.0. 0.0 usually means the default route, i.e. the route which leads to 'the rest of' the Internet instead of somewhere on the local network.
for all intents and purposes, yes. Each of the four numbers separated by the period have a value ranging from 0-255, so 0.0. 0.0 is technically valid.
127.0. 0.1 is the loopback address (also known as localhost). 0.0. 0.0 is a non-routable meta-address used to designate an invalid, unknown or non applicable target (a no particular address placeholder).
Unlike operations with integral types, which throw exceptions in cases of overflow or illegal operations such as division by zero, operations with floating-point values do not throw exceptions. Instead, in exceptional situations, the result of a floating-point operation is zero, positive infinity, negative infinity, or not a number (NaN):
From Double
on MSDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With