Skip to content

bug: abs bug and return of char vs array of chars #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion matrix/bulk_operate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class basic_uops_impl: public basic_uops
return "abs";
}
OutType operator()(const InType &e) const {
return (OutType) std::abs(e);
return e < 0 ? ((OutType) -e) : ((OutType) e);
}
};

Expand Down
4 changes: 2 additions & 2 deletions matrix/data_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ std::shared_ptr<char> gz_file_io::read_bytes(
if (ret <= 0) {
if (ret < 0 || !gzeof(f)) {
BOOST_LOG_TRIVIAL(fatal) << gzerror(f, &ret);
return std::unique_ptr<char[]>();
return std::unique_ptr<char>();
}
}
read_bytes += ret;
Expand Down Expand Up @@ -402,7 +402,7 @@ static size_t parse_lines(std::shared_ptr<char> line_buf, size_t size,
}
if (line - buf_start < (ssize_t) size)
lines.push_back(std::string(line));

return parser.parse(lines, df);
}

Expand Down