标签: overflow

NEON 如何处理溢出?

我想知道 Neon 如何处理溢出。例如:

uint8x8_t vadd_u8 (uint8x8_t, uint8x8_t)
Run Code Online (Sandbox Code Playgroud)

据我了解,这是 2 个向量的加法(每个向量有 8 个无符号字节元素)。假设两个向量的所有值都是 255。

在这种情况下我们应该期待什么结果?8 元素向量 (510,...510) 还是其他向量?

arm overflow neon

1
推荐指数
1
解决办法
673
查看次数

溢出 int 时 cin 的意外行为

所有,我这里有一些代码我无法解释其行为。下面发布了。我查看了为什么整数溢出会导致 C++ iostreams 错误?,但它并没有真正回答我的问题。

#include <iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int x;
    scanf("%d", &x);
    cout << "Value of x = " << x << endl;
    cin >> x;
    cout << "Failure Detected = " << cin.fail() << endl;
    cout << "Value of x = " << x << endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

因此,我希望这段代码要做的是读入一个整数,打印出该整数的值,读入另一个整数(进入同一个变量),然后打印出该整数。如果我输入 7 和 2,那么它会按预期工作。但是,如果我为第一个和第二个输入都输入 2^31(int 溢出 1),则第一个输出将显示“Value of x = -2147483648”,第二个输出将显示“Value of x = 2147483647”。cin.fail() 也会返回 true。cin 对输入做了什么?我认为如果 cin.fail() 为 true,则 x 的值应该不受影响。如果不受影响,我预计 …

c++ overflow cin

1
推荐指数
1
解决办法
2165
查看次数

显示:Flex 项目超出最大宽度

我有三个项目(列)并display: flex设置margin-left为它们。当我调整窗口大小并向右滚动时,它们将超出框/窗口(溢出)。第二个问题-第三张图片的高度不同,即使我设置max-height了它。这只是代码的一部分(即使在这里问题也会再次出现):

body {
  margin: 0;
  width: 100%;
}

.background {
  position: relative;
  width: 100%;
  height: 1000px;
  background-color: gray;
}

.articleContainer {
  position: relative;
  display: flex;
  width: 100%;
  height: 600px;
}

.content {
  position: relative;
  display: flex;
  margin-left: 10%;
  border-top: 7px solid rgb(227, 0, 26);
  height: 600px;
  background-color: black;
  top: -4px;
  width: 333px;
}

.content img {
  top: 0;
  max-height: 230px;
  width: 333px;
}

.box {
  position: absolute;
  width: 60px;
  height: 60px;
  top: 0; …
Run Code Online (Sandbox Code Playgroud)

html css overflow flexbox display

1
推荐指数
1
解决办法
362
查看次数

字符串对于.join而言太长时的变通方法.发生溢出错误

我正在pythonchallenge.com上解决一些python问题来教我自己python而且我遇到了障碍,因为我要使用的字符串太大而无法处理python.我收到此错误:

my-macbook:python owner1$ python singleoccurrence.py
Traceback (most recent call last):
  File "singleoccurrence.py", line 32, in <module>
    myString = myString.join(line)
OverflowError: join() result is too long for a Python string
Run Code Online (Sandbox Code Playgroud)

我对此问题有哪些替代方案?我的代码看起来像这样......

#open file testdata.txt
#for each character, check if already exists in array of checked characters
#if so, skip.
#if not, character.count
#if count > 1, repeat recursively with first character stripped off of page.
# if count = 1, add to valid character array.
#when string = 0, print valid …
Run Code Online (Sandbox Code Playgroud)

python overflow

0
推荐指数
1
解决办法
2929
查看次数

两个数字的LCM

我的LCM计划结果出错了.

如果找到数字的gcd,然后用gcd划分产品.

int gcd(int x, int y)
{
  while(y != 0)
  {
    int save = y;
    y = x % y;
    x = save;
  }
  return y;
}

int lcm(int x, int y)
{
  int prod = x * y;
  int Gcd = gcd(x,y);
  int lcm = prod / Gcd;

  return lcm;
}
Run Code Online (Sandbox Code Playgroud)

任何帮助非常感谢.

c algorithm overflow lcm greatest-common-divisor

0
推荐指数
1
解决办法
2625
查看次数

溢出时TextBox会自动调整大小(在WPF中)

我正在尝试创建一个属性面板,我正在使用列表框.我不知道制作动态表的另一种方法,所以这就是我所做的:

<DataTemplate x:Key="PropertyListTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Name}" />

            <ComboBox x:Name="combo"
                      Grid.Column="1"
                      ItemsSource="{Binding ComboItems}"
                      SelectedIndex="{Binding Value, Mode=TwoWay}" 
                      Visibility="Hidden" />

            <TextBox x:Name="text"
                     Grid.Column="1"
                     Text="{Binding Value, Mode=TwoWay}"
                     Visibility="Hidden" />
            <!-- ... More controls -->

        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding TypeString}" Value="Combobox">
                <Setter TargetName="combo" Property="Visibility" Value="Visible" />
            </DataTrigger>
            <!-- ... More triggers -->
        </DataTemplate.Triggers>
    </DataTemplate>
