Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

single/10000=?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
uga237

Bascom Member



Joined: 15 May 2012
Posts: 32

blank.gif
PostPosted: Thu Aug 14, 2014 8:31 am    Post subject: single/10000=? Reply with quote

$regfile = "xm256A3def.dat"
$crystal = 32000000
$hwstack = 500
$swstack = 500
$framesize = 500
$frameprotect = 1


Config Submode = New

Declare Sub Xxx()

Do
Call Xxx()
Loop


Sub Xxx()
Local Gpd_temp_single As Single
Local Str_temp As String * 30
Gpd_temp_single = 465847.0
Gpd_temp_single = Gpd_temp_single / 10000
Str_temp = Str(gpd_temp_single)

End Sub

str_temp = "46.584697721"

it's ok?

but i want to see "46.5847"

(BASCOM-AVR version : 2.0.7.7 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Thu Aug 14, 2014 9:00 am    Post subject: Reply with quote

that was the link to FP complications. A FP number has a huge range but it can not contain any possible value. Use double to increase accuracy.
To show the value with a number of digits after the DP, have a look at Fusing()

_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum