JochenAdministrator
(KiX Supporter)
2003-05-23 08:59 AM
The Math Functions Wishlist... Part I - The List

Think it was mentioned before, but regarding the 'new' possibilities with kixforms it's about time for some functionality enhancement (supporting floating point numbers was a step in the right direction) .... soooo ... how about intrinsic:

  • sin()
  • cos()
  • tan()
  • as well as their corresponding functions (asin() acos() atan() )
  • π (Pi as ummm ... a constant ?)
  • e (as well)
  • pwr() (supporting floating point operations of course)
  • sqrt() (cdbl-enabled as well)
functions ?
Anyone else to enhance this list ?
{Maybe some statistical functions for MCA ? [Big Grin] }
IF YOU FEEL LIKE TALKING ABOUT THAT, PLEASE GO HERE

[ 26. May 2003, 09:59: Message edited by: Jochen ]


Bryce
(KiX Supporter)
2003-06-02 10:23 PM
Re: The Math Functions Wishlist... Part I - The List

you looking for internal kixtart.exe support or UDF's?

UDF's might make for interesting projects [Smile]

I know when I made this SQRT() it was a learning experience to say the least.


JochenAdministrator
(KiX Supporter)
2003-06-02 10:31 PM
Re: The Math Functions Wishlist... Part I - The List

Ummm ... intrinsic is the word here

Or can you riddle this? :

$x = sqrt(42.23)

[Wink]


Bryce
(KiX Supporter)
2003-06-02 10:38 PM
Re: The Math Functions Wishlist... Part I - The List

err.... using the above SQRT() function I get this.

code:
$x = sqrt(42.23)
? $x

6.49846135635198

my trusty MS calculator gives me
6.4984613563519788003088119713467


JochenAdministrator
(KiX Supporter)
2003-06-02 10:45 PM
Re: The Math Functions Wishlist... Part I - The List

[Roll Eyes]

Sure, sorry!

It was of course the pwr() thing I played with some time later that is only with pain to get cdbl-aware...

Not to speak of sin() etc.

[ 02. June 2003, 22:47: Message edited by: Jochen ]


Bryce
(KiX Supporter)
2003-06-02 10:59 PM
Re: The Math Functions Wishlist... Part I - The List

you mean this? Link

code:
;42.23^4
$x = sqr(42.23,4)
? $x

3180418.90045441

ms calc returns = 3180418.90045441


Bryce
(KiX Supporter)
2003-06-02 11:05 PM
Re: The Math Functions Wishlist... Part I - The List

those are the only 2 that I have done.... but i am sure that the others can be done too.

JochenAdministrator
(KiX Supporter)
2003-06-02 11:11 PM
Re: The Math Functions Wishlist... Part I - The List

Fair Cop,

but how about :

42.23^4.7

The pain starts ...


Bryce
(KiX Supporter)
2003-06-02 11:20 PM
Re: The Math Functions Wishlist... Part I - The List

hmmmmmmm

LonkeroAdministrator
(KiX Master Guru)
2005-08-31 03:41 AM
Re: The Math Functions Wishlist... Part I - The List

ping pong.
can't forget Sqrt() nor Pow()


jtokach
(Seasoned Scripter)
2005-09-08 10:19 PM
Re: The Math Functions Wishlist... Part I - The List

Not quite as profound as what's listed above, but these math shortcuts would rock.

$x++
++$x
$x--
--$x
$x+=(expr)
etc., etc.


LonkeroAdministrator
(KiX Master Guru)
2005-09-08 10:27 PM
Re: The Math Functions Wishlist... Part I - The List

yes.
been waiting for someone to post a suggestion about these.
I'm totally with you about these!


Howard Bullock
(KiX Supporter)
2005-09-08 10:58 PM
Re: The Math Functions Wishlist... Part I - The List

jtokach ,Jooel wanted me to post those but I told him that they were too Perlish and I might get bashed. But I want them too.

AllenAdministrator
(KiX Supporter)
2005-09-08 11:07 PM
Re: The Math Functions Wishlist... Part I - The List

What does the double plus or minus signify?

jtokach
(Seasoned Scripter)
2005-09-08 11:08 PM
Re: The Math Functions Wishlist... Part I - The List

$x++

equals

$x=$x+1


jtokach
(Seasoned Scripter)
2005-09-08 11:11 PM
Re: The Math Functions Wishlist... Part I - The List

Quote:

jtokach ,Jooel wanted me to post those but I told him that they were too Perlish and I might get bashed. But I want them too.




It might be a nice change to get some C based crap in here vs. all the VB.


AllenAdministrator
(KiX Supporter)
2005-09-08 11:11 PM
Re: The Math Functions Wishlist... Part I - The List

ack! I'll pass. Aside from golf... what's the advantage?

jtokach
(Seasoned Scripter)
2005-09-09 12:36 AM
Re: The Math Functions Wishlist... Part I - The List

It's been around in C for +30 years; apparently those guys were super lazy too.

The only advantages that I could see, besides the lazy factor, are that it should be faster for the interpreter to simply increment the variable rather than setting the left side var equal to itself and then performing the math. And someone might benefit from the ability to choose weather to pre increment/decrement vs. post increment/decrement. I can't think of any examples off hand.

Obviously, these VB type For loops weren't built with this in mind. Consider in C:

for(hi=100,lo=0;hi>=lo;hi--,lo++)

This C For loop most accurately translates to a While statement in Kix.

$hi=100
$lo=0
While $hi>=$lo
$hi=$hi-1
$lo=$lo+1
Loop

Hmmm...


LonkeroAdministrator
(KiX Master Guru)
2005-09-09 12:58 AM
Re: The Math Functions Wishlist... Part I - The List

well, most importantly something like the code below will benefit:
Code:

$myTextFile = readFile("c:\pagefile.sys") ; you need to udf for this :p
$myTextFile = $myTextFile + "some text more"


consider moving around some hundreds of megabytes of crap.
when you could simply append the text with:
Code:

$myTextFile = readFile("c:\pagefile.sys") ; you need to udf for this :p
$myTextFile += "some text more"




pagefile.sys might not work as perfect example but you surely get the idea.


jtokach
(Seasoned Scripter)
2005-09-09 01:02 AM
Re: The Math Functions Wishlist... Part I - The List

Absolutely.

maciep
(Korg Regular)
2005-09-09 01:08 AM
Re: The Math Functions Wishlist... Part I - The List

Quote:


It's been around in C for +30 years; apparently those guys were super lazy too.





All automation stems from laziness. Anyway, to add my two cents...If i remember my c++ correctly (which i might not) the ++ operator is unary. So if you wanted to increment a variable and then compare it to some value, you could do something like

if(++x == y) {...}

instead of

$x = $x+1
if $x = $y ... endif

Man, i really miss c++


jtokach
(Seasoned Scripter)
2005-09-09 04:45 PM
Re: The Math Functions Wishlist... Part I - The List

Sure, and alternatively:

if(x++ == y) {...}

instead of

if $x = $y
...
endif
$x = $x+1

or

if $x = $y
$x = $x+1
...
endif

or

if $x = $y
$x = $x+1
...
endif
$x = $x+1


ShawnAdministrator
(KiX Supporter)
2005-09-09 05:07 PM
Re: The Math Functions Wishlist... Part I - The List

Without a doubt - some of (my) absolute favorites features of C

Howard Bullock
(KiX Supporter)
2005-09-09 09:51 PM
Re: The Math Functions Wishlist... Part I - The List

Actually it can be more than that.

$i = 0
$j = 0
? $i++ ; prints 0
? ++$j ; prints 1