2019-01-30 06:28:40 +09:00
|
|
|
package float
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
// SerializeFloat converts a float value to an interface representation suitable
|
|
|
|
// for marshalling into a text or binary format.
|
2019-02-05 06:29:04 +09:00
|
|
|
func SerializeFloat(this float64) (interface{}, error) {
|
2019-01-30 06:28:40 +09:00
|
|
|
return this, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeserializeFloat creates float value from an interface representation that has
|
|
|
|
// been unmarshalled from a text or binary format.
|
2019-02-05 06:29:04 +09:00
|
|
|
func DeserializeFloat(this interface{}) (float64, error) {
|
|
|
|
if f, ok := this.(float64); ok {
|
2019-01-30 06:28:40 +09:00
|
|
|
return f, nil
|
|
|
|
} else {
|
2019-02-05 06:29:04 +09:00
|
|
|
return 0, fmt.Errorf("%v cannot be interpreted as a float64 for xsd:float", this)
|
2019-01-30 06:28:40 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// LessFloat returns true if the left float value is less than the right value.
|
2019-02-05 06:29:04 +09:00
|
|
|
func LessFloat(lhs, rhs float64) bool {
|
2019-01-30 06:28:40 +09:00
|
|
|
return lhs < rhs
|
|
|
|
}
|