Jump to content

Errors decimal number when use Round ()


kctvt
 Share

Recommended Posts

 

Hi there, I have a small problem, and I dont know how to fix it. 

 

Example :  

Spoiler

 

$b = 1.09549

$a = 1.09548

$c = $b - $a

 

So, we know 1.09549 - 1.09548 ... will be : 0.00001 

But no, see this , look at this picture.   (Attach file)

That is : 1e-005   , NOT 0.00001

 

=====

I used ROUND ()  to fix this , but I cant.

$c1 = Round ($c,5)

 

So, any body please help me.  Thanks :)

 

 

 

 

 

number1.png

Edited by kctvt
Link to comment
Share on other sites

@kctvt,

you need to reformat the output, like this:

$b = 1.09549
$a = 1.09548
$c = $b - $a
MsgBox(0, '', StringFormat('%.5f', $c))

EDIT: to clarify, this is only a visual representation. the actual numeric value is correct, 1e-005 = 0.00001

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

21 hours ago, orbs said:

@kctvt,

you need to reformat the output, like this:

$b = 1.09549
$a = 1.09548
$c = $b - $a
MsgBox(0, '', StringFormat('%.5f', $c))

EDIT: to clarify, this is only a visual representation. the actual numeric value is correct, 1e-005 = 0.00001

Hi Orbs , it worked :) Thanks. You saved my life yesterday :) 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...