[bascom] problem with single variable

Thread Starter

king40

Joined Jul 17, 2013
75
hi engineers :cool:
i have a single variable
like this

dim a as single
a=12345.12345

and i config single with this code:
Config Single = Scientific , Digits = 5

when i want use of my " a " variable
my output is
12345.12
i dont know why :confused:
anybody know why ? :(
thanks
 

tshuck

Joined Oct 18, 2012
3,534
hi engineers :cool:
i have a single variable
like this

dim a as single
a=12345.12345

and i config single with this code:
Config Single = Scientific , Digits = 5

when i want use of my " a " variable
my output is
12345.12
i dont know why :confused:
anybody know why ? :(
thanks
It's because you are losing resolution with using a Single. Use a Double if you want to capture more data.

The Single devotes less bits to the fractional portion of the floating point number, than a Double would. Your number is at the limit of what a Single can represent.
 
Top