Run Code Online (Sandbox Code Playgroud)

问题是这样的:

溢出

当文本框或组合框溢出时,它会自动调整大小.如何禁用此行为?应根据父列表框的宽度调整控件的宽度...我不想要任何水平滚动条...

c# wpf combobox textbox overflow

0
推荐指数
1
解决办法
535
查看次数

得到double []的最低值

我写了以下代码

我的目标是获得最低值,doble[] absOfSub但它在线上给出了以下异常 compared= Double.compare(d2, d1);

Exception in thread "main" java.lang.StackOverflowError
Run Code Online (Sandbox Code Playgroud)

为什么溢出以及如何解决它?

编辑

  public class TestThe {
static double[] absOfSub = new double[5];
    private static int index=0;

  private static int compare(int currentIdx, int minIdx) {
      if(index < absOfSub.length) {
         if(absOfSub[currentIdx] < absOfSub[minIdx]) {
             compare(currentIdx + 1, currentIdx);
         } else {
             compare(currentIdx + 1, minIdx);
         }
      }
  return minIdx;
  }

    public static void main(String[] args) {
    absOfSub[0]=1000;
    absOfSub[1]=810;
    absOfSub[2]=108;
    absOfSub[3]=130;
    absOfSub[4]=110;
double result;
   int inndex= compare(0,1);
      System.out.println(absOfSub[inndex]);

    }
}
Run Code Online (Sandbox Code Playgroud)

java double overflow

0
推荐指数
1
解决办法
186
查看次数

检测输入中的整数溢出

在C或C++中是否有办法检查用户提供的数字是否超出整数类型的范围?

例如,让我们假设我们使用的是16位有符号整数,范围为-32768到32767.

如果用户输入55555进入程序,这将被包装成一个负数,这样如果你使用的函数可以接受任何数字,结果将是错误的.

在C或C++中是否有办法确定用户提供的数字是否在整数类型的范围内?


更新:我在一个简单的减法程序中使用数字,它接受两个数字并从第一个减去第二个数字.

c c++ integer overflow

0
推荐指数
1
解决办法
1507
查看次数

我怎么能漂浮一堆div并仍然溢出?

这是我的jsfiddle显示我的尝试:

HTML:

<div id="container">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>

</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

#container {
  width: 300px;
  height: 300px;
  border: 1px solid black;
  overflow-x: auto;
}

.box {
  float: left;
  width: 50px;
  height: 50px;
  border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud)

我希望/希望这个用水平滚动条创建一个长行.相反,boxes到达第二行时到达第二行container.我希望他们继续前进.我怎么能做到这一点?

html css overflow css-float

0
推荐指数
1
解决办法
71
查看次数

typescript - 检测div是否溢出文本

Angular2/Typescript中是否有一种方法可以检测div是否因文本溢出而取决于屏幕的宽度.如果文本溢出,我想显示"更多"按钮.右侧还有一个书签图标,所以我必须考虑到div的宽度.

在我的HTML中:

<div *ngFor="let i of items"> {{ i }} 
  <i class="fa fa-bookmark" aria-hidden="true"></i>
</div>

//If the text is overflow
<button *ngIf="overflow"> More </button>
Run Code Online (Sandbox Code Playgroud)

在我的打字稿中:

@HostListener('window', ['$event'])
public checkOverflow() {
    console.log(event.target.innerWidth)
}
Run Code Online (Sandbox Code Playgroud)

问题是如何考虑到侧面有其他元素,如何找出div宽度.还有另一种方法来检查字符串是否在javascript/typescript方面溢出?

javascript overflow width typescript angular

0
推荐指数
1
解决办法
4306
查看次数