Revision history for KeyPgSqr


Revision [22015]

Last edited on 2017-11-21 01:11:46 by JeffMarshall [fix page link name case]
Additions:
If a ##[[KeyPgLongint|Longint]]## or ##[[KeyPgUlongint|ULongint]]## is passed to ##**Sqr**##, it may be converted to ##[[KeyPgDouble|Double]]## precision first. For numbers over ##2^52##, this will cause a very small loss of precision. Without making any assumptions about the rounding method, the maximum error due to this will be ##**Sqr**(2^64) - **Sqr**(2^64-2^12)##, which is about ##4.8e-7##. However this may cause erroneous results if the floor or ceiling of this value is taken, and the result of this may be out by ##1##, particularly for square numbers and numbers that are close by.
Deletions:
If a ##[[KeyPglongint|Longint]]## or ##[[KeyPgUlongint|ULongint]]## is passed to ##**Sqr**##, it may be converted to ##[[KeyPgDouble|Double]]## precision first. For numbers over ##2^52##, this will cause a very small loss of precision. Without making any assumptions about the rounding method, the maximum error due to this will be ##**Sqr**(2^64) - **Sqr**(2^64-2^12)##, which is about ##4.8e-7##. However this may cause erroneous results if the floor or ceiling of this value is taken, and the result of this may be out by ##1##, particularly for square numbers and numbers that are close by.


Revision [21141]

Edited on 2016-03-13 10:58:22 by fxm [Formatting]
Additions:




Revision [20531]

