Jump to content

Recommended Posts

Posted

hi guy i have a questions

why when i do this operation 3.00 -2.00 = 1 i have result 1 ???

i want 1.00 is possible whit some option have this ?? ?

thanks

Posted

Use something like

$iResult = 3.00 - 2.00
ConsoleWrite(StringFormat("%.2f", $iResult) & @CRLF)

My UDFs and Tutorials:

  Reveal hidden contents

 

  • Moderators
Posted

faustf,

You need to use StringFormat on the returned value:

$nAnswer = StringFormat("%.2f", 3.00 - 2.00)
ConsoleWrite($nAnswer & @CRLF)

StringFormat has one of the most arcane syntaxes known to man - the above translates like this:

%   - The following is a format string
.2f - Place 2 digits after teh decimal point, padding with zeroes if required

Please do not ask any questions - I do not understand StringFormat much either! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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