# Yaml and Bignum

**URL:** <https://www.ruby-forum.com/t/yaml-and-bignum/98922>\
**Category:** Ruby\
**Created:** [July 19, 2006, 1:02am UTC](https://www.ruby-forum.com/t/yaml-and-bignum/98922 "2006-07-19T01:02:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 19, 2006, 1:02am UTC](https://www.ruby-forum.com/t/yaml-and-bignum/98922/1 "2006-07-19T01:02:51Z")

</div>

i get an error reading a yaml file :

TypeError: allocator undefined for Bignum

afaik, it’s due to this line in my file :

mappings\_file\_mtime: !ruby/object:Bignum 1151152397

someone knows a workaround for that

this is a date in seconds since epoch, as far as i know, then i could  
substract a constant, because i might change “epoch” to 2000 …

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 19, 2006, 9:14am UTC](https://www.ruby-forum.com/t/yaml-and-bignum/98922/2 "2006-07-19T09:14:57Z")

</div>

Le 19 juil. 06 Ã 01:00, Une bÃ©vue a Ã©crit :

> someone knows a workaround for that

the "workaround i’ve found is :

define :

CENT\_MIL=100000.to\_f  
EPOCH\_2006=Time.local(2006,7,19).to\_i.to\_f/CENT\_MIL  
add a method to the class Time :

class Time

def to\_fref

self.to\_i.to\_f/CENT\_MIL - EPOCH\_2006

end

hoping with floating values the prob vanished…

yaml doesn’t complain anymore
