Jump to content

MsgBox(0,'',-27^(1/3)) [SOLVED]


Recommended Posts

I'm not good at math (anymore) but isn't this the cube root of -27? And I think the root of a negative number isn't defined in AutoIt.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

It shouldn't return -3.

Why?

Extraction Wikipedia:

The cube roots of a number x are the numbers y which satisfy the equation

Real numbers........

If x and y are real, then there is a unique solution and so the cube root of a real number is sometimes defined by this equation. If this definition is used, the cube root of a negative number is a negative number. The principal cube root of x is also represented by.......

http://en.wikipedia.org/wiki/Cube_root

;)

Stefan

Link to comment
Share on other sites

Manadar is thinking of the square root of a negative number such as

(-9)^(1/2)

to which the answer would be 3i if including answers outside the real domain

Without including answers in the imaginary plane, there is no result, and it is undefined

AutoIt does not support mathematics in the non-real plane and therefore it cannot find the even root of a negative number, but should be able retrieve the odd root of a negative number assuming that it supports all basic arithmetic in the real plane.

For

(-27)^(1/3)

You are taking the CUBE root of a negative number.

The answer is -3 because:

(-3)(-3)(-3) = -27

When multiplying the initial (-3)(-3) you get positive 9 because the negatives cancel

The third -3 reintroduces the negative, making the expression negative.

I personally would call the undefined result a bug, but one that is probably not worth fixing.

If you really want math outside the real domain, I suggest writing a UDF for it.

Edit: typo

Edited by NerdFencer

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Link to comment
Share on other sites

I personally would call the undefined result a bug, but one that is probably not worth fixing.

If you really want math outside the real domain, I suggest writing a UDF for it.

I agree. It would eventually slow down the arithmetic evaluator.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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