Edited on 2016-02-10 16:08:57 by DkLwikki [Update link format]
Additions:
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Sqr** ( [[KeyPgByval|byval]] //number// [[KeyPgAs|as]] [[KeyPgDouble|double]] ) [[KeyPgAs|as]] [[KeyPgDouble|double]]
This is the same as raising the argument ##//number//## to the one-half power: ##//y// = //x// [[KeyPgOpExponentiate|^]] (1/2)## . The required ##//number//## argument can be any valid numeric expression greater than or equal zero.
If a ##[[KeyPglongint|Longint]]## or ##[[KeyPgUlongint|ULongint]]## is passed to ##**Sqr**##, it may be converted to ##[[KeyPgDouble|Double]]## precision first. For numbers over ##2^52##, this will cause a very small loss of precision. Without making any assumptions about the rounding method, the maximum error due to this will be ##**Sqr**(2^64) - **Sqr**(2^64-2^12)##, which is about ##4.8e-7##. However this may cause erroneous results if the floor or ceiling of this value is taken, and the result of this may be out by ##1##, particularly for square numbers and numbers that are close by.
- ##[[KeyPgOpExponentiate|Operator ^ (Exponentiate)]]##
- [[CatPgMath|Arithmetic Operators]]
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Sqr** ( [[KeyPgByval byval]] //number// [[KeyPgAs as]] [[KeyPgDouble double]] ) [[KeyPgAs as]] [[KeyPgDouble double]]
This is the same as raising the argument ##//number//## to the one-half power: ##//y// = //x// [[KeyPgOpExponentiate ^]] (1/2)## . The required ##//number//## argument can be any valid numeric expression greater than or equal zero.
If a ##[[KeyPglongint Longint]]## or ##[[KeyPgUlongint ULongint]]## is passed to ##**Sqr**##, it may be converted to ##[[KeyPgDouble Double]]## precision first. For numbers over ##2^52##, this will cause a very small loss of precision. Without making any assumptions about the rounding method, the maximum error due to this will be ##**Sqr**(2^64) - **Sqr**(2^64-2^12)##, which is about ##4.8e-7##. However this may cause erroneous results if the floor or ceiling of this value is taken, and the result of this may be out by ##1##, particularly for square numbers and numbers that are close by.
- ##[[KeyPgOpExponentiate Operator ^ (Exponentiate)]]##
- [[CatPgMath Arithmetic Operators]]


Revision [16343]

Edited on 2012-09-12 12:44:51 by CountingPine [In practice, there may actually be no loss of precision for 64-bit integers, depending on how the va]
Additions:
If a ##[[KeyPglongint Longint]]## or ##[[KeyPgUlongint ULongint]]## is passed to ##**Sqr**##, it may be converted to ##[[KeyPgDouble Double]]## precision first. For numbers over ##2^52##, this will cause a very small loss of precision. Without making any assumptions about the rounding method, the maximum error due to this will be ##**Sqr**(2^64) - **Sqr**(2^64-2^12)##, which is about ##4.8e-7##. However this may cause erroneous results if the floor or ceiling of this value is taken, and the result of this may be out by ##1##, particularly for square numbers and numbers that are close by.
Deletions:
If a ##[[KeyPglongint Longint]]## or ##[[KeyPgUlongint ULongint]]## is passed to ##**Sqr**##, it will be converted to a ##[[KeyPgDouble Double]]## first. For numbers over ##2^52##, this will cause a very small loss of precision. Without making any assumptions about the rounding method, the maximum error due to this will be ##**Sqr**(2^64) - **Sqr**(2^64-2^12)##, which is about ##4.8e-7##. However this may cause erroneous results if the floor or ceiling of this value is taken, and the result of this may be out by ##1##, particularly for square numbers and numbers that are close by.


Revision [16342]

Edited on 2012-09-12 12:03:33 by CountingPine [Warning about 64-bit integer operand precision; minor example changes]
Additions:
If a ##[[KeyPglongint Longint]]## or ##[[KeyPgUlongint ULongint]]## is passed to ##**Sqr**##, it will be converted to a ##[[KeyPgDouble Double]]## first. For numbers over ##2^52##, this will cause a very small loss of precision. Without making any assumptions about the rounding method, the maximum error due to this will be ##**Sqr**(2^64) - **Sqr**(2^64-2^12)##, which is about ##4.8e-7##. However this may cause erroneous results if the floor or ceiling of this value is taken, and the result of this may be out by ##1##, particularly for square numbers and numbers that are close by.
'' Example of Sqr function: Pythagorean theorem
Dim As Single a, b
Print "Pythagorean theorem, right-angled triangle"
Print
Input "Please enter one leg side length: ", a
Input "Please enter the other leg side length: ", b
Print
Print "The hypotenuse has a length of: " & Sqr( a * a + b * b )
Pythagorean theorem, right-angled triangle
Please enter one leg side length: 1.5
Please enter the other leg side length: 2
The hypotenuse has a length of: 2.5
Deletions:
'' Example of sqr function: Pythagorean theorem
DIM AS SINGLE a , b
PRINT "Pythagorean theorem , right triangle"
PRINT
INPUT "Please enter one leg side length: ", a
INPUT "Please enter the other leg side length: ", b
PRINT
PRINT "The hypotenuse has a length of: " ; SQR ( a * a + b * b )
SLEEP
Pythagorean theorem , right triangle
Please enter one leg side length: 3
Please enter the other leg side length: 4
The hypotenuse has a length of: 5


Revision [16288]

Edited on 2012-08-16 07:36:18 by CountingPine [Formatting, link to Operator ^]
Additions:
If ##//number//## equals zero, ##**Sqr**## returns zero (##0.0##).
If ##//number//## is less than zero, ##**Sqr**## returns a special value representing "not defined", printing like "##""NaN""##" or ##"IND"##, exact text is platform dependent.
This is the same as raising the argument ##//number//## to the one-half power: ##//y// = //x// [[KeyPgOpExponentiate ^]] (1/2)## . The required ##//number//## argument can be any valid numeric expression greater than or equal zero.
- ##[[KeyPgOpExponentiate Operator ^ (Exponentiate)]]##
Deletions:
If ##//number//## equals zero, **Sqr** returns zero.
If ##//number//## is less than zero, **Sqr** returns a special value representing "not defined", printing like """NaN""" or "IND", exact text is platform dependent.
This is the same as raising the argument //number// to the one-half power: y = x ^ (1/2) . The required ##//number//## argument can be any valid numeric expression greater than or equal zero.


Revision [14245]

Edited on 2009-08-20 03:11:20 by CountingPine [updated]

No Differences

Revision [14028]

Edited on 2008-12-13 12:55:03 by LaananFisher [Updated: minor formatting]
Additions:
result = **Sqr**( //number// )
Deletions:
result = **Sqr** ( //number// )


Revision [13859]

Edited on 2008-11-01 03:24:05 by DoS386 [sqr(-1)]
Additions:
If ##//number//## is less than zero, **Sqr** returns a special value representing "not defined", printing like """NaN""" or "IND", exact text is platform dependent.
Deletions:
If ##//number//## is less than zero, **Sqr** returns a domain error (-1.#IND).


Revision [13804]

Edited on 2008-10-22 04:28:50 by DoS386 [minor, please recheck "domain error (-1.#IND)" [3]]
Additions:
If ##//number//## is less than zero, **Sqr** returns a domain error (-1.#IND).
Deletions:
If ##//number//## is less than zero, **Sqr** returns a domain error (-1.#IND).


Revision [13799]

Edited on 2008-10-22 04:14:28 by DoS386 [minor, please recheck "domain error (-1.#IND)"]
Additions:
PRINT "Pythagorean theorem , right triangle"
INPUT "Please enter one leg side length: ", a
INPUT "Please enter the other leg side length: ", b
Pythagorean theorem , right triangle
Please enter one leg side length: 3
Please enter the other leg side length: 4
Deletions:
PRINT "Right triangle"
INPUT "Please enter one leg side: ", a
INPUT "Please enter the other leg side: ", b
Right triangle
Please enter one leg side: 3
Please enter the other leg side: 4


Revision [13796]

Edited on 2008-10-22 03:38:56 by DoS386 [minor, plese recheck "domain error (-1.#IND)"]
Additions:
This is the same as raising the argument //number// to the one-half power: y = x ^ (1/2) . The required ##//number//## argument can be any valid numeric expression greater than or equal zero.
'' Example of sqr function: Pythagorean theorem
DIM AS SINGLE a , b
PRINT "Right triangle"
PRINT
INPUT "Please enter one leg side: ", a
INPUT "Please enter the other leg side: ", b
PRINT
PRINT "The hypotenuse has a length of: " ; SQR ( a * a + b * b )
Right triangle
Please enter one leg side: 3
Please enter the other leg side: 4
The hypotenuse has a length of: 5
Deletions:
This is the same as raising the argument //number// to the one-half power ( ^ 1/2). The required ##//number//## argument can be any valid numeric expression greater than zero.
DIM a AS SINGLE
DIM b AS SINGLE
INPUT "Please enter one side of a right triangle: ",a
INPUT "Please enter another side of a right triangle: ",b
PRINT ""
PRINT "The hypotenuse of the triangle has a length of"; SQR ( a * a + b * b )
Please enter one side of a Right triangle: 3
Please enter another side of a Right triangle: 4
The hypotenuse of the triangle has a length of 5


Revision [9969]

The oldest known version of this page was created on 2007-07-24 05:48:53 by JeffMarshall [minor, plese recheck "domain error (-1.#IND)"]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode