Spot calculate modulo of negative numbers incorrectly

I'm a math major Bachelor's degree. Sometimes I use a projector to check my calculations. However, when calculating the modulo (%) negative numbers by using spotlight, the calculator returns inaccurate answers. I was wondering if anyone else has noticed this, or why it could be (apart from the bad coding)?  For example, it returns,

-2 %3 =-2 and -1 = - 1 %3.

However, if you were to Google "-2 %3 ', or calculate this in Wolfram Alpha, R, C, Python, etc. you see:

-2 %3 = 1 and -1 %3 = 2.

These are indeed the right answers like:

-2 = 3*(-1) + 1et -1 = 3*(-1) + 2

I submitted via the official channel on this subject, but I thought I'd post here to draw attention to the problem.  I hope Apple solves this problem for the large number of students who use their products is not misled.

2011 Macbook Pro 13 ", OSX 10.11.3

It depends on the definition of the % operator. You expect it to be an operator "rest". Spotlight uses the same library as Xcode which defines it as a true modulo operator.

See here for the definition of the module: http://mathforum.org/library/drmath/view/52343.html

Tags: Notebooks

Similar Questions

  • do not take into account the negative numbers

    I have a column of numbers I would like to add, but I want only to add positive numbers and ignore the negative numbers. How to do?

    I suggest that you use SUMIF.

    The result I got for this formula was 11... -4 was NOT included in the SUM

  • How can I get negative numbers on my spreadsheet of numbers to be displayed in red.

    How can I get negative numbers on my spreadsheet of numbers to be displayed in red. The only thing that I can find in the menu turns formatting all the red cell. Not what I want

    Use the conditional formatting.

    Select the range of cells you want to format, and then open cell formatter:

    Now click the button of "conditional highlighting:

    Now click on the button «Add rule...» » :

    Now choose the rule "less to" a value of zero and choose the selection of red text to highlight

  • String to the Array.vi worksheet with negative numbers

    I was exploring a program posted on the developer zone titled "ClipboardtoNumericArray.vi" and noticed that it substitute 0 for elements with negative numbers. The 'String to Array.vi worksheet"working with negative numbers? If so, how?

    The problem is that your negative sign is not a negative sign.  This is the code ASCII 150.  I'll call it something like a "long dash", that's why it does not recognize the LabVIEW code.  A negative real sign you have in part E-6 is code ASCII 45.  And also why same Excel treats as text rather than a number.

    Where did you get the CSV file from?

  • How do you know if there are more positive or negative numbers?

    I'll try to explain my problem with an example, because I do not have labVIEW installed in the computer.

    I have 10 numbers and multiply to 10 other numbers

    and of course I get 10 results, after I have to show the value of meddium of this 10 results and must show the signal that most seem (+ or-)

    My problem is to show the signal, if I have 7 positive 3 numbers and negative numbers, how to measure and display the negative signal to the final?

    example:

    -0,3-0,8 1 0.3 0.6-0.7 - 0.1-0.5 0.3-0.4

    If I have to put in the final:

    -0.5

    Thank you

    You can do something similar (Simplified) altenbach proposed:

    If the output is true your table has more positive values.

  • negative numbers with 2 figures of percision

    I have a set of numbers of aprox - 2000 to 2000. If I by example-1234 I write as - 12.34.

    I can't find a way to do this.

    This works well for positive numbers:

    Help, please. Thank you

    Hi gtu.

    It is not a problem of the two's complement, it's all simple math: the rest must be positive, then the quotient will be one of less then expected (by you) for negative numbers.

    Solved by simple math:

  • Right axis graduations and negative numbers

    Has anyone else noticed that when you have a Y axis on the right side of a graph and showing ticks, it can be confusing because positive numbers look like negative numbers?  I played a bit with custom formatting, numbers, such as adding space before the number.  Other known improvements?

    Thank you

    DaveT

    You can change the color of the labels. That could make it a little clearer that it is not negative.

  • How to fix negative numbers in images u16

    Hello

    I have a 2d chart which is u16 (0-65 K) and trying to avoid a 'dark' of him. The problem is that it sometimes gives way to negative numbers and he made a wrap-around and shows the values as 65 K. Is there a function truncate or something to make them void. Sorry if this is a simple question. I only did labview for a few weeks.

    Thank you

    imageproblems,

    Have you considered casting the U16 to I32, making your subtraction, compel the value such that it does not fall below zero and ultimately return to U16 castant?

    I don't know, but it might work for you...

    Cheers, Matt

  • Y at - it a number of RTF format that displays negative numbers in parentheses in Excel?

    Hello

    I have an RTF template that formats a report to output HTML, PDF, Excel and Excel2000.

    I want to see negative numbers in square brackets, without a hyphen, by example-2568 as (2568) for the purpose of accounting reports.

    I tried different solutions to this problem that I found,

    #, ##0;(#,##0) is not good because it only works in HTML or PDF format

    #,##0_);" (« #, ## 0 ») "also not good that the format does not seem to be recognized.

    I saw another post that is to make a conditional script on the number and the concatenation in brackets, but I can do it in SQL cast to varchar type data extraction, treat numbers as strings.

    Is there an identifier of real formatting which works in all types of output files or is it a feature not supported?

    Thank you and best regards,

    Phil.

    Did you try to use the Force LTR and select the type as text. (assuming that the value in the XML file is "(2658)")

    So it should be something like:

    See you soon

    AJ

  • How to set the {} num.currency such way that it will display "-" sign for negative numbers instead of "()".

    Hi people from Adobe,.

    I am working on a form of invoice of Adobe, where currency a few fields may show as "-" if it is the negative number.

    I use display model num.currency {}, but its poster ($1,234,567.89), I want to display in the form $-1,234,567.89

    Is someone can you please let me know how to achieve this.

    2-25-2016 1-16-10 PM.jpg

    2-25-2016 1-27-20 PM.jpg

    Hello

    I wondered if it would be that simple.  It seems that the United States and Hong Kong are the only ones who use the media for negative numbers.  The Australian currency displayed as you wish.  Maybe you can go into the XML Source and change the line $z, zz9.99 | () $z, zz9.99) $z , zz9.99.  This is how the Australian looks... would need a few tests well.

    Or maybe you can have the hidden decimal field and display a text field with a calculation as DecimalField.formattedValue.replace(/[()]/g,"");. " Do you need to align the decimal points?

    Bruce

  • Exclude negative numbers?

    Is it possible to exclude negative numbers appear in numeric fields (currency)?

    For example, if a user tries to enter a negative number in a given area, is there a way to tell Adobe to clear the entry, or, better still, to prevent the user to do?

    Thanking you in advance.

    Hi Susan,.

    If you use the LC Designer, please use the following script to the output of the digital field event in the area of the script editor

    If (NumericField1.rawValue<>

    {

    NumericField1.rawValue ="";

    xfa.host.messageBox ("Please enter the positive value");

    xfa.host.setFocus (NumericField1);

    }

    Let me know if it works,

  • A character style that puts in shape all negative numbers (-10) with red color

    How to set a character style that formats all negative numbers (-10) with red (a predefined text style)?

    I guess that I should be using GREP, but it's kind again for me and I can't find an answer to this on google.

    -\d+?,\d+?\%|-\d+?

    seems to work

    GREP is synonymous with General Regular Expression Parser - large print receive codes and you insert the code to highlight the characters you want to

    In the that I provided above is probably not the nicest way to do it, but I'll break it

    -= minus sign

    \d = any digit

    + = Continue until there are no more numbers

    ? = off at the end of a group of numbers

    This means find any number within a group of numbers

    just means a comma

    and yet once I wanted to find any group of numbers with \d+?

    % means with a percentage at the end sign

    -\d+?,\d+?\% means find: sign, followed by a group of digits followed by a comma followed of another group of numbers followed by the percent sign.

    | [vertical] means OR

    -\d+? would be to find a

    -

    Group of figures

    -\d+?,\d+?\%|-\d+?

    All means find any group of numbers separated by a comma with a sign of percentage at the end OR a sign less with a group of figures.

  • HFM 11.1.2 forms/data grids - display of negative numbers

    If you want to display negative numbers differently... red color for example or with brackets instead of the negative sign
    Is there an easy way to do this?
    Is there a way to do this?




    Thank you
    PD

    These changes are possible in the user preferences.

  • Constraint on a range of negative numbers

    Oracle 10g

    What I'm doing wrong here? It seems I'm missing something dire...

    I want a constraint on a range of negative numbers

    create the table test_neg
    (
    neg_number NUMBER not null
    );

    ALTER table test_neg
    Add constraint test_chk
    check (neg_number between-1 and -100);

    INSERT INTO test_neg values(-50);

    Thanks in advance

    To allow values between-1 and -100 to be accepted and others rejected, you will have to do it like that.

    SQL > create table test_neg
    (
    neg_number NUMBER not null
    );

    ALTER table test_neg
    Add constraint test_chk
    check (neg_number between-100 and -1);<== between="">

    INSERT INTO test_neg values(-50); 2 3 4
    1 line of creation.

    SQL >
    SQL > INSERT INTO test_neg values(-500);
    INSERT INTO test_neg values(-500)
    *
    ERROR on line 1:
    ORA-02290: check constraint (SCOTT. TEST_CHK) violated

    SQL > INSERT INTO test_neg values (0);
    INSERT INTO test_neg values (0)
    *
    ERROR on line 1:
    ORA-02290: check constraint (SCOTT. TEST_CHK) violated

    SQL > INSERT INTO test_neg values(-5);

    1 line of creation.

    It may be useful

    / Magnus

  • Restrict negative numbers with Format mask

    Hello

    Is it possible to limit the negative numbers by using the format mask.


    Rgds


    sexy

    Hello

    Have you tried setting the smallest value allowed to 0?

    Arun-

Maybe you are looking for