pvds
(Hey THIS is FUN)
2007-07-11 07:04 AM
math?

Hi,

I need to resize a picture and have to devide the width by the height and multiply the result with a fixed height.
To devide I use / and mod this is working but multiply with 1.688 is dificult for me.

her is the code I use this far it is a pice from a fixform script:

 Code:
 $Height = $Bitmap.Height
 $Width = $Bitmap.Width
 
 $dev = ($Width / $Height)
 $mod = ($Width mod $Height)
 
 $verh = "$dev" +"." + "$mod"
  
 ? $Width
 ? $height
 ? $verh

 $nwheight = 600 * $verh

 ? $nwheight


peter


ShawnAdministrator
(KiX Supporter)
2007-07-11 07:21 AM
Re: math?

Is this what your after ?

$verh = CDbl("$dev" +"." + "$mod")


pvds
(Hey THIS is FUN)
2007-07-11 07:30 AM
Re: math?

 Originally Posted By: Shawn

$verh = CDbl("$dev" +"." + "$mod")



? $verh gives 1 and should be 1.688
width = 2048
and hight = 1360

With my code '$verh = "$dev" +"." + "$mod" 'I get 1.688

My problem is multiplying 600 times 1.688 the result I get is 1200 and not
1012.8

I hope You can help.

Peter


ShawnAdministrator
(KiX Supporter)
2007-07-11 07:36 AM
Re: math?

Try this (change 600 to 600.0):

$nwheight = 600.0 * $verh


pvds
(Hey THIS is FUN)
2007-07-11 08:10 AM
Re: math?

 Originally Posted By: Shawn
Try this (change 600 to 600.0):

$nwheight = 600.0 * $verh


Gives 1200


ShawnAdministrator
(KiX Supporter)
2007-07-11 08:17 AM
Re: math?

What Width and Height values are you using ?

pvds
(Hey THIS is FUN)
2007-07-11 08:36 AM
Re: math?

 Originally Posted By: Shawn
What Width and Height values are you using ?



width = 2048
and hight = 1360


ShawnAdministrator
(KiX Supporter)
2007-07-11 08:41 AM
Re: math?

If I run this:

 Code:
$Height = 1360 
$Width = 2048
 
$dev = ($Width / $Height)
$mod = ($Width mod $Height)
 
$verh = "$dev" +"." + "$mod"
  
? $Width
? $height
? $verh

$nwheight = 600.0 * $verh

? $nwheight


I get this output:

2048
1360
1.688
1012.8




pvds
(Hey THIS is FUN)
2007-07-11 09:03 AM
Re: math?

I realy get this on two difrent machines I am at work now and at home I have the same result.

Dutch windows XP SP2 (work) Duch Vista (Home)

2048
1360
1.688
600

I am realy confused????


Mart
(KiX Supporter)
2007-07-11 10:05 AM
Re: math?

 Quote:

....
I am realy confused????


So am I.
I get the same results as you are getting. Tried some stuff but keep getting the same results.


pvds
(Hey THIS is FUN)
2007-07-11 12:52 PM
Re: math?

Mart,

I have been strugeling with this for about 24 hours can not sleep anymore.

Uitdaging??

Peter


pvds
(Hey THIS is FUN)
2007-07-11 01:54 PM
Re: math?

Mart, Shawn,

It has something to do with the country settings it is now on VS and I get the result from shawn. Is this a bug?

Peter


Mart
(KiX Supporter)
2007-07-11 02:00 PM
Re: math?

 Quote:

....
Uitdaging??
....


LOL nope. Enough work for now.

This country setting….what did you change exactly to get the results Shawn is getting?


pvds
(Hey THIS is FUN)
2007-07-11 02:14 PM
Re: math?

Mart,

I put the countrysettings "Landinstellingen" from "Nederlands" to "Engels(Verenigde Staten)" Nothing more.

Sorry for the Dutch part It is dutch Win XP SP2

Peter


Mart
(KiX Supporter)
2007-07-11 02:22 PM
Re: math?

Hmmmm... will do some tests at home tonight.

If it really comes down to that simple setting that would be a little FUBAR.


DrillSergeant
(MM club member)
2007-07-11 02:36 PM
Re: math?

I can confirm this.

If I change decimal symbol (Regional and Language Options -> Regional Options -> Customize -> Numbers) from a dot to a comma, I get the results as Peter. If it's a dot I get the same results as Shawn.

Who's going to report this bug?


Arend_
(MM club member)
2007-07-11 02:45 PM
Re: math?

there we go again, europe vs the rest ;\)

dots vs comma's
kilometers vs miles
english vs engrish ;\)

Anyway, you can keep the country settings for Dutch, just change the decimal symbols.


pvds
(Hey THIS is FUN)
2007-07-11 02:46 PM
Re: math?

 Originally Posted By: DrillSergeant

Who's going to report this bug?



Shawn, Mart, DrillSergeant??

I am just a member with less then 200 posts


Mart
(KiX Supporter)
2007-07-11 02:49 PM
Re: math?

 Quote:

....
I am just a member with less then 200 posts


So what? 1 post or 15.000 doesn't matter. We are all equal although some are a bit more equal the others

See: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=177754&page=0#Post177754


Arend_
(MM club member)
2007-07-11 03:15 PM
Re: math?

 Originally Posted By: Mart

So what? 1 post or 15.000 doesn't matter. We are all equal although some are a bit more equal the others


LOL those are called operators ;\)


LonkeroAdministrator
(KiX Master Guru)
2007-07-11 03:16 PM
Re: math?

this "feature" has been in kix forever.
not really bug...


ShawnAdministrator
(KiX Supporter)
2007-07-11 05:38 PM
Re: math?

So just to recap (and for everyone's understanding (like mine)) ...

This works fine in all languages:

$Value = 1.123

Because the decimal is a "built-in" feature of Kixtart. But using a string, like this:

$Value = CDbl("1.123")

Works over here cause we use the decimal but in Dutch - the decimal is a comma and should be:

$Value = CDbl("1,123")

??? Eh ?

-Shawn


Arend_
(MM club member)
2007-07-11 06:30 PM
Re: math?

In a nutshell \:\)
Not just Dutch, but whole of europe (minus UK)


NTDOCAdministrator
(KiX Master)
2007-07-11 06:53 PM
Re: math?

Okay, case solved. Don't use a string like that. \:\)