Page 1 of 2 12>
Topic Options
#177715 - 2007-07-11 07:04 AM math?
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
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

Top
#177716 - 2007-07-11 07:21 AM Re: math? [Re: pvds]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Is this what your after ?

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

Top
#177717 - 2007-07-11 07:30 AM Re: math? [Re: Shawn]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
 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

Top
#177718 - 2007-07-11 07:36 AM Re: math? [Re: pvds]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Try this (change 600 to 600.0):

$nwheight = 600.0 * $verh

Top
#177719 - 2007-07-11 08:10 AM Re: math? [Re: Shawn]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
 Originally Posted By: Shawn
Try this (change 600 to 600.0):

$nwheight = 600.0 * $verh


Gives 1200

Top
#177722 - 2007-07-11 08:17 AM Re: math? [Re: pvds]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
What Width and Height values are you using ?
Top
#177725 - 2007-07-11 08:36 AM Re: math? [Re: Shawn]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
 Originally Posted By: Shawn
What Width and Height values are you using ?



width = 2048
and hight = 1360

Top
#177726 - 2007-07-11 08:41 AM Re: math? [Re: pvds]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
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



Top
#177727 - 2007-07-11 09:03 AM Re: math? [Re: Shawn]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
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????


Edited by pvds (2007-07-11 09:12 AM)

Top
#177732 - 2007-07-11 10:05 AM Re: math? [Re: pvds]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4669
Loc: The Netherlands
 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.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#177738 - 2007-07-11 12:52 PM Re: math? [Re: Mart]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Mart,

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

Uitdaging??

Peter

Top
#177741 - 2007-07-11 01:54 PM Re: math? [Re: pvds]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
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

Top
#177743 - 2007-07-11 02:00 PM Re: math? [Re: pvds]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4669
Loc: The Netherlands
 Quote:

....
Uitdaging??
....


LOL nope. Enough work for now.

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

- Chuck Norris once sold ebay to ebay on ebay.

Top
#177745 - 2007-07-11 02:14 PM Re: math? [Re: Mart]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
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

Top
#177747 - 2007-07-11 02:22 PM Re: math? [Re: pvds]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4669
Loc: The Netherlands
Hmmmm... will do some tests at home tonight.

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

- Chuck Norris once sold ebay to ebay on ebay.

Top
#177749 - 2007-07-11 02:36 PM Re: math? [Re: Mart]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
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?
_________________________
The Code is out there

Top
#177751 - 2007-07-11 02:45 PM Re: math? [Re: DrillSergeant]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1889
Loc: Hilversum, The Netherlands
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.

Top
#177752 - 2007-07-11 02:46 PM Re: math? [Re: DrillSergeant]
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
 Originally Posted By: DrillSergeant

Who's going to report this bug?



Shawn, Mart, DrillSergeant??

I am just a member with less then 200 posts

Top
#177753 - 2007-07-11 02:49 PM Re: math? [Re: pvds]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4669
Loc: The Netherlands
 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


Edited by Mart (2007-07-11 02:52 PM)
Edit Reason: Added URL
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#177757 - 2007-07-11 03:15 PM Re: math? [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1889
Loc: Hilversum, The Netherlands
 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 ;\)

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 53 anonymous users online.
Newest Members
Janneman, standardbruker, maikoenig2001, Animade, baddog1229
17771 Registered Users

Generated in 0.044 seconds in which 0.011 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org