quickstep-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zuyu <...@git.apache.org>
Subject [GitHub] incubator-quickstep pull request #37: DO NOT MERGE: QUICKSTEP-6: Decimal typ...
Date Fri, 17 Jun 2016 16:40:59 GMT
Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/37#discussion_r67539660
  
    --- Diff: types/DecimalLit.hpp ---
    @@ -0,0 +1,131 @@
    +/**
    + *   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
    + *     University of Wisconsin—Madison.
    + *
    + *   Licensed under the Apache License, Version 2.0 (the "License");
    + *   you may not use this file except in compliance with the License.
    + *   You may obtain a copy of the License at
    + *
    + *       http://www.apache.org/licenses/LICENSE-2.0
    + *
    + *   Unless required by applicable law or agreed to in writing, software
    + *   distributed under the License is distributed on an "AS IS" BASIS,
    + *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + *   See the License for the specific language governing permissions and
    + *   limitations under the License.
    + **/
    +
    +#ifndef QUICKSTEP_TYPES_DECIMAL_LIT_HPP_
    +#define QUICKSTEP_TYPES_DECIMAL_LIT_HPP_
    +
    +#include <cstdint>
    +#include <cmath>
    +
    +namespace quickstep {
    +
    +/** \addtogroup Type
    + *  @{
    + */
    +
    +/**
    + * @brief A literal representing fixed-precision decimal.
    + **/
    +struct DecimalLit {
    +  typedef std::int64_t data_type;
    +
    +  static DecimalLit fromDouble(double value) {
    +    return DecimalLit{static_cast<data_type>(value * kMaxFractionInt)};
    +  }
    +
    +  static DecimalLit fromInt(int64_t value) {
    +    return DecimalLit{static_cast<data_type>(value * kMaxFractionInt)};
    +  }
    +
    +  data_type data_;
    +
    +  static constexpr std::int64_t kPrecisionWidth = 2;
    +
    +  static constexpr std::int64_t kMaxFractionInt = 100;
    --- End diff --
    
    Question: Do we have some `SQL` references for these constant values?